diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-nsgcli.spec | 241 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 243 insertions, 0 deletions
@@ -0,0 +1 @@ +/nsgcli-2.2.1.tar.gz diff --git a/python-nsgcli.spec b/python-nsgcli.spec new file mode 100644 index 0000000..a7a109a --- /dev/null +++ b/python-nsgcli.spec @@ -0,0 +1,241 @@ +%global _empty_manifest_terminate_build 0 +Name: python-nsgcli +Version: 2.2.1 +Release: 1 +Summary: NetSpyGlass CLI +License: Apache +URL: https://github.com/happygears/nsgcli +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/32/8b/f238262938c813df80a14912c0a60e4ee6d69203fab538513945c4b9cef0/nsgcli-2.2.1.tar.gz +BuildArch: noarch + +Requires: python3-requests +Requires: python3-requests-unixsocket +Requires: python3-pyhocon +Requires: python3-typing +Requires: python3-dateutil +Requires: python3-pytz +Requires: python3-tabulate +Requires: python3-gnmi-proto +Requires: python3-pandas +Requires: python3-jsonpath-ng + +%description +# NetSpyGlass Command Line Tools + +this package installs Python module `nsgcli` and two command line scripts: `nsgcli` and `nsgql` that +use it + +Use script `tools/build.sh` to build and `tools/upload.sh` to push to pypi + +Example of API call made by `nsgcli` to nsg-api service: + +* System status + + ```bash + curl -H "X-NSG-Auth-API-Token:$NSG_API_TOKEN" $NSG_SERVICE_URL/v2/nsg/cluster/net/1/status + ``` + +* NSGQL + + ```bash + curl -d '{"targets": [{"format":"table", "nsgql":"select count(key) from alerts"}]}' -X POST -H "X-NSG-Auth-API-Token:$NSG_API_TOKEN" $NSG_SERVICE_URL/v2/query/net/1/data/ + ``` + +* NSGGROK + + Parse text with custom pattern + ```bash + nsggrok --pattern "hello world of %{WORD:world_name}" text "hello world of Grok" + { + "world_name": "Grok" + } + ``` + + Parse syslog message with built-in patterns + ```bash + nsggrok log "<13>May 18 11:22:43 carrier sshd: SSHD_LOGIN_FAILED: Login failed for user 'root' from host '10.1.1.1'" + { + "sshUser": "root", + "index": "labdcdev-syslog-short", + "sshSrcIp": "10.1.1.1", + "logText": "SSHD_LOGIN_FAILED: Login failed for user 'root' from host '10.1.1.1'", + "prio": "13", + "logSyslogSeverityName": "notice", + "logSource": "carrier", + "logSyslogText": "<13>May 18 11:22:43 carrier sshd: SSHD_LOGIN_FAILED: Login failed for user 'root' from host '10.1.1.1'", + "logSyslogFacilityName": "user", + "logTimestamp": "2021-05-18T11:22:43.000Z", + "program": "sshd", + "logSyslogPriority": 13, + "timestamp": "May 18 11:22:43", + "logSyslogFacilityCode": 1, + "logSyslogSeverityCode": 5 + } + ``` + + + +%package -n python3-nsgcli +Summary: NetSpyGlass CLI +Provides: python-nsgcli +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-nsgcli +# NetSpyGlass Command Line Tools + +this package installs Python module `nsgcli` and two command line scripts: `nsgcli` and `nsgql` that +use it + +Use script `tools/build.sh` to build and `tools/upload.sh` to push to pypi + +Example of API call made by `nsgcli` to nsg-api service: + +* System status + + ```bash + curl -H "X-NSG-Auth-API-Token:$NSG_API_TOKEN" $NSG_SERVICE_URL/v2/nsg/cluster/net/1/status + ``` + +* NSGQL + + ```bash + curl -d '{"targets": [{"format":"table", "nsgql":"select count(key) from alerts"}]}' -X POST -H "X-NSG-Auth-API-Token:$NSG_API_TOKEN" $NSG_SERVICE_URL/v2/query/net/1/data/ + ``` + +* NSGGROK + + Parse text with custom pattern + ```bash + nsggrok --pattern "hello world of %{WORD:world_name}" text "hello world of Grok" + { + "world_name": "Grok" + } + ``` + + Parse syslog message with built-in patterns + ```bash + nsggrok log "<13>May 18 11:22:43 carrier sshd: SSHD_LOGIN_FAILED: Login failed for user 'root' from host '10.1.1.1'" + { + "sshUser": "root", + "index": "labdcdev-syslog-short", + "sshSrcIp": "10.1.1.1", + "logText": "SSHD_LOGIN_FAILED: Login failed for user 'root' from host '10.1.1.1'", + "prio": "13", + "logSyslogSeverityName": "notice", + "logSource": "carrier", + "logSyslogText": "<13>May 18 11:22:43 carrier sshd: SSHD_LOGIN_FAILED: Login failed for user 'root' from host '10.1.1.1'", + "logSyslogFacilityName": "user", + "logTimestamp": "2021-05-18T11:22:43.000Z", + "program": "sshd", + "logSyslogPriority": 13, + "timestamp": "May 18 11:22:43", + "logSyslogFacilityCode": 1, + "logSyslogSeverityCode": 5 + } + ``` + + + +%package help +Summary: Development documents and examples for nsgcli +Provides: python3-nsgcli-doc +%description help +# NetSpyGlass Command Line Tools + +this package installs Python module `nsgcli` and two command line scripts: `nsgcli` and `nsgql` that +use it + +Use script `tools/build.sh` to build and `tools/upload.sh` to push to pypi + +Example of API call made by `nsgcli` to nsg-api service: + +* System status + + ```bash + curl -H "X-NSG-Auth-API-Token:$NSG_API_TOKEN" $NSG_SERVICE_URL/v2/nsg/cluster/net/1/status + ``` + +* NSGQL + + ```bash + curl -d '{"targets": [{"format":"table", "nsgql":"select count(key) from alerts"}]}' -X POST -H "X-NSG-Auth-API-Token:$NSG_API_TOKEN" $NSG_SERVICE_URL/v2/query/net/1/data/ + ``` + +* NSGGROK + + Parse text with custom pattern + ```bash + nsggrok --pattern "hello world of %{WORD:world_name}" text "hello world of Grok" + { + "world_name": "Grok" + } + ``` + + Parse syslog message with built-in patterns + ```bash + nsggrok log "<13>May 18 11:22:43 carrier sshd: SSHD_LOGIN_FAILED: Login failed for user 'root' from host '10.1.1.1'" + { + "sshUser": "root", + "index": "labdcdev-syslog-short", + "sshSrcIp": "10.1.1.1", + "logText": "SSHD_LOGIN_FAILED: Login failed for user 'root' from host '10.1.1.1'", + "prio": "13", + "logSyslogSeverityName": "notice", + "logSource": "carrier", + "logSyslogText": "<13>May 18 11:22:43 carrier sshd: SSHD_LOGIN_FAILED: Login failed for user 'root' from host '10.1.1.1'", + "logSyslogFacilityName": "user", + "logTimestamp": "2021-05-18T11:22:43.000Z", + "program": "sshd", + "logSyslogPriority": 13, + "timestamp": "May 18 11:22:43", + "logSyslogFacilityCode": 1, + "logSyslogSeverityCode": 5 + } + ``` + + + +%prep +%autosetup -n nsgcli-2.2.1 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-nsgcli -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 15 2023 Python_Bot <Python_Bot@openeuler.org> - 2.2.1-1 +- Package Spec generated @@ -0,0 +1 @@ +1c256898a44484223f68c7df302f470c nsgcli-2.2.1.tar.gz |
