netdata-cli 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sosi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,223 @@
1
+ Metadata-Version: 2.4
2
+ Name: netdata-cli
3
+ Version: 0.1.0
4
+ Summary: A powerful CLI for the Netdata Agent REST API — query metrics, charts, alarms, and functions from the terminal.
5
+ Author-email: Sosi <sosi@example.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/sosiman/netdata-cli
8
+ Project-URL: Repository, https://github.com/sosiman/netdata-cli
9
+ Project-URL: Issues, https://github.com/sosiman/netdata-cli/issues
10
+ Keywords: netdata,cli,monitoring,metrics,devops,observability
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: System Administrators
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: System :: Monitoring
22
+ Classifier: Topic :: System :: Systems Administration
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: click>=8.0
27
+ Requires-Dist: requests>=2.28
28
+ Requires-Dist: rich>=13.0
29
+ Provides-Extra: dev
30
+ Requires-Dist: pytest>=7.0; extra == "dev"
31
+ Requires-Dist: pytest-cov; extra == "dev"
32
+ Requires-Dist: ruff; extra == "dev"
33
+ Requires-Dist: mypy; extra == "dev"
34
+ Dynamic: license-file
35
+
36
+ # netdata-cli
37
+
38
+ A powerful CLI for the [Netdata](https://www.netdata.cloud/) Agent REST API.
39
+
40
+ Query metrics, charts, alarms, functions, and agent info — all from the terminal.
41
+ Rich table output, JSON mode, time filtering, and search built-in.
42
+
43
+ ```
44
+ ┌─────────────────────────────────────────────┐
45
+ │ Netdata Agent │
46
+ │ Version v2.10.4 │
47
+ │ OS Debian GNU/Linux 13 (trixie) │
48
+ │ Kernel Linux 6.8.0-136-generic │
49
+ │ CPU Cores 4 │
50
+ │ RAM 15.4 GiB │
51
+ │ Charts 1669 │
52
+ │ Metrics 4124 │
53
+ │ Alarms OK 603 │
54
+ └─────────────────────────────────────────────┘
55
+ ```
56
+
57
+ ## Installation
58
+
59
+ ```bash
60
+ pip install netdata-cli
61
+ ```
62
+
63
+ Or from source:
64
+
65
+ ```bash
66
+ git clone https://github.com/sosiman/netdata-cli
67
+ cd netdata-cli
68
+ pip install -e .
69
+ ```
70
+
71
+ ## Quick Start
72
+
73
+ ```bash
74
+ # Agent info
75
+ nd info
76
+
77
+ # Check connectivity
78
+ nd ping
79
+
80
+ # Search charts
81
+ nd charts cpu
82
+ nd charts --type disk
83
+
84
+ # Get historical data
85
+ nd data system.cpu --after -300 --points 10
86
+ nd data mem.available --after -3600
87
+
88
+ # Alarms
89
+ nd alarms
90
+ nd alarms --active-only
91
+ nd alarm-log --after 86400
92
+
93
+ # Functions
94
+ nd functions
95
+ nd function docker:container-ls
96
+ nd function mount-points
97
+ nd function network-interfaces
98
+
99
+ # Collectors
100
+ nd collectors
101
+
102
+ # Raw JSON output
103
+ nd --json info
104
+ nd --json charts
105
+ ```
106
+
107
+ ## Commands
108
+
109
+ | Command | Description |
110
+ |---|---|
111
+ | `nd info` | Agent version, OS, CPU, RAM, chart/alarm counts, collectors |
112
+ | `nd ping` | Check if the agent is reachable |
113
+ | `nd charts [QUERY]` | List or search charts by id, title, type, units, dimensions |
114
+ | `nd chart CHART_ID` | Show chart details (dimensions, metadata, history) |
115
+ | `nd data CHART_ID` | Fetch historical data points with time range and grouping |
116
+ | `nd alarms` | List health alarms (active or all) |
117
+ | `nd alarm-log` | Alarm history with time filtering |
118
+ | `nd allmetrics` | Snapshot of every metric (JSON, shell, or Prometheus format) |
119
+ | `nd function NAME` | Call Netdata functions (docker, systemd, network, etc.) |
120
+ | `nd functions` | List available functions |
121
+ | `nd collectors` | List active data collectors |
122
+
123
+ ## Configuration
124
+
125
+ Set the `NETDATA_URL` environment variable to point to a remote agent:
126
+
127
+ ```bash
128
+ export NETDATA_URL=http://my-server:19999
129
+ nd info
130
+ ```
131
+
132
+ Or pass `--url` on every call:
133
+
134
+ ```bash
135
+ nd --url http://my-server:19999 charts
136
+ ```
137
+
138
+ ## Output Formats
139
+
140
+ Every command supports `--json` (`-j`) for raw JSON output, useful for piping to `jq`:
141
+
142
+ ```bash
143
+ nd --json charts | jq '.[] | select(.units == "percentage")'
144
+ nd --json alarms | jq '.[] | select(.status == "WARNING")'
145
+ nd --json data system.cpu | jq '.data[-1]'
146
+ ```
147
+
148
+ ## Time Filtering
149
+
150
+ The `--after` flag accepts negative seconds (relative to now):
151
+
152
+ | Value | Meaning |
153
+ |---|---|
154
+ | `-60` | Last minute |
155
+ | `-300` | Last 5 minutes |
156
+ | `-3600` | Last hour |
157
+ | `-86400` | Last 24 hours |
158
+ | `-604800` | Last 7 days |
159
+
160
+ Data granularity depends on the chart's `update_every` setting and the Netdata database retention.
161
+
162
+ ## Examples
163
+
164
+ ### Monitor CPU in real-time
165
+
166
+ ```bash
167
+ watch -n 2 'nd data system.cpu --after -10 --points 10'
168
+ ```
169
+
170
+ ### Find all disk charts
171
+
172
+ ```bash
173
+ nd charts disk
174
+ ```
175
+
176
+ ### Export all metrics as Prometheus
177
+
178
+ ```bash
179
+ nd allmetrics --format prometheus
180
+ ```
181
+
182
+ ### Check only critical alarms
183
+
184
+ ```bash
185
+ nd alarms --active-only
186
+ ```
187
+
188
+ ### List Docker containers via Netdata
189
+
190
+ ```bash
191
+ nd function docker:container-ls
192
+ ```
193
+
194
+ ### Show network interfaces
195
+
196
+ ```bash
197
+ nd function network-interfaces
198
+ ```
199
+
200
+ ## Requirements
201
+
202
+ - Python 3.10+
203
+ - A running Netdata agent (v1.x or v2.x)
204
+
205
+ ## Dependencies
206
+
207
+ - [click](https://click.palletsprojects.com/) — CLI framework
208
+ - [requests](https://requests.readthedocs.io/) — HTTP client
209
+ - [rich](https://rich.readthedocs.io/) — Terminal formatting
210
+
211
+ ## Development
212
+
213
+ ```bash
214
+ git clone https://github.com/sosiman/netdata-cli
215
+ cd netdata-cli
216
+ pip install -e ".[dev]"
217
+ pytest
218
+ ruff check .
219
+ ```
220
+
221
+ ## License
222
+
223
+ [MIT](LICENSE)
@@ -0,0 +1,188 @@
1
+ # netdata-cli
2
+
3
+ A powerful CLI for the [Netdata](https://www.netdata.cloud/) Agent REST API.
4
+
5
+ Query metrics, charts, alarms, functions, and agent info — all from the terminal.
6
+ Rich table output, JSON mode, time filtering, and search built-in.
7
+
8
+ ```
9
+ ┌─────────────────────────────────────────────┐
10
+ │ Netdata Agent │
11
+ │ Version v2.10.4 │
12
+ │ OS Debian GNU/Linux 13 (trixie) │
13
+ │ Kernel Linux 6.8.0-136-generic │
14
+ │ CPU Cores 4 │
15
+ │ RAM 15.4 GiB │
16
+ │ Charts 1669 │
17
+ │ Metrics 4124 │
18
+ │ Alarms OK 603 │
19
+ └─────────────────────────────────────────────┘
20
+ ```
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ pip install netdata-cli
26
+ ```
27
+
28
+ Or from source:
29
+
30
+ ```bash
31
+ git clone https://github.com/sosiman/netdata-cli
32
+ cd netdata-cli
33
+ pip install -e .
34
+ ```
35
+
36
+ ## Quick Start
37
+
38
+ ```bash
39
+ # Agent info
40
+ nd info
41
+
42
+ # Check connectivity
43
+ nd ping
44
+
45
+ # Search charts
46
+ nd charts cpu
47
+ nd charts --type disk
48
+
49
+ # Get historical data
50
+ nd data system.cpu --after -300 --points 10
51
+ nd data mem.available --after -3600
52
+
53
+ # Alarms
54
+ nd alarms
55
+ nd alarms --active-only
56
+ nd alarm-log --after 86400
57
+
58
+ # Functions
59
+ nd functions
60
+ nd function docker:container-ls
61
+ nd function mount-points
62
+ nd function network-interfaces
63
+
64
+ # Collectors
65
+ nd collectors
66
+
67
+ # Raw JSON output
68
+ nd --json info
69
+ nd --json charts
70
+ ```
71
+
72
+ ## Commands
73
+
74
+ | Command | Description |
75
+ |---|---|
76
+ | `nd info` | Agent version, OS, CPU, RAM, chart/alarm counts, collectors |
77
+ | `nd ping` | Check if the agent is reachable |
78
+ | `nd charts [QUERY]` | List or search charts by id, title, type, units, dimensions |
79
+ | `nd chart CHART_ID` | Show chart details (dimensions, metadata, history) |
80
+ | `nd data CHART_ID` | Fetch historical data points with time range and grouping |
81
+ | `nd alarms` | List health alarms (active or all) |
82
+ | `nd alarm-log` | Alarm history with time filtering |
83
+ | `nd allmetrics` | Snapshot of every metric (JSON, shell, or Prometheus format) |
84
+ | `nd function NAME` | Call Netdata functions (docker, systemd, network, etc.) |
85
+ | `nd functions` | List available functions |
86
+ | `nd collectors` | List active data collectors |
87
+
88
+ ## Configuration
89
+
90
+ Set the `NETDATA_URL` environment variable to point to a remote agent:
91
+
92
+ ```bash
93
+ export NETDATA_URL=http://my-server:19999
94
+ nd info
95
+ ```
96
+
97
+ Or pass `--url` on every call:
98
+
99
+ ```bash
100
+ nd --url http://my-server:19999 charts
101
+ ```
102
+
103
+ ## Output Formats
104
+
105
+ Every command supports `--json` (`-j`) for raw JSON output, useful for piping to `jq`:
106
+
107
+ ```bash
108
+ nd --json charts | jq '.[] | select(.units == "percentage")'
109
+ nd --json alarms | jq '.[] | select(.status == "WARNING")'
110
+ nd --json data system.cpu | jq '.data[-1]'
111
+ ```
112
+
113
+ ## Time Filtering
114
+
115
+ The `--after` flag accepts negative seconds (relative to now):
116
+
117
+ | Value | Meaning |
118
+ |---|---|
119
+ | `-60` | Last minute |
120
+ | `-300` | Last 5 minutes |
121
+ | `-3600` | Last hour |
122
+ | `-86400` | Last 24 hours |
123
+ | `-604800` | Last 7 days |
124
+
125
+ Data granularity depends on the chart's `update_every` setting and the Netdata database retention.
126
+
127
+ ## Examples
128
+
129
+ ### Monitor CPU in real-time
130
+
131
+ ```bash
132
+ watch -n 2 'nd data system.cpu --after -10 --points 10'
133
+ ```
134
+
135
+ ### Find all disk charts
136
+
137
+ ```bash
138
+ nd charts disk
139
+ ```
140
+
141
+ ### Export all metrics as Prometheus
142
+
143
+ ```bash
144
+ nd allmetrics --format prometheus
145
+ ```
146
+
147
+ ### Check only critical alarms
148
+
149
+ ```bash
150
+ nd alarms --active-only
151
+ ```
152
+
153
+ ### List Docker containers via Netdata
154
+
155
+ ```bash
156
+ nd function docker:container-ls
157
+ ```
158
+
159
+ ### Show network interfaces
160
+
161
+ ```bash
162
+ nd function network-interfaces
163
+ ```
164
+
165
+ ## Requirements
166
+
167
+ - Python 3.10+
168
+ - A running Netdata agent (v1.x or v2.x)
169
+
170
+ ## Dependencies
171
+
172
+ - [click](https://click.palletsprojects.com/) — CLI framework
173
+ - [requests](https://requests.readthedocs.io/) — HTTP client
174
+ - [rich](https://rich.readthedocs.io/) — Terminal formatting
175
+
176
+ ## Development
177
+
178
+ ```bash
179
+ git clone https://github.com/sosiman/netdata-cli
180
+ cd netdata-cli
181
+ pip install -e ".[dev]"
182
+ pytest
183
+ ruff check .
184
+ ```
185
+
186
+ ## License
187
+
188
+ [MIT](LICENSE)
@@ -0,0 +1,3 @@
1
+ """netdata-cli — A powerful CLI for the Netdata Agent REST API."""
2
+
3
+ __version__ = "0.1.0"