sysdock 1.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.
- sysdock-1.1.0/LICENSE +21 -0
- sysdock-1.1.0/MANIFEST.in +5 -0
- sysdock-1.1.0/PKG-INFO +198 -0
- sysdock-1.1.0/README.md +162 -0
- sysdock-1.1.0/SETUP_GUIDE.md +297 -0
- sysdock-1.1.0/infravision_agent/__init__.py +2 -0
- sysdock-1.1.0/infravision_agent/__main__.py +7 -0
- sysdock-1.1.0/infravision_agent/cli.py +375 -0
- sysdock-1.1.0/infravision_agent/collectors/__init__.py +1 -0
- sysdock-1.1.0/infravision_agent/collectors/disk.py +236 -0
- sysdock-1.1.0/infravision_agent/collectors/docker_collector.py +322 -0
- sysdock-1.1.0/infravision_agent/collectors/network.py +239 -0
- sysdock-1.1.0/infravision_agent/collectors/processes.py +252 -0
- sysdock-1.1.0/infravision_agent/collectors/security.py +283 -0
- sysdock-1.1.0/infravision_agent/collectors/system.py +297 -0
- sysdock-1.1.0/infravision_agent/display/__init__.py +1 -0
- sysdock-1.1.0/infravision_agent/display/dashboard.py +457 -0
- sysdock-1.1.0/infravision_agent/server.py +326 -0
- sysdock-1.1.0/install.sh +225 -0
- sysdock-1.1.0/pyproject.toml +47 -0
- sysdock-1.1.0/setup.cfg +4 -0
- sysdock-1.1.0/setup.py +36 -0
- sysdock-1.1.0/sysdock.egg-info/PKG-INFO +198 -0
- sysdock-1.1.0/sysdock.egg-info/SOURCES.txt +26 -0
- sysdock-1.1.0/sysdock.egg-info/dependency_links.txt +1 -0
- sysdock-1.1.0/sysdock.egg-info/entry_points.txt +2 -0
- sysdock-1.1.0/sysdock.egg-info/requires.txt +13 -0
- sysdock-1.1.0/sysdock.egg-info/top_level.txt +1 -0
sysdock-1.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 InfraVision
|
|
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.
|
sysdock-1.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sysdock
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: SysDock — Linux / EC2 monitoring agent with live terminal dashboard and Docker metrics
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/your-org/sysdock
|
|
7
|
+
Project-URL: Issues, https://github.com/your-org/sysdock/issues
|
|
8
|
+
Keywords: monitoring,metrics,ec2,linux,devops,docker,sysadmin,sysdock
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
18
|
+
Classifier: Environment :: Console
|
|
19
|
+
Classifier: Topic :: System :: Monitoring
|
|
20
|
+
Classifier: Topic :: System :: Systems Administration
|
|
21
|
+
Requires-Python: >=3.6
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: psutil>=5.8.0
|
|
25
|
+
Requires-Dist: rich>=12.0.0
|
|
26
|
+
Requires-Dist: click>=7.0
|
|
27
|
+
Provides-Extra: docker
|
|
28
|
+
Requires-Dist: docker>=5.0.0; extra == "docker"
|
|
29
|
+
Provides-Extra: server
|
|
30
|
+
Requires-Dist: flask>=2.0; extra == "server"
|
|
31
|
+
Provides-Extra: all
|
|
32
|
+
Requires-Dist: docker>=5.0.0; extra == "all"
|
|
33
|
+
Requires-Dist: flask>=2.0; extra == "all"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
Dynamic: requires-python
|
|
36
|
+
|
|
37
|
+
# SysDock
|
|
38
|
+
|
|
39
|
+
**Linux / EC2 monitoring agent** with a live terminal dashboard, accurate Docker metrics, and a pip-installable CLI.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install sysdock
|
|
43
|
+
sysdock # opens the live dashboard — like htop, but more
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
- 🖥 **Live terminal dashboard** — CPU per-core, RAM, disk, network, processes, Docker, security
|
|
51
|
+
- 🐳 **Accurate Docker metrics** — CPU %, memory, network I/O per container (matches `docker stats`)
|
|
52
|
+
- 📊 **htop-accurate readings** — CPU sampled at 1s interval; RAM uses htop's exact formula
|
|
53
|
+
- 🌐 **HTTP metrics API** — JSON snapshot + live SSE stream on one port
|
|
54
|
+
- 🔒 **Security panel** — Falco events, SSH failures, fail2ban status
|
|
55
|
+
- ⚡ **Zero config** — works on any Linux distro, Python 3.6+
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Install
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# From PyPI
|
|
63
|
+
pip install sysdock
|
|
64
|
+
|
|
65
|
+
# With Docker SDK (richer container stats)
|
|
66
|
+
pip install "sysdock[docker]"
|
|
67
|
+
|
|
68
|
+
# With everything
|
|
69
|
+
pip install "sysdock[all]"
|
|
70
|
+
|
|
71
|
+
# From source
|
|
72
|
+
git clone https://github.com/Kavyvachhani/SysDock.git
|
|
73
|
+
cd SysDock
|
|
74
|
+
pip install -e .
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Quick Start
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
sysdock # open live dashboard (default — no subcommand needed)
|
|
83
|
+
sysdock dash # same as above
|
|
84
|
+
sysdock start # start metrics HTTP server on :5010
|
|
85
|
+
sysdock status # one-shot snapshot (rich table)
|
|
86
|
+
sysdock status --json # raw JSON
|
|
87
|
+
sysdock status --section docker # Docker only
|
|
88
|
+
sysdock check # verify all dependencies
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### On EC2 — one-step install
|
|
92
|
+
```bash
|
|
93
|
+
sudo bash install.sh # auto-installs Python, pip, sysdock + systemd service
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## HTTP API
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
curl http://localhost:5010/health
|
|
102
|
+
curl http://localhost:5010/
|
|
103
|
+
curl -N http://localhost:5010/stream # live SSE stream
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
| Endpoint | Description |
|
|
107
|
+
|----------|-------------|
|
|
108
|
+
| `GET /` | Full JSON snapshot — all metrics |
|
|
109
|
+
| `GET /stream` | Server-Sent Events — pushes every 5s |
|
|
110
|
+
| `GET /health` | `{"status": "ok"}` |
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Metric Accuracy
|
|
115
|
+
|
|
116
|
+
| Metric | Method |
|
|
117
|
+
|--------|--------|
|
|
118
|
+
| CPU % | 1-second sampling (matches htop) |
|
|
119
|
+
| RAM used | `total − free − buffers − cached` (htop formula) |
|
|
120
|
+
| Docker CPU | `(cpu_delta / sys_delta) × nCPUs × 100` (matches `docker stats`) |
|
|
121
|
+
| Docker memory | Subtracts `inactive_file` (cgroups v2) / `cache` (cgroups v1) |
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## CLI Reference
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
sysdock → live dashboard (default)
|
|
129
|
+
sysdock dash → live dashboard (with --refresh option)
|
|
130
|
+
sysdock start → HTTP metrics server [--port 5010] [--host 0.0.0.0]
|
|
131
|
+
sysdock status → snapshot [--section system|disk|processes|network|docker|security|all] [--json]
|
|
132
|
+
sysdock check → dependency check
|
|
133
|
+
sysdock install → systemd service (requires root)
|
|
134
|
+
sysdock uninstall → remove service (requires root)
|
|
135
|
+
sysdock --version → 1.1.0
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Project Structure
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
SysDock/
|
|
144
|
+
├── pyproject.toml pip package config (entry point: sysdock)
|
|
145
|
+
├── setup.py legacy pip fallback
|
|
146
|
+
├── MANIFEST.in
|
|
147
|
+
├── install.sh one-step Linux installer
|
|
148
|
+
├── test_sysdock.py self-test suite
|
|
149
|
+
├── SETUP_GUIDE.md full setup + PyPI publishing guide
|
|
150
|
+
├── EC2_DEPLOY_GUIDE.md EC2 transfer + test + deploy guide
|
|
151
|
+
└── infravision_agent/
|
|
152
|
+
├── cli.py sysdock CLI (auto-launches dashboard)
|
|
153
|
+
├── server.py HTTP server on port 5010
|
|
154
|
+
├── collectors/
|
|
155
|
+
│ ├── system.py CPU / RAM / load / uptime
|
|
156
|
+
│ ├── disk.py partitions + I/O
|
|
157
|
+
│ ├── processes.py top processes
|
|
158
|
+
│ ├── network.py interfaces + connections
|
|
159
|
+
│ ├── docker_collector.py container stats (SDK + CLI fallback)
|
|
160
|
+
│ └── security.py Falco / SSH / fail2ban
|
|
161
|
+
└── display/
|
|
162
|
+
└── dashboard.py Rich live TUI dashboard
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Compatibility
|
|
168
|
+
|
|
169
|
+
| Distro | Status |
|
|
170
|
+
|--------|--------|
|
|
171
|
+
| Ubuntu 20.04 / 22.04 / 24.04 | ✅ |
|
|
172
|
+
| Debian 10 / 11 / 12 | ✅ |
|
|
173
|
+
| Amazon Linux 2 / 2023 | ✅ |
|
|
174
|
+
| CentOS 7 / Stream 8 / 9 | ✅ |
|
|
175
|
+
| RHEL 7 / 8 / 9 | ✅ |
|
|
176
|
+
| Alpine Linux | ✅ |
|
|
177
|
+
| Arch Linux | ✅ |
|
|
178
|
+
|
|
179
|
+
**Python 3.6 – 3.12.** Requires Linux `/proc` filesystem.
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Security Note
|
|
184
|
+
|
|
185
|
+
When exposing the HTTP API, restrict port 5010 to your monitoring server only:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
aws ec2 authorize-security-group-ingress \
|
|
189
|
+
--group-id sg-xxxxxxxxxx \
|
|
190
|
+
--protocol tcp --port 5010 \
|
|
191
|
+
--cidr <monitoring-server-ip>/32
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## License
|
|
197
|
+
|
|
198
|
+
MIT © 2026 [Kavyvachhani](https://github.com/Kavyvachhani)
|
sysdock-1.1.0/README.md
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# SysDock
|
|
2
|
+
|
|
3
|
+
**Linux / EC2 monitoring agent** with a live terminal dashboard, accurate Docker metrics, and a pip-installable CLI.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pip install sysdock
|
|
7
|
+
sysdock # opens the live dashboard — like htop, but more
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- 🖥 **Live terminal dashboard** — CPU per-core, RAM, disk, network, processes, Docker, security
|
|
15
|
+
- 🐳 **Accurate Docker metrics** — CPU %, memory, network I/O per container (matches `docker stats`)
|
|
16
|
+
- 📊 **htop-accurate readings** — CPU sampled at 1s interval; RAM uses htop's exact formula
|
|
17
|
+
- 🌐 **HTTP metrics API** — JSON snapshot + live SSE stream on one port
|
|
18
|
+
- 🔒 **Security panel** — Falco events, SSH failures, fail2ban status
|
|
19
|
+
- ⚡ **Zero config** — works on any Linux distro, Python 3.6+
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# From PyPI
|
|
27
|
+
pip install sysdock
|
|
28
|
+
|
|
29
|
+
# With Docker SDK (richer container stats)
|
|
30
|
+
pip install "sysdock[docker]"
|
|
31
|
+
|
|
32
|
+
# With everything
|
|
33
|
+
pip install "sysdock[all]"
|
|
34
|
+
|
|
35
|
+
# From source
|
|
36
|
+
git clone https://github.com/Kavyvachhani/SysDock.git
|
|
37
|
+
cd SysDock
|
|
38
|
+
pip install -e .
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Quick Start
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
sysdock # open live dashboard (default — no subcommand needed)
|
|
47
|
+
sysdock dash # same as above
|
|
48
|
+
sysdock start # start metrics HTTP server on :5010
|
|
49
|
+
sysdock status # one-shot snapshot (rich table)
|
|
50
|
+
sysdock status --json # raw JSON
|
|
51
|
+
sysdock status --section docker # Docker only
|
|
52
|
+
sysdock check # verify all dependencies
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### On EC2 — one-step install
|
|
56
|
+
```bash
|
|
57
|
+
sudo bash install.sh # auto-installs Python, pip, sysdock + systemd service
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## HTTP API
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
curl http://localhost:5010/health
|
|
66
|
+
curl http://localhost:5010/
|
|
67
|
+
curl -N http://localhost:5010/stream # live SSE stream
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
| Endpoint | Description |
|
|
71
|
+
|----------|-------------|
|
|
72
|
+
| `GET /` | Full JSON snapshot — all metrics |
|
|
73
|
+
| `GET /stream` | Server-Sent Events — pushes every 5s |
|
|
74
|
+
| `GET /health` | `{"status": "ok"}` |
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Metric Accuracy
|
|
79
|
+
|
|
80
|
+
| Metric | Method |
|
|
81
|
+
|--------|--------|
|
|
82
|
+
| CPU % | 1-second sampling (matches htop) |
|
|
83
|
+
| RAM used | `total − free − buffers − cached` (htop formula) |
|
|
84
|
+
| Docker CPU | `(cpu_delta / sys_delta) × nCPUs × 100` (matches `docker stats`) |
|
|
85
|
+
| Docker memory | Subtracts `inactive_file` (cgroups v2) / `cache` (cgroups v1) |
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## CLI Reference
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
sysdock → live dashboard (default)
|
|
93
|
+
sysdock dash → live dashboard (with --refresh option)
|
|
94
|
+
sysdock start → HTTP metrics server [--port 5010] [--host 0.0.0.0]
|
|
95
|
+
sysdock status → snapshot [--section system|disk|processes|network|docker|security|all] [--json]
|
|
96
|
+
sysdock check → dependency check
|
|
97
|
+
sysdock install → systemd service (requires root)
|
|
98
|
+
sysdock uninstall → remove service (requires root)
|
|
99
|
+
sysdock --version → 1.1.0
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Project Structure
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
SysDock/
|
|
108
|
+
├── pyproject.toml pip package config (entry point: sysdock)
|
|
109
|
+
├── setup.py legacy pip fallback
|
|
110
|
+
├── MANIFEST.in
|
|
111
|
+
├── install.sh one-step Linux installer
|
|
112
|
+
├── test_sysdock.py self-test suite
|
|
113
|
+
├── SETUP_GUIDE.md full setup + PyPI publishing guide
|
|
114
|
+
├── EC2_DEPLOY_GUIDE.md EC2 transfer + test + deploy guide
|
|
115
|
+
└── infravision_agent/
|
|
116
|
+
├── cli.py sysdock CLI (auto-launches dashboard)
|
|
117
|
+
├── server.py HTTP server on port 5010
|
|
118
|
+
├── collectors/
|
|
119
|
+
│ ├── system.py CPU / RAM / load / uptime
|
|
120
|
+
│ ├── disk.py partitions + I/O
|
|
121
|
+
│ ├── processes.py top processes
|
|
122
|
+
│ ├── network.py interfaces + connections
|
|
123
|
+
│ ├── docker_collector.py container stats (SDK + CLI fallback)
|
|
124
|
+
│ └── security.py Falco / SSH / fail2ban
|
|
125
|
+
└── display/
|
|
126
|
+
└── dashboard.py Rich live TUI dashboard
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Compatibility
|
|
132
|
+
|
|
133
|
+
| Distro | Status |
|
|
134
|
+
|--------|--------|
|
|
135
|
+
| Ubuntu 20.04 / 22.04 / 24.04 | ✅ |
|
|
136
|
+
| Debian 10 / 11 / 12 | ✅ |
|
|
137
|
+
| Amazon Linux 2 / 2023 | ✅ |
|
|
138
|
+
| CentOS 7 / Stream 8 / 9 | ✅ |
|
|
139
|
+
| RHEL 7 / 8 / 9 | ✅ |
|
|
140
|
+
| Alpine Linux | ✅ |
|
|
141
|
+
| Arch Linux | ✅ |
|
|
142
|
+
|
|
143
|
+
**Python 3.6 – 3.12.** Requires Linux `/proc` filesystem.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Security Note
|
|
148
|
+
|
|
149
|
+
When exposing the HTTP API, restrict port 5010 to your monitoring server only:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
aws ec2 authorize-security-group-ingress \
|
|
153
|
+
--group-id sg-xxxxxxxxxx \
|
|
154
|
+
--protocol tcp --port 5010 \
|
|
155
|
+
--cidr <monitoring-server-ip>/32
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## License
|
|
161
|
+
|
|
162
|
+
MIT © 2026 [Kavyvachhani](https://github.com/Kavyvachhani)
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
# SysDock — Setup Guide
|
|
2
|
+
|
|
3
|
+
**SysDock** is a lightweight Linux monitoring agent with a live terminal dashboard, Docker metrics, and a pip-installable CLI command.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
1. [Prerequisites](#1-prerequisites)
|
|
9
|
+
2. [Install Locally from Source](#2-install-locally-from-source)
|
|
10
|
+
3. [Using SysDock](#3-using-sysdock)
|
|
11
|
+
4. [Install Docker Support](#4-install-docker-support)
|
|
12
|
+
5. [Build a Distributable Package](#5-build-a-distributable-package)
|
|
13
|
+
6. [Publish to PyPI](#6-publish-to-pypi)
|
|
14
|
+
7. [Install as a Systemd Service](#7-install-as-a-systemd-service)
|
|
15
|
+
8. [One-Step Linux Installer Script](#8-one-step-linux-installer-script)
|
|
16
|
+
9. [Uninstall](#9-uninstall)
|
|
17
|
+
10. [CLI Reference](#10-cli-reference)
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 1. Prerequisites
|
|
22
|
+
|
|
23
|
+
| Requirement | Version |
|
|
24
|
+
|-------------|---------|
|
|
25
|
+
| Python | 3.6+ |
|
|
26
|
+
| pip | 21+ |
|
|
27
|
+
| Linux | Any distribution with `/proc` filesystem |
|
|
28
|
+
| Docker | Optional — enables live container stats |
|
|
29
|
+
|
|
30
|
+
Check your Python version:
|
|
31
|
+
```bash
|
|
32
|
+
python3 --version
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 2. Install Locally from Source
|
|
38
|
+
|
|
39
|
+
### Step 1 — Clone or copy the project
|
|
40
|
+
```bash
|
|
41
|
+
# If you have git:
|
|
42
|
+
git clone https://github.com/your-org/sysdock.git
|
|
43
|
+
cd sysdock
|
|
44
|
+
|
|
45
|
+
# Or unzip / copy the project folder and cd into it:
|
|
46
|
+
cd infravision-agent
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Step 2 — (Optional) Create a virtual environment
|
|
50
|
+
```bash
|
|
51
|
+
python3 -m venv .venv
|
|
52
|
+
source .venv/bin/activate
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Step 3 — Install in editable (development) mode
|
|
56
|
+
```bash
|
|
57
|
+
pip install -e .
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
This registers the `sysdock` command in your PATH. You can now run:
|
|
61
|
+
```bash
|
|
62
|
+
sysdock
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Step 4 — Install with all optional dependencies
|
|
66
|
+
```bash
|
|
67
|
+
# With Docker SDK support (recommended):
|
|
68
|
+
pip install -e ".[docker]"
|
|
69
|
+
|
|
70
|
+
# With everything (Docker + Flask server):
|
|
71
|
+
pip install -e ".[all]"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 3. Using SysDock
|
|
77
|
+
|
|
78
|
+
### Open the live dashboard (default)
|
|
79
|
+
```bash
|
|
80
|
+
sysdock
|
|
81
|
+
```
|
|
82
|
+
Just type `sysdock` and press Enter — the live dashboard opens immediately, like htop.
|
|
83
|
+
|
|
84
|
+
### Open the dashboard explicitly
|
|
85
|
+
```bash
|
|
86
|
+
sysdock dash
|
|
87
|
+
sysdock dash --refresh 2 # refresh every 2 seconds (default: 3)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### One-shot status snapshot
|
|
91
|
+
```bash
|
|
92
|
+
sysdock status # pretty table output
|
|
93
|
+
sysdock status --json # raw JSON
|
|
94
|
+
sysdock status --section cpu # only CPU section
|
|
95
|
+
sysdock status --section docker # only Docker
|
|
96
|
+
```
|
|
97
|
+
Available sections: `system`, `disk`, `processes`, `network`, `docker`, `security`, `all`
|
|
98
|
+
|
|
99
|
+
### Start the metrics HTTP server
|
|
100
|
+
```bash
|
|
101
|
+
sysdock start # default: 0.0.0.0:5010
|
|
102
|
+
sysdock start --port 8080 # custom port
|
|
103
|
+
sysdock start --host 127.0.0.1 # localhost only
|
|
104
|
+
|
|
105
|
+
# Query the API:
|
|
106
|
+
curl http://localhost:5010/
|
|
107
|
+
curl http://localhost:5010/health
|
|
108
|
+
curl -N http://localhost:5010/stream # live JSON stream
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Check all dependencies
|
|
112
|
+
```bash
|
|
113
|
+
sysdock check
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## 4. Install Docker Support
|
|
119
|
+
|
|
120
|
+
Install the `docker-py` SDK for richer container metrics (CPU, memory, network I/O):
|
|
121
|
+
```bash
|
|
122
|
+
pip install "docker>=5.0.0"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Without the SDK, SysDock falls back to the `docker` CLI automatically — both give accurate stats.
|
|
126
|
+
|
|
127
|
+
To verify Docker is detected:
|
|
128
|
+
```bash
|
|
129
|
+
sysdock check # "Docker daemon" row should show "running"
|
|
130
|
+
sysdock status --section docker
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## 5. Build a Distributable Package
|
|
136
|
+
|
|
137
|
+
### Step 1 — Install the build tool
|
|
138
|
+
```bash
|
|
139
|
+
pip install build
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Step 2 — Build wheel + sdist
|
|
143
|
+
```bash
|
|
144
|
+
cd /path/to/infravision-agent # project root (contains pyproject.toml)
|
|
145
|
+
python -m build
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Output files will be in the `dist/` directory:
|
|
149
|
+
```
|
|
150
|
+
dist/
|
|
151
|
+
sysdock-1.1.0.tar.gz # source distribution
|
|
152
|
+
sysdock-1.1.0-py3-none-any.whl # wheel
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Step 3 — Install from the wheel
|
|
156
|
+
```bash
|
|
157
|
+
pip install dist/sysdock-1.1.0-py3-none-any.whl
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Step 4 — Verify
|
|
161
|
+
```bash
|
|
162
|
+
sysdock --version # should print: SysDock, version 1.1.0
|
|
163
|
+
sysdock check
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## 6. Publish to PyPI
|
|
169
|
+
|
|
170
|
+
### Step 1 — Create a PyPI account
|
|
171
|
+
Register at https://pypi.org/account/register/
|
|
172
|
+
|
|
173
|
+
### Step 2 — Install Twine
|
|
174
|
+
```bash
|
|
175
|
+
pip install twine
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Step 3 — Build the package
|
|
179
|
+
```bash
|
|
180
|
+
python -m build
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Step 4 — Upload to TestPyPI first (recommended)
|
|
184
|
+
```bash
|
|
185
|
+
twine upload --repository testpypi dist/*
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Test install from TestPyPI:
|
|
189
|
+
```bash
|
|
190
|
+
pip install --index-url https://test.pypi.org/simple/ sysdock
|
|
191
|
+
sysdock --version
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Step 5 — Upload to real PyPI
|
|
195
|
+
```bash
|
|
196
|
+
twine upload dist/*
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Step 6 — Anyone can now install with:
|
|
200
|
+
```bash
|
|
201
|
+
pip install sysdock
|
|
202
|
+
pip install "sysdock[docker]" # with Docker SDK
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## 7. Install as a Systemd Service
|
|
208
|
+
|
|
209
|
+
Run as a persistent background service that auto-starts on boot:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
sudo sysdock install # uses default port 5010
|
|
213
|
+
sudo sysdock install --port 8080 # custom port
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Service management commands:
|
|
217
|
+
```bash
|
|
218
|
+
sudo systemctl status sysdock
|
|
219
|
+
sudo systemctl restart sysdock
|
|
220
|
+
sudo systemctl stop sysdock
|
|
221
|
+
sudo journalctl -u sysdock -f # live logs
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## 8. One-Step Linux Installer Script
|
|
227
|
+
|
|
228
|
+
The `install.sh` script handles everything automatically (Python, pip, sysdock, systemd service, firewall):
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
sudo bash install.sh # default port 5010
|
|
232
|
+
sudo bash install.sh --port 8080 # custom port
|
|
233
|
+
sudo bash install.sh --falco # also install Falco security
|
|
234
|
+
sudo bash install.sh --no-service # skip systemd registration
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
After installation:
|
|
238
|
+
```bash
|
|
239
|
+
sysdock # open live dashboard
|
|
240
|
+
curl http://localhost:5010/ # access metrics API
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## 9. Uninstall
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
# Remove systemd service:
|
|
249
|
+
sudo sysdock uninstall
|
|
250
|
+
|
|
251
|
+
# Uninstall pip package:
|
|
252
|
+
pip uninstall sysdock
|
|
253
|
+
|
|
254
|
+
# Or using the install script:
|
|
255
|
+
sudo bash install.sh --uninstall
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## 10. CLI Reference
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
Usage: sysdock [OPTIONS] COMMAND [ARGS]...
|
|
264
|
+
|
|
265
|
+
SysDock — Linux / EC2 monitoring agent.
|
|
266
|
+
Type 'sysdock' (no command) to open the live dashboard.
|
|
267
|
+
|
|
268
|
+
Options:
|
|
269
|
+
--version Show version and exit.
|
|
270
|
+
--help Show this message and exit.
|
|
271
|
+
|
|
272
|
+
Commands:
|
|
273
|
+
dash Open the live terminal dashboard (Ctrl+C to exit)
|
|
274
|
+
start Start the metrics HTTP server
|
|
275
|
+
status Print a one-shot status snapshot
|
|
276
|
+
check Verify all dependencies and system capabilities
|
|
277
|
+
install Install SysDock as a systemd service (requires root)
|
|
278
|
+
uninstall Remove the SysDock systemd service (requires root)
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### Metrics HTTP API
|
|
282
|
+
|
|
283
|
+
| Endpoint | Description |
|
|
284
|
+
|-----------------|-------------------------------------------|
|
|
285
|
+
| `GET /` | Full JSON snapshot of all metrics |
|
|
286
|
+
| `GET /health` | Simple health check `{"status": "ok"}` |
|
|
287
|
+
| `GET /stream` | Newline-delimited live JSON stream |
|
|
288
|
+
| `GET /metrics` | Prometheus-compatible text format |
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## Notes on Metric Accuracy
|
|
293
|
+
|
|
294
|
+
- **CPU%** is measured with a 1-second sampling interval, matching htop's default method.
|
|
295
|
+
- **Memory used** = `total − free − buffers − cached (+ SReclaimable)` — this is the htop formula.
|
|
296
|
+
- **Docker CPU%** uses the same calculation as `docker stats`: `(cpu_delta / sys_delta) × nCPUs × 100`.
|
|
297
|
+
- **Docker memory** subtracts the page cache (`inactive_file` on cgroups v2, `cache` on cgroups v1), matching `docker stats` output exactly.
|