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
curl -H "X-NSG-Auth-API-Token:$NSG_API_TOKEN" $NSG_SERVICE_URL/v2/nsg/cluster/net/1/status
-
NSGQL
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
nsggrok --pattern "hello world of %{WORD:world_name}" text "hello world of Grok" { "world_name": "Grok" }
Parse syslog message with built-in patterns
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 }
-
Meraki API call
curl -G -H "X-NSG-Auth-API-Token:$NSG_API_TOKEN" $NSG_SERVICE_URL/v2/nsg/cluster/net/1/exec/api --data-urlencode 'region=world' --data-urlencode 'url=https://api.meraki.com/api/v1/organizations/626563298157920259/devices' --data-urlencode 'method=GET' --data-urlencode 'args=gap-meraki'
- Test connection to remote server
curl -G -H "X-NSG-Auth-API-Token:$NSG_API_TOKEN" $NSG_SERVICE_URL/v2/nsg/cluster/net/1/exec/connect --data-urlencode 'region=world' --data-urlencode 'args=10.210.24.112 9339 1000'
- Set log level
curl -G -H "X-NSG-Auth-API-Token:$NSG_API_TOKEN" $NSG_SERVICE_URL/v2/nsg/cluster/net/1/exec/set_log_level --data-urlencode 'region=world' --data-urlencode 'args=tme-server-15v io.grpc DEBUG'
- Send PING command to an agent
curl -L -H "X-NSG-Auth-API-Token:$NSG_API_TOKEN" $NSG_SERVICE_URL/apiv3/net/1/exec/ping/agent/vkhome?address=127.0.0.1
Metadata
Release files for nsgcli 2.2.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nsgcli-2.2.9.tar.gz | 35.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nsgcli-2.2.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 83.8 kB
Release files / nsgcli-2.2.9.tar.gz
| Download URL | nsgcli-2.2.9.tar.gz |
|---|---|
| Size | 35.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
01d074a3ac09718e8c0fae1d6fa8598ff436affc43187edaad4b03920e4aeec7
|
|
BLAKE2b-256 checksum How to use checksums |
8b3c5d9079880af50cb968a0dff551ee57624d5dcf734d1f70c693258bd59997
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / nsgcli-2.2.9-py3-none-any.whl
| Download URL | nsgcli-2.2.9-py3-none-any.whl |
|---|---|
| Size | 48.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
089f0ddc30608ae6694627c081b125d2b4fd3b5597ac7cc00b5336c559672c59
|
|
BLAKE2b-256 checksum How to use checksums |
5ac3b6439f0630e92578d2916bad20f60c45cb9d4ec3d4a6c9ca813e1736f608
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|