Skip to main content

NetSpyGlass Command Line Tools (nsgcli)

Command-line utilities and Python client library for NetSpyGlass Network Monitoring System (NMS).

This package provides command-line tools for querying data, checking cluster health, managing alert silences, diagnosing network agents, and working with gNMI telemetry:

  • nsgql: Query metrics, interface states, alerts, and topology using NsgQL (NetSpyGlass Query Language) with tabular, JSON, or time series output.
  • nsgcli: Interactive and batch control interface for server status, discovery queues, device management, and agent execution commands (ping, fping, traceroute).
  • silence: Add, update, and list active or scheduled alert silences.

Installation & Upgrade

uv installs the CLI tools into an isolated environment and links the executables into your PATH:

# Install
uv tool install nsgcli

# Upgrade to latest version
uv tool upgrade nsgcli

Using pip

# Install
pip install --user nsgcli

# Upgrade
pip install --user --upgrade nsgcli

Configuration

Set default connection parameters via environment variables in your shell profile (e.g. ~/.zshrc or ~/.bashrc):

export NSG_SERVICE_URL="https://nsg.example.com:9100"
export NSG_API_TOKEN="your-api-access-token"

Alternatively, pass them explicitly on each invocation with --base-url (or -b) and --token (or -a).


Commands and Usage

1. NsgQL Queries (nsgql)

Run queries against the NetSpyGlass data store. Output formats include table (default ASCII table), json, list, or time_series.

# Run a query with tabular output
nsgql "select deviceId, device, address, interface, ifAddress from interfaces where address='10.0.0.1'"

# Count active alerts
nsgql "select count(key) from alerts"

# Output as JSON
nsgql -f json "select device, address from interfaces limit 5"

# Run interactively
nsgql

Corresponding Backend API:

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/

2. Cluster Control & Diagnostics (nsgcli)

Execute commands either interactively or as single-line invocations:

# Check server and cluster version
nsgcli show version

# View cluster status
nsgcli show status

# Check discovery queue
nsgcli discovery queue

# Run ping from a specific agent
nsgcli agent ping <agent-name> 10.0.0.1

# Run fping from an agent
nsgcli agent fping <agent-name> 10.0.0.1

# Run traceroute from an agent
nsgcli agent traceroute <agent-name> 10.0.0.1

# Adjust log level on an agent
nsgcli agent set_log_level <agent-name> io.grpc DEBUG

# Start interactive shell
nsgcli

Corresponding Backend APIs:

# System status:
curl -H "X-NSG-Auth-API-Token:$NSG_API_TOKEN" \
  $NSG_SERVICE_URL/v2/nsg/cluster/net/1/status

# Agent ping:
curl -L -H "X-NSG-Auth-API-Token:$NSG_API_TOKEN" \
  "$NSG_SERVICE_URL/apiv3/net/1/exec/ping/agent/<agent-name>?address=10.0.0.1"

# Set agent 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=<agent-name> io.grpc DEBUG'

3. Alert Silencing (silence)

Manage temporary maintenance silences for alerts:

# List active and upcoming silences
silence list

# Silence all alerts for a specific device for 60 minutes
silence add --var_name='.*' --dev_id=212 --expiration=60 --reason="Scheduled maintenance"

# Silence a specific alert variable with tags
silence add --var_name='busyCpuAlert' --tags='Explicit.prod' --expiration=120

# Update expiration on an existing silence
silence update --id=8 --expiration=180

Metadata

Release files for nsgcli 2.2.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nsgcli 2.2.10
File Size Uploaded
nsgcli-2.2.10.tar.gz 38.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nsgcli 2.2.10
File Interpreter ABI Platform
nsgcli-2.2.10-py3-none-any.whl Python 3 none any Details

Total release size: 87.5 kB

Release files / nsgcli-2.2.10.tar.gz

Download URL nsgcli-2.2.10.tar.gz
Size 38.8 kB
Tags Source
SHA-256 checksum
How to use checksums
21c805c71c46e65c6ab27f8bdc89c1f037269c5c307efeeba5ccc93305731cd3
BLAKE2b-256 checksum
How to use checksums
bef6f1c1fb497b54e5c594afc573d13f9b15030726a23f97d4ad12134839c71d
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.10-py3-none-any.whl

Download URL nsgcli-2.2.10-py3-none-any.whl
Size 48.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b04bb8c8583dda9f7b79478741fad15f92745bd4565aba3c810174baee5db3e
BLAKE2b-256 checksum
How to use checksums
e146b120287672fc2c387b863f0f4d08fa0a37b4a558a772c22780c3f3af3cbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release history Release notifications | RSS feed

This release

2.2.10 This release

2 release files

2.2.9

2 release files

2.2.8

2 release files

2.2.6

2 release files

2.2.5

2 release files

2.2.4

2 release files

2.2.3

2 release files

2.2.2

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.2

2 release files

2.1.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.1.21

2 release files

1.1.19

2 release files

1.1.18

2 release files

1.1.17

2 release files

1.1.16

2 release files

1.1.15

2 release files

1.1.14

2 release files

1.1.13

2 release files

1.1.12

2 release files

1.1.11

2 release files

1.1.10

2 release files

1.1.9

2 release files

1.1.8

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.0.47

3 release files

1.0.45

2 release files

1.0.44

2 release files

1.0.42

2 release files

1.0.41

2 release files

1.0.40

2 release files

1.0.39

2 release files

1.0.38

2 release files

1.0.36

2 release files

1.0.31

2 release files

1.0.30

2 release files

1.0.29

2 release files

1.0.28

2 release files

1.0.26

2 release files

1.0.24

2 release files

1.0.23

2 release files

1.0.20

2 release files

1.0.19

2 release files

1.0.15

2 release files

1.0.13

2 release files

1.0.12

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page