Skip to main content

NetSpyGlass CLI

Project 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

    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

Project details


Release history Release notifications | RSS feed

This version

2.2.6

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nsgcli-2.2.6.tar.gz (34.0 kB view details)

Uploaded Source

Built Distribution

nsgcli-2.2.6-py3-none-any.whl (47.7 kB view details)

Uploaded Python 3

File details

Details for the file nsgcli-2.2.6.tar.gz.

File metadata

  • Download URL: nsgcli-2.2.6.tar.gz
  • Upload date:
  • Size: 34.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for nsgcli-2.2.6.tar.gz
Algorithm Hash digest
SHA256 652c53343405c54b6c2a41a1b32e9b95e84ccf61d94348cf9e206b3ae227cbc2
MD5 757c221e2876f4e6956a9f6b8144a9bf
BLAKE2b-256 c9bfb19197aeed5def74e26f9520efb755dbe7e527148e1fe4539e0a3e838627

See more details on using hashes here.

File details

Details for the file nsgcli-2.2.6-py3-none-any.whl.

File metadata

  • Download URL: nsgcli-2.2.6-py3-none-any.whl
  • Upload date:
  • Size: 47.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for nsgcli-2.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 8027a3a470580c19b73277998850a02b52518f9f35a99a95bf172f2a3fe40a3c
MD5 b9a1e60b4fc03faeee26e29fdb6f5dcc
BLAKE2b-256 388c5cb78673348391622ceb48d773e7059da6ef9960d6d00a66168a1dd5793b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page