Skip to main content

A powerful CLI for the Netdata Agent REST API — query metrics, charts, alarms, and functions from the terminal.

Project description

netdata-cli

PyPI version Python License: MIT

A powerful CLI for the Netdata Agent REST API.

Query metrics, charts, alarms, functions, and agent info — all from the terminal. Rich table output, JSON mode, time filtering, and search built-in.

┌─────────────────────────────────────────────┐
│            Netdata Agent                     │
│  Version   v2.10.4                          │
│  OS        Debian GNU/Linux 13 (trixie)     │
│  Kernel    Linux 6.8.0-136-generic          │
│  CPU Cores 4                                │
│  RAM       15.4 GiB                         │
│  Charts    1669                             │
│  Metrics   4124                             │
│  Alarms OK 603                              │
└─────────────────────────────────────────────┘

Installation

pip install netdata-cli

Or from source:

git clone https://github.com/sosiman/netdata-cli
cd netdata-cli
pip install -e .

Quick Start

# Agent info
nd info

# Check connectivity
nd ping

# Search charts
nd charts cpu
nd charts --type disk

# Get historical data
nd data system.cpu --after -300 --points 10
nd data mem.available --after -3600

# Alarms
nd alarms
nd alarms --active-only
nd alarm-log --after 86400

# Functions
nd functions
nd function docker:container-ls
nd function mount-points
nd function network-interfaces

# Collectors
nd collectors

# Raw JSON output
nd --json info
nd --json charts

Commands

Command Description
nd info Agent version, OS, CPU, RAM, chart/alarm counts, collectors
nd ping Check if the agent is reachable
nd charts [QUERY] List or search charts by id, title, type, units, dimensions
nd chart CHART_ID Show chart details (dimensions, metadata, history)
nd data CHART_ID Fetch historical data points with time range and grouping
nd alarms List health alarms (active or all)
nd alarm-log Alarm history with time filtering
nd allmetrics Snapshot of every metric (JSON, shell, or Prometheus format)
nd function NAME Call Netdata functions (docker, systemd, network, etc.)
nd functions List available functions
nd collectors List active data collectors

Configuration

Set the NETDATA_URL environment variable to point to a remote agent:

export NETDATA_URL=http://my-server:19999
nd info

Or pass --url on every call:

nd --url http://my-server:19999 charts

Output Formats

Every command supports --json (-j) for raw JSON output, useful for piping to jq:

nd --json charts | jq '.[] | select(.units == "percentage")'
nd --json alarms | jq '.[] | select(.status == "WARNING")'
nd --json data system.cpu | jq '.data[-1]'

Time Filtering

The --after flag accepts negative seconds (relative to now):

Value Meaning
-60 Last minute
-300 Last 5 minutes
-3600 Last hour
-86400 Last 24 hours
-604800 Last 7 days

Data granularity depends on the chart's update_every setting and the Netdata database retention.

Examples

Monitor CPU in real-time

watch -n 2 'nd data system.cpu --after -10 --points 10'

Find all disk charts

nd charts disk

Export all metrics as Prometheus

nd allmetrics --format prometheus

Check only critical alarms

nd alarms --active-only

List Docker containers via Netdata

nd function docker:container-ls

Show network interfaces

nd function network-interfaces

Requirements

  • Python 3.10+
  • A running Netdata agent (v1.x or v2.x)

Dependencies

Development

git clone https://github.com/sosiman/netdata-cli
cd netdata-cli
pip install -e ".[dev]"
pytest
ruff check .

License

MIT

Project details


Download files

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

Source Distribution

netdata_cli-0.2.0.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

netdata_cli-0.2.0-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

Details for the file netdata_cli-0.2.0.tar.gz.

File metadata

  • Download URL: netdata_cli-0.2.0.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for netdata_cli-0.2.0.tar.gz
Algorithm Hash digest
SHA256 42e7f672b8cce2437d06e483f267d3f73adad098615906fc0dae2241ee4372b8
MD5 bbab22b487096b1dc40759780514e1ff
BLAKE2b-256 a6c93c929afbee84a0e5e1bb56263f3ba5379787cfbfbe9ad59d331cf9c57c42

See more details on using hashes here.

File details

Details for the file netdata_cli-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: netdata_cli-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for netdata_cli-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ec147e6dc8f7423abf3d0b8b120ae7c3758c8818a19cf47d929fc457d1f818c
MD5 e56ecfc21672abe5ba580df0d3aa0f13
BLAKE2b-256 c464f43e8ca986155c31d6ad7fabe265f26726f659d402e4fae646849851745c

See more details on using hashes here.

Supported by

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