diskrx 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.
- diskrx-0.1.0/LICENSE +21 -0
- diskrx-0.1.0/MANIFEST.in +3 -0
- diskrx-0.1.0/PKG-INFO +234 -0
- diskrx-0.1.0/README.md +201 -0
- diskrx-0.1.0/diskrx.egg-info/PKG-INFO +234 -0
- diskrx-0.1.0/diskrx.egg-info/SOURCES.txt +46 -0
- diskrx-0.1.0/diskrx.egg-info/dependency_links.txt +1 -0
- diskrx-0.1.0/diskrx.egg-info/entry_points.txt +2 -0
- diskrx-0.1.0/diskrx.egg-info/requires.txt +9 -0
- diskrx-0.1.0/diskrx.egg-info/top_level.txt +1 -0
- diskrx-0.1.0/dxcli/__init__.py +6 -0
- diskrx-0.1.0/dxcli/analyzers/__init__.py +15 -0
- diskrx-0.1.0/dxcli/analyzers/anomaly.py +58 -0
- diskrx-0.1.0/dxcli/analyzers/correlation.py +32 -0
- diskrx-0.1.0/dxcli/analyzers/growth.py +53 -0
- diskrx-0.1.0/dxcli/analyzers/predictor.py +44 -0
- diskrx-0.1.0/dxcli/analyzers/prescriptions.py +61 -0
- diskrx-0.1.0/dxcli/analyzers/root_cause.py +41 -0
- diskrx-0.1.0/dxcli/cli.py +249 -0
- diskrx-0.1.0/dxcli/collectors/__init__.py +0 -0
- diskrx-0.1.0/dxcli/collectors/dir_tree.py +56 -0
- diskrx-0.1.0/dxcli/collectors/log_finder.py +45 -0
- diskrx-0.1.0/dxcli/collectors/process_mapper.py +62 -0
- diskrx-0.1.0/dxcli/collectors/stale_files.py +41 -0
- diskrx-0.1.0/dxcli/config.py +15 -0
- diskrx-0.1.0/dxcli/outputs/__init__.py +0 -0
- diskrx-0.1.0/dxcli/outputs/cli_report.py +242 -0
- diskrx-0.1.0/dxcli/outputs/metrics.py +42 -0
- diskrx-0.1.0/dxcli/outputs/tui.py +286 -0
- diskrx-0.1.0/dxcli/outputs/tui.tcss +78 -0
- diskrx-0.1.0/dxcli/platform/__init__.py +13 -0
- diskrx-0.1.0/dxcli/platform/base.py +9 -0
- diskrx-0.1.0/dxcli/platform/linux.py +27 -0
- diskrx-0.1.0/dxcli/platform/windows.py +25 -0
- diskrx-0.1.0/dxcli/store/__init__.py +0 -0
- diskrx-0.1.0/dxcli/store/database.py +112 -0
- diskrx-0.1.0/dxcli/store/models.py +60 -0
- diskrx-0.1.0/pyproject.toml +51 -0
- diskrx-0.1.0/setup.cfg +4 -0
- diskrx-0.1.0/tests/test_anomaly.py +34 -0
- diskrx-0.1.0/tests/test_cli_integration.py +37 -0
- diskrx-0.1.0/tests/test_correlation.py +26 -0
- diskrx-0.1.0/tests/test_database.py +23 -0
- diskrx-0.1.0/tests/test_edge_cases.py +90 -0
- diskrx-0.1.0/tests/test_format_bytes.py +14 -0
- diskrx-0.1.0/tests/test_growth.py +40 -0
- diskrx-0.1.0/tests/test_metrics.py +23 -0
- diskrx-0.1.0/tests/test_models.py +10 -0
diskrx-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Developer
|
|
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.
|
diskrx-0.1.0/MANIFEST.in
ADDED
diskrx-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: diskrx
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Intelligent disk diagnostics and storage observability for SREs
|
|
5
|
+
Author-email: Seshadri Naidu Vangapandu <seshuvangapandu@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Seshadri724/dxcli
|
|
8
|
+
Project-URL: Repository, https://github.com/Seshadri724/dxcli
|
|
9
|
+
Project-URL: Issues, https://github.com/Seshadri724/dxcli/issues
|
|
10
|
+
Keywords: disk,diagnostics,sre,observability,storage,cli
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: System Administrators
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: System :: Monitoring
|
|
20
|
+
Classifier: Topic :: System :: Systems Administration
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: click>=8.0
|
|
25
|
+
Requires-Dist: rich>=13.0
|
|
26
|
+
Requires-Dist: textual>=0.50
|
|
27
|
+
Requires-Dist: psutil>=5.9.0
|
|
28
|
+
Requires-Dist: numpy>=1.24.0
|
|
29
|
+
Provides-Extra: test
|
|
30
|
+
Requires-Dist: pytest>=7.0.0; extra == "test"
|
|
31
|
+
Requires-Dist: pytest-mock>=3.10.0; extra == "test"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# π©Ί dxcli β The Disk Doctor
|
|
35
|
+
|
|
36
|
+
> **Stop firefighting. Start predicting.**
|
|
37
|
+
> Replace your 45-minute disk investigation with a 30-second diagnosis.
|
|
38
|
+
|
|
39
|
+
[](https://pypi.org/project/dxcli/)
|
|
40
|
+
[](https://pypi.org/project/dxcli/)
|
|
41
|
+
[](LICENSE)
|
|
42
|
+
[](https://pypi.org/project/dxcli/)
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## The Problem
|
|
47
|
+
|
|
48
|
+
It's 2 AM. PagerDuty fires. Your production server is at 98% disk.
|
|
49
|
+
|
|
50
|
+
You SSH in and start the ritual:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
df -h # okay, it's /var
|
|
54
|
+
du -sh /var/* # narrowing down...
|
|
55
|
+
du -sh /var/log/* | sort -h # getting warmer...
|
|
56
|
+
find /var/log -size +100M # which file?
|
|
57
|
+
lsof | grep deleted # which process?!
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**45 minutes later**, you've found the culprit β a runaway log file from a service nobody knew was deployed. You delete it, go back to sleep, and it happens again next week.
|
|
61
|
+
|
|
62
|
+
**There is a better way.**
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## The Solution
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
dxcli diagnose /var
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
π©Ί Disk Doctor β Diagnosis Report
|
|
74
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
75
|
+
|
|
76
|
+
π¨ LOG BOMB DETECTED
|
|
77
|
+
/var/log/payments/transaction.log β 14.2 GB
|
|
78
|
+
β³ Written by: payments-service (PID 18423)
|
|
79
|
+
β³ Last rotation: Never
|
|
80
|
+
β³ Prescription: Add logrotate config immediately
|
|
81
|
+
|
|
82
|
+
β οΈ STALE DATA
|
|
83
|
+
/var/cache/thumbnails β 8.7 GB
|
|
84
|
+
β³ Last accessed: 94 days ago
|
|
85
|
+
β³ Prescription: Safe to archive or delete
|
|
86
|
+
|
|
87
|
+
π GROWTH FORECAST
|
|
88
|
+
At current rate, /var fills in 6 hours 12 minutes
|
|
89
|
+
Growth is ACCELERATING (+340% vs last week)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**30 seconds. Exact culprit. Exact prescription.**
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Features
|
|
97
|
+
|
|
98
|
+
### π `dxcli diagnose` β Intelligent Diagnosis
|
|
99
|
+
Not just file sizes. It tells you **why** your disk is filling:
|
|
100
|
+
- **Log Bomb detection** β unrotated logs growing out of control
|
|
101
|
+
- **Stale file identification** β large files untouched for months
|
|
102
|
+
- **Process attribution** β exactly which PID is writing to a path
|
|
103
|
+
|
|
104
|
+
### π `dxcli predict` β Time-to-Full Forecasting
|
|
105
|
+
Linear regression on historical snapshots stored locally. Tells you:
|
|
106
|
+
- When your disk will be full (hours, days, weeks)
|
|
107
|
+
- Whether growth is stable or **accelerating**
|
|
108
|
+
- Which directories are the fastest-growing threats
|
|
109
|
+
|
|
110
|
+
### π₯οΈ `dxcli dash` β Real-time TUI Dashboard
|
|
111
|
+
A full terminal UI with live sparklines, anomaly alerts, and interactive process maps. No browser required.
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
ββ Disk Overview ββββββββββββββββββββββββββββββββββ
|
|
115
|
+
β /var [ββββββββββββββββββββββββ] 84% β FAST β
|
|
116
|
+
β /home [ββββββββββββββββββββββββ] 34% β STABLEβ
|
|
117
|
+
β /tmp [ββββββββββββββββββββββββ] 12% β SLOW β
|
|
118
|
+
β β
|
|
119
|
+
β π¨ ANOMALY: Log Bomb in /var/log/payments β
|
|
120
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### π `dxcli serve` β The Sentinel (Prometheus-compatible)
|
|
124
|
+
Run as a background daemon. Exports `/metrics` for Grafana integration. Plug dxcli's intelligence directly into your existing observability stack.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Installation
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
pip install dxcli
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
That's it. No config files. No daemons required to get started.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Quickstart
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Diagnose a path right now
|
|
142
|
+
dxcli diagnose /var
|
|
143
|
+
|
|
144
|
+
# Predict when your root partition fills up
|
|
145
|
+
dxcli predict /
|
|
146
|
+
|
|
147
|
+
# Open the live TUI dashboard
|
|
148
|
+
dxcli dash
|
|
149
|
+
|
|
150
|
+
# Start the Prometheus metrics server
|
|
151
|
+
dxcli serve --port 8000
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## How It Works
|
|
157
|
+
|
|
158
|
+
dxcli stores lightweight disk snapshots in a local SQLite database (`~/.dx/history.db`). Over time, it builds a picture of your disk's growth patterns and uses linear regression to forecast the future.
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
162
|
+
β dxcli Architecture β
|
|
163
|
+
ββββββββββββββββ¬βββββββββββββββ¬βββββββββββββ¬ββββββββββββββ€
|
|
164
|
+
β collectors/ β analyzers/ β store/ β outputs/ β
|
|
165
|
+
β β β β β
|
|
166
|
+
β Raw OS data β The "Brain" β SQLite DB β Rich / TUI β
|
|
167
|
+
β psutil β Growth rate β Snapshots β Prometheus β
|
|
168
|
+
β File scans β Anomaly β History β HTTP API β
|
|
169
|
+
β PID mapping β detection β β β
|
|
170
|
+
ββββββββββββββββ΄βββββββββββββββ΄βββββββββββββ΄ββββββββββββββ
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Who This Is For
|
|
176
|
+
|
|
177
|
+
- **SREs** who are tired of getting paged for disk full alerts they could have predicted
|
|
178
|
+
- **DevOps engineers** who want disk intelligence in their Grafana dashboards
|
|
179
|
+
- **Platform engineers** who need to attribute storage costs to specific services
|
|
180
|
+
- **Anyone** who has typed `du -sh * | sort -h` more than once this month
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Integrations
|
|
185
|
+
|
|
186
|
+
**Grafana / Prometheus**
|
|
187
|
+
|
|
188
|
+
Add to your `prometheus.yml`:
|
|
189
|
+
```yaml
|
|
190
|
+
scrape_configs:
|
|
191
|
+
- job_name: 'dxcli'
|
|
192
|
+
static_configs:
|
|
193
|
+
- targets: ['localhost:8000']
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Then import the dxcli dashboard from Grafana marketplace. *(Coming soon)*
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Roadmap
|
|
201
|
+
|
|
202
|
+
- [ ] Grafana dashboard JSON export
|
|
203
|
+
- [ ] Slack / PagerDuty alert webhooks
|
|
204
|
+
- [ ] Multi-host support via SSH
|
|
205
|
+
- [ ] Docker volume awareness
|
|
206
|
+
- [ ] Cloud storage integration (S3 cost attribution)
|
|
207
|
+
|
|
208
|
+
Have a feature request? [Open an issue](https://github.com/your-username/dxcli/issues).
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Contributing
|
|
213
|
+
|
|
214
|
+
Contributions are welcome. Please read the contributing guide before submitting a PR.
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
git clone https://github.com/your-username/dxcli
|
|
218
|
+
cd dxcli
|
|
219
|
+
python -m venv venv && source venv/bin/activate
|
|
220
|
+
pip install -e ".[test]"
|
|
221
|
+
pytest tests/ -v
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## License
|
|
227
|
+
|
|
228
|
+
MIT β see [LICENSE](LICENSE) for details.
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
<p align="center">
|
|
233
|
+
Built for SREs, by someone who got paged one too many times at 2 AM.
|
|
234
|
+
</p>
|
diskrx-0.1.0/README.md
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# π©Ί dxcli β The Disk Doctor
|
|
2
|
+
|
|
3
|
+
> **Stop firefighting. Start predicting.**
|
|
4
|
+
> Replace your 45-minute disk investigation with a 30-second diagnosis.
|
|
5
|
+
|
|
6
|
+
[](https://pypi.org/project/dxcli/)
|
|
7
|
+
[](https://pypi.org/project/dxcli/)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
[](https://pypi.org/project/dxcli/)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## The Problem
|
|
14
|
+
|
|
15
|
+
It's 2 AM. PagerDuty fires. Your production server is at 98% disk.
|
|
16
|
+
|
|
17
|
+
You SSH in and start the ritual:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
df -h # okay, it's /var
|
|
21
|
+
du -sh /var/* # narrowing down...
|
|
22
|
+
du -sh /var/log/* | sort -h # getting warmer...
|
|
23
|
+
find /var/log -size +100M # which file?
|
|
24
|
+
lsof | grep deleted # which process?!
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**45 minutes later**, you've found the culprit β a runaway log file from a service nobody knew was deployed. You delete it, go back to sleep, and it happens again next week.
|
|
28
|
+
|
|
29
|
+
**There is a better way.**
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## The Solution
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
dxcli diagnose /var
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
π©Ί Disk Doctor β Diagnosis Report
|
|
41
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
42
|
+
|
|
43
|
+
π¨ LOG BOMB DETECTED
|
|
44
|
+
/var/log/payments/transaction.log β 14.2 GB
|
|
45
|
+
β³ Written by: payments-service (PID 18423)
|
|
46
|
+
β³ Last rotation: Never
|
|
47
|
+
β³ Prescription: Add logrotate config immediately
|
|
48
|
+
|
|
49
|
+
β οΈ STALE DATA
|
|
50
|
+
/var/cache/thumbnails β 8.7 GB
|
|
51
|
+
β³ Last accessed: 94 days ago
|
|
52
|
+
β³ Prescription: Safe to archive or delete
|
|
53
|
+
|
|
54
|
+
π GROWTH FORECAST
|
|
55
|
+
At current rate, /var fills in 6 hours 12 minutes
|
|
56
|
+
Growth is ACCELERATING (+340% vs last week)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**30 seconds. Exact culprit. Exact prescription.**
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Features
|
|
64
|
+
|
|
65
|
+
### π `dxcli diagnose` β Intelligent Diagnosis
|
|
66
|
+
Not just file sizes. It tells you **why** your disk is filling:
|
|
67
|
+
- **Log Bomb detection** β unrotated logs growing out of control
|
|
68
|
+
- **Stale file identification** β large files untouched for months
|
|
69
|
+
- **Process attribution** β exactly which PID is writing to a path
|
|
70
|
+
|
|
71
|
+
### π `dxcli predict` β Time-to-Full Forecasting
|
|
72
|
+
Linear regression on historical snapshots stored locally. Tells you:
|
|
73
|
+
- When your disk will be full (hours, days, weeks)
|
|
74
|
+
- Whether growth is stable or **accelerating**
|
|
75
|
+
- Which directories are the fastest-growing threats
|
|
76
|
+
|
|
77
|
+
### π₯οΈ `dxcli dash` β Real-time TUI Dashboard
|
|
78
|
+
A full terminal UI with live sparklines, anomaly alerts, and interactive process maps. No browser required.
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
ββ Disk Overview ββββββββββββββββββββββββββββββββββ
|
|
82
|
+
β /var [ββββββββββββββββββββββββ] 84% β FAST β
|
|
83
|
+
β /home [ββββββββββββββββββββββββ] 34% β STABLEβ
|
|
84
|
+
β /tmp [ββββββββββββββββββββββββ] 12% β SLOW β
|
|
85
|
+
β β
|
|
86
|
+
β π¨ ANOMALY: Log Bomb in /var/log/payments β
|
|
87
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### π `dxcli serve` β The Sentinel (Prometheus-compatible)
|
|
91
|
+
Run as a background daemon. Exports `/metrics` for Grafana integration. Plug dxcli's intelligence directly into your existing observability stack.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Installation
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
pip install dxcli
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
That's it. No config files. No daemons required to get started.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Quickstart
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Diagnose a path right now
|
|
109
|
+
dxcli diagnose /var
|
|
110
|
+
|
|
111
|
+
# Predict when your root partition fills up
|
|
112
|
+
dxcli predict /
|
|
113
|
+
|
|
114
|
+
# Open the live TUI dashboard
|
|
115
|
+
dxcli dash
|
|
116
|
+
|
|
117
|
+
# Start the Prometheus metrics server
|
|
118
|
+
dxcli serve --port 8000
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## How It Works
|
|
124
|
+
|
|
125
|
+
dxcli stores lightweight disk snapshots in a local SQLite database (`~/.dx/history.db`). Over time, it builds a picture of your disk's growth patterns and uses linear regression to forecast the future.
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
129
|
+
β dxcli Architecture β
|
|
130
|
+
ββββββββββββββββ¬βββββββββββββββ¬βββββββββββββ¬ββββββββββββββ€
|
|
131
|
+
β collectors/ β analyzers/ β store/ β outputs/ β
|
|
132
|
+
β β β β β
|
|
133
|
+
β Raw OS data β The "Brain" β SQLite DB β Rich / TUI β
|
|
134
|
+
β psutil β Growth rate β Snapshots β Prometheus β
|
|
135
|
+
β File scans β Anomaly β History β HTTP API β
|
|
136
|
+
β PID mapping β detection β β β
|
|
137
|
+
ββββββββββββββββ΄βββββββββββββββ΄βββββββββββββ΄ββββββββββββββ
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Who This Is For
|
|
143
|
+
|
|
144
|
+
- **SREs** who are tired of getting paged for disk full alerts they could have predicted
|
|
145
|
+
- **DevOps engineers** who want disk intelligence in their Grafana dashboards
|
|
146
|
+
- **Platform engineers** who need to attribute storage costs to specific services
|
|
147
|
+
- **Anyone** who has typed `du -sh * | sort -h` more than once this month
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Integrations
|
|
152
|
+
|
|
153
|
+
**Grafana / Prometheus**
|
|
154
|
+
|
|
155
|
+
Add to your `prometheus.yml`:
|
|
156
|
+
```yaml
|
|
157
|
+
scrape_configs:
|
|
158
|
+
- job_name: 'dxcli'
|
|
159
|
+
static_configs:
|
|
160
|
+
- targets: ['localhost:8000']
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Then import the dxcli dashboard from Grafana marketplace. *(Coming soon)*
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Roadmap
|
|
168
|
+
|
|
169
|
+
- [ ] Grafana dashboard JSON export
|
|
170
|
+
- [ ] Slack / PagerDuty alert webhooks
|
|
171
|
+
- [ ] Multi-host support via SSH
|
|
172
|
+
- [ ] Docker volume awareness
|
|
173
|
+
- [ ] Cloud storage integration (S3 cost attribution)
|
|
174
|
+
|
|
175
|
+
Have a feature request? [Open an issue](https://github.com/your-username/dxcli/issues).
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Contributing
|
|
180
|
+
|
|
181
|
+
Contributions are welcome. Please read the contributing guide before submitting a PR.
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
git clone https://github.com/your-username/dxcli
|
|
185
|
+
cd dxcli
|
|
186
|
+
python -m venv venv && source venv/bin/activate
|
|
187
|
+
pip install -e ".[test]"
|
|
188
|
+
pytest tests/ -v
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## License
|
|
194
|
+
|
|
195
|
+
MIT β see [LICENSE](LICENSE) for details.
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
<p align="center">
|
|
200
|
+
Built for SREs, by someone who got paged one too many times at 2 AM.
|
|
201
|
+
</p>
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: diskrx
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Intelligent disk diagnostics and storage observability for SREs
|
|
5
|
+
Author-email: Seshadri Naidu Vangapandu <seshuvangapandu@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Seshadri724/dxcli
|
|
8
|
+
Project-URL: Repository, https://github.com/Seshadri724/dxcli
|
|
9
|
+
Project-URL: Issues, https://github.com/Seshadri724/dxcli/issues
|
|
10
|
+
Keywords: disk,diagnostics,sre,observability,storage,cli
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: System Administrators
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: System :: Monitoring
|
|
20
|
+
Classifier: Topic :: System :: Systems Administration
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: click>=8.0
|
|
25
|
+
Requires-Dist: rich>=13.0
|
|
26
|
+
Requires-Dist: textual>=0.50
|
|
27
|
+
Requires-Dist: psutil>=5.9.0
|
|
28
|
+
Requires-Dist: numpy>=1.24.0
|
|
29
|
+
Provides-Extra: test
|
|
30
|
+
Requires-Dist: pytest>=7.0.0; extra == "test"
|
|
31
|
+
Requires-Dist: pytest-mock>=3.10.0; extra == "test"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# π©Ί dxcli β The Disk Doctor
|
|
35
|
+
|
|
36
|
+
> **Stop firefighting. Start predicting.**
|
|
37
|
+
> Replace your 45-minute disk investigation with a 30-second diagnosis.
|
|
38
|
+
|
|
39
|
+
[](https://pypi.org/project/dxcli/)
|
|
40
|
+
[](https://pypi.org/project/dxcli/)
|
|
41
|
+
[](LICENSE)
|
|
42
|
+
[](https://pypi.org/project/dxcli/)
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## The Problem
|
|
47
|
+
|
|
48
|
+
It's 2 AM. PagerDuty fires. Your production server is at 98% disk.
|
|
49
|
+
|
|
50
|
+
You SSH in and start the ritual:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
df -h # okay, it's /var
|
|
54
|
+
du -sh /var/* # narrowing down...
|
|
55
|
+
du -sh /var/log/* | sort -h # getting warmer...
|
|
56
|
+
find /var/log -size +100M # which file?
|
|
57
|
+
lsof | grep deleted # which process?!
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**45 minutes later**, you've found the culprit β a runaway log file from a service nobody knew was deployed. You delete it, go back to sleep, and it happens again next week.
|
|
61
|
+
|
|
62
|
+
**There is a better way.**
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## The Solution
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
dxcli diagnose /var
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
π©Ί Disk Doctor β Diagnosis Report
|
|
74
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
75
|
+
|
|
76
|
+
π¨ LOG BOMB DETECTED
|
|
77
|
+
/var/log/payments/transaction.log β 14.2 GB
|
|
78
|
+
β³ Written by: payments-service (PID 18423)
|
|
79
|
+
β³ Last rotation: Never
|
|
80
|
+
β³ Prescription: Add logrotate config immediately
|
|
81
|
+
|
|
82
|
+
β οΈ STALE DATA
|
|
83
|
+
/var/cache/thumbnails β 8.7 GB
|
|
84
|
+
β³ Last accessed: 94 days ago
|
|
85
|
+
β³ Prescription: Safe to archive or delete
|
|
86
|
+
|
|
87
|
+
π GROWTH FORECAST
|
|
88
|
+
At current rate, /var fills in 6 hours 12 minutes
|
|
89
|
+
Growth is ACCELERATING (+340% vs last week)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**30 seconds. Exact culprit. Exact prescription.**
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Features
|
|
97
|
+
|
|
98
|
+
### π `dxcli diagnose` β Intelligent Diagnosis
|
|
99
|
+
Not just file sizes. It tells you **why** your disk is filling:
|
|
100
|
+
- **Log Bomb detection** β unrotated logs growing out of control
|
|
101
|
+
- **Stale file identification** β large files untouched for months
|
|
102
|
+
- **Process attribution** β exactly which PID is writing to a path
|
|
103
|
+
|
|
104
|
+
### π `dxcli predict` β Time-to-Full Forecasting
|
|
105
|
+
Linear regression on historical snapshots stored locally. Tells you:
|
|
106
|
+
- When your disk will be full (hours, days, weeks)
|
|
107
|
+
- Whether growth is stable or **accelerating**
|
|
108
|
+
- Which directories are the fastest-growing threats
|
|
109
|
+
|
|
110
|
+
### π₯οΈ `dxcli dash` β Real-time TUI Dashboard
|
|
111
|
+
A full terminal UI with live sparklines, anomaly alerts, and interactive process maps. No browser required.
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
ββ Disk Overview ββββββββββββββββββββββββββββββββββ
|
|
115
|
+
β /var [ββββββββββββββββββββββββ] 84% β FAST β
|
|
116
|
+
β /home [ββββββββββββββββββββββββ] 34% β STABLEβ
|
|
117
|
+
β /tmp [ββββββββββββββββββββββββ] 12% β SLOW β
|
|
118
|
+
β β
|
|
119
|
+
β π¨ ANOMALY: Log Bomb in /var/log/payments β
|
|
120
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### π `dxcli serve` β The Sentinel (Prometheus-compatible)
|
|
124
|
+
Run as a background daemon. Exports `/metrics` for Grafana integration. Plug dxcli's intelligence directly into your existing observability stack.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Installation
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
pip install dxcli
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
That's it. No config files. No daemons required to get started.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Quickstart
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Diagnose a path right now
|
|
142
|
+
dxcli diagnose /var
|
|
143
|
+
|
|
144
|
+
# Predict when your root partition fills up
|
|
145
|
+
dxcli predict /
|
|
146
|
+
|
|
147
|
+
# Open the live TUI dashboard
|
|
148
|
+
dxcli dash
|
|
149
|
+
|
|
150
|
+
# Start the Prometheus metrics server
|
|
151
|
+
dxcli serve --port 8000
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## How It Works
|
|
157
|
+
|
|
158
|
+
dxcli stores lightweight disk snapshots in a local SQLite database (`~/.dx/history.db`). Over time, it builds a picture of your disk's growth patterns and uses linear regression to forecast the future.
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
162
|
+
β dxcli Architecture β
|
|
163
|
+
ββββββββββββββββ¬βββββββββββββββ¬βββββββββββββ¬ββββββββββββββ€
|
|
164
|
+
β collectors/ β analyzers/ β store/ β outputs/ β
|
|
165
|
+
β β β β β
|
|
166
|
+
β Raw OS data β The "Brain" β SQLite DB β Rich / TUI β
|
|
167
|
+
β psutil β Growth rate β Snapshots β Prometheus β
|
|
168
|
+
β File scans β Anomaly β History β HTTP API β
|
|
169
|
+
β PID mapping β detection β β β
|
|
170
|
+
ββββββββββββββββ΄βββββββββββββββ΄βββββββββββββ΄ββββββββββββββ
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Who This Is For
|
|
176
|
+
|
|
177
|
+
- **SREs** who are tired of getting paged for disk full alerts they could have predicted
|
|
178
|
+
- **DevOps engineers** who want disk intelligence in their Grafana dashboards
|
|
179
|
+
- **Platform engineers** who need to attribute storage costs to specific services
|
|
180
|
+
- **Anyone** who has typed `du -sh * | sort -h` more than once this month
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Integrations
|
|
185
|
+
|
|
186
|
+
**Grafana / Prometheus**
|
|
187
|
+
|
|
188
|
+
Add to your `prometheus.yml`:
|
|
189
|
+
```yaml
|
|
190
|
+
scrape_configs:
|
|
191
|
+
- job_name: 'dxcli'
|
|
192
|
+
static_configs:
|
|
193
|
+
- targets: ['localhost:8000']
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Then import the dxcli dashboard from Grafana marketplace. *(Coming soon)*
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Roadmap
|
|
201
|
+
|
|
202
|
+
- [ ] Grafana dashboard JSON export
|
|
203
|
+
- [ ] Slack / PagerDuty alert webhooks
|
|
204
|
+
- [ ] Multi-host support via SSH
|
|
205
|
+
- [ ] Docker volume awareness
|
|
206
|
+
- [ ] Cloud storage integration (S3 cost attribution)
|
|
207
|
+
|
|
208
|
+
Have a feature request? [Open an issue](https://github.com/your-username/dxcli/issues).
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Contributing
|
|
213
|
+
|
|
214
|
+
Contributions are welcome. Please read the contributing guide before submitting a PR.
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
git clone https://github.com/your-username/dxcli
|
|
218
|
+
cd dxcli
|
|
219
|
+
python -m venv venv && source venv/bin/activate
|
|
220
|
+
pip install -e ".[test]"
|
|
221
|
+
pytest tests/ -v
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## License
|
|
227
|
+
|
|
228
|
+
MIT β see [LICENSE](LICENSE) for details.
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
<p align="center">
|
|
233
|
+
Built for SREs, by someone who got paged one too many times at 2 AM.
|
|
234
|
+
</p>
|