Compare commits
54 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| eab3f17428 | |||
| 7ad149bbe4 | |||
| b444c88ea0 | |||
| 317cf76bd1 | |||
| 0db1a165b9 | |||
| 3c2955376d | |||
| f09ccabc7f | |||
| 43dd5a901a | |||
| 01e1f33b66 | |||
| ed6399b914 | |||
| 14618c59c6 | |||
| 2740de9b54 | |||
| 37f2650200 | |||
| 833010e270 | |||
| 549d9d1c72 | |||
| 9b84b70581 | |||
| 92c3ee3f2a | |||
| 1be55f765d | |||
| 2f94a4b853 | |||
| ff2b43827a | |||
| fac0188c6f | |||
| 6bb350f016 | |||
| 374b126446 | |||
| 76c04633b5 | |||
| 1e0510be81 | |||
| 9a2df906ea | |||
| 6d6beb207d | |||
| 7a68da01f5 | |||
| 5be67fed64 | |||
| cac836601b | |||
| bd22ce265b | |||
| bbc8b7b1cb | |||
| 5dd8cadef3 | |||
| fefe30ec51 | |||
| fb40cce748 | |||
| eaa057b284 | |||
| f23a1b5cec | |||
| 3f98f68b51 | |||
| 3d38a7a984 | |||
| b0ee0242bd | |||
| 8f9e9eabca | |||
| 937f4ad427 | |||
| 8aefab83ae | |||
| 748a9f3a3b | |||
| 5c6b11c794 | |||
| 9f0aa5f806 | |||
| fc247bd0ad | |||
| 00fe8c28ab | |||
| fbbb4a4cfb | |||
| 53e1d8bbce | |||
| 1b9fecea98 | |||
| b7ffeaced5 | |||
| 3858309a5d | |||
| df104bf940 |
@@ -113,13 +113,13 @@ jobs:
|
|||||||
NIX_HASH="sha256-$(python3 -c "import base64, binascii; print(base64.b64encode(binascii.unhexlify('$NEW_HASH')).decode())")"
|
NIX_HASH="sha256-$(python3 -c "import base64, binascii; print(base64.b64encode(binascii.unhexlify('$NEW_HASH')).decode())")"
|
||||||
|
|
||||||
# Update the NixOS configuration
|
# Update the NixOS configuration
|
||||||
sed -i "s|version = \"v[^\"]*\"|version = \"$VERSION\"|" hosts/services/cm-dashboard.nix
|
sed -i "s|version = \"v[^\"]*\"|version = \"$VERSION\"|" services/cm-dashboard.nix
|
||||||
sed -i "s|sha256 = \"sha256-[^\"]*\"|sha256 = \"$NIX_HASH\"|" hosts/services/cm-dashboard.nix
|
sed -i "s|sha256 = \"sha256-[^\"]*\"|sha256 = \"$NIX_HASH\"|" services/cm-dashboard.nix
|
||||||
|
|
||||||
# Commit and push changes
|
# Commit and push changes
|
||||||
git config user.name "Gitea Actions"
|
git config user.name "Gitea Actions"
|
||||||
git config user.email "actions@gitea.cmtec.se"
|
git config user.email "actions@gitea.cmtec.se"
|
||||||
git add hosts/services/cm-dashboard.nix
|
git add services/cm-dashboard.nix
|
||||||
git commit -m "Auto-update cm-dashboard to $VERSION
|
git commit -m "Auto-update cm-dashboard to $VERSION
|
||||||
|
|
||||||
- Update version to $VERSION with automated release
|
- Update version to $VERSION with automated release
|
||||||
|
|||||||
166
CLAUDE.md
166
CLAUDE.md
@@ -156,6 +156,56 @@ Complete migration from string-based metrics to structured JSON data. Eliminates
|
|||||||
- ✅ Backward compatibility via bridge conversion to existing UI widgets
|
- ✅ Backward compatibility via bridge conversion to existing UI widgets
|
||||||
- ✅ All string parsing bugs eliminated
|
- ✅ All string parsing bugs eliminated
|
||||||
|
|
||||||
|
### Cached Collector Architecture (🚧 PLANNED)
|
||||||
|
|
||||||
|
**Problem:** Blocking collectors prevent timely ZMQ transmission, causing false "host offline" alerts.
|
||||||
|
|
||||||
|
**Previous (Sequential Blocking):**
|
||||||
|
```
|
||||||
|
Every 1 second:
|
||||||
|
└─ collect_all_data() [BLOCKS for 2-10+ seconds]
|
||||||
|
├─ CPU (fast: 10ms)
|
||||||
|
├─ Memory (fast: 20ms)
|
||||||
|
├─ Disk SMART (slow: 3s per drive × 4 drives = 12s)
|
||||||
|
├─ Service disk usage (slow: 2-8s per service)
|
||||||
|
└─ Docker (medium: 500ms)
|
||||||
|
└─ send_via_zmq() [Only after ALL collection completes]
|
||||||
|
|
||||||
|
Result: If any collector takes >10s → "host offline" false alert
|
||||||
|
```
|
||||||
|
|
||||||
|
**New (Cached Independent Collectors):**
|
||||||
|
```
|
||||||
|
Shared Cache: Arc<RwLock<AgentData>>
|
||||||
|
|
||||||
|
Background Collectors (independent async tasks):
|
||||||
|
├─ Fast collectors (CPU, RAM, Network)
|
||||||
|
│ └─ Update cache every 1 second
|
||||||
|
├─ Medium collectors (Services, Docker)
|
||||||
|
│ └─ Update cache every 5 seconds
|
||||||
|
└─ Slow collectors (Disk usage, SMART data)
|
||||||
|
└─ Update cache every 60 seconds
|
||||||
|
|
||||||
|
ZMQ Sender (separate async task):
|
||||||
|
Every 1 second:
|
||||||
|
└─ Read current cache
|
||||||
|
└─ Send via ZMQ [Always instant, never blocked]
|
||||||
|
```
|
||||||
|
|
||||||
|
**Benefits:**
|
||||||
|
- ✅ ZMQ sends every 1 second regardless of collector speed
|
||||||
|
- ✅ No false "host offline" alerts from slow collectors
|
||||||
|
- ✅ Different update rates for different metrics (CPU=1s, SMART=60s)
|
||||||
|
- ✅ System stays responsive even with slow operations
|
||||||
|
- ✅ Slow collectors can use longer timeouts without blocking
|
||||||
|
|
||||||
|
**Implementation:**
|
||||||
|
- Shared `AgentData` cache wrapped in `Arc<RwLock<>>`
|
||||||
|
- Each collector spawned as independent tokio task
|
||||||
|
- Collectors update their section of cache at their own rate
|
||||||
|
- ZMQ sender reads cache every 1s and transmits
|
||||||
|
- Stale data acceptable for slow-changing metrics (disk usage, SMART)
|
||||||
|
|
||||||
### Maintenance Mode
|
### Maintenance Mode
|
||||||
|
|
||||||
- Agent checks for `/tmp/cm-maintenance` file before sending notifications
|
- Agent checks for `/tmp/cm-maintenance` file before sending notifications
|
||||||
@@ -304,28 +354,28 @@ exclude_fs_types = ["tmpfs", "devtmpfs", "sysfs", "proc"]
|
|||||||
### Display Format
|
### Display Format
|
||||||
|
|
||||||
```
|
```
|
||||||
|
Network:
|
||||||
|
● eno1:
|
||||||
|
├─ ip: 192.168.30.105
|
||||||
|
└─ tailscale0: 100.125.108.16
|
||||||
|
● eno2:
|
||||||
|
└─ ip: 192.168.32.105
|
||||||
CPU:
|
CPU:
|
||||||
● Load: 0.23 0.21 0.13
|
● Load: 0.23 0.21 0.13
|
||||||
└─ Freq: 1048 MHz
|
└─ Freq: 1048 MHz
|
||||||
|
|
||||||
RAM:
|
RAM:
|
||||||
● Usage: 25% 5.8GB/23.3GB
|
● Usage: 25% 5.8GB/23.3GB
|
||||||
├─ ● /tmp: 2% 0.5GB/2GB
|
├─ ● /tmp: 2% 0.5GB/2GB
|
||||||
└─ ● /var/tmp: 0% 0GB/1.0GB
|
└─ ● /var/tmp: 0% 0GB/1.0GB
|
||||||
|
|
||||||
Storage:
|
Storage:
|
||||||
● mergerfs (2+1):
|
● 844B9A25 T: 25C W: 4%
|
||||||
├─ Total: ● 63% 2355.2GB/3686.4GB
|
|
||||||
├─ Data Disks:
|
|
||||||
│ ├─ ● sdb T: 24°C W: 5%
|
|
||||||
│ └─ ● sdd T: 27°C W: 5%
|
|
||||||
├─ Parity: ● sdc T: 24°C W: 5%
|
|
||||||
└─ Mount: /srv/media
|
|
||||||
|
|
||||||
● nvme0n1 T: 25C W: 4%
|
|
||||||
├─ ● /: 55% 250.5GB/456.4GB
|
├─ ● /: 55% 250.5GB/456.4GB
|
||||||
└─ ● /boot: 26% 0.3GB/1.0GB
|
└─ ● /boot: 26% 0.3GB/1.0GB
|
||||||
|
● mergerfs /srv/media:
|
||||||
|
├─ ● 63% 2355.2GB/3686.4GB
|
||||||
|
├─ ● Data_1: WDZQ8H8D T: 28°C
|
||||||
|
├─ ● Data_2: GGA04461 T: 28°C
|
||||||
|
└─ ● Parity: WDZS8RY0 T: 29°C
|
||||||
Backup:
|
Backup:
|
||||||
● WD-WCC7K1234567 T: 32°C W: 12%
|
● WD-WCC7K1234567 T: 32°C W: 12%
|
||||||
├─ Last: 2h ago (12.3GB)
|
├─ Last: 2h ago (12.3GB)
|
||||||
@@ -361,98 +411,6 @@ Keep responses concise and focused. Avoid extensive implementation summaries unl
|
|||||||
- ✅ "Restructure storage widget with improved layout"
|
- ✅ "Restructure storage widget with improved layout"
|
||||||
- ✅ "Update CPU thresholds to production values"
|
- ✅ "Update CPU thresholds to production values"
|
||||||
|
|
||||||
## Completed Architecture Migration (v0.1.131)
|
|
||||||
|
|
||||||
## ✅ COMPLETE MONITORING SYSTEM RESTORATION (v0.1.141)
|
|
||||||
|
|
||||||
**🎉 SUCCESS: All Issues Fixed - Complete Functional Monitoring System**
|
|
||||||
|
|
||||||
### ✅ Completed Implementation (v0.1.141)
|
|
||||||
|
|
||||||
**All Major Issues Resolved:**
|
|
||||||
```
|
|
||||||
✅ Data Collection: Agent collects structured data correctly
|
|
||||||
✅ Storage Display: Perfect format with correct mount points and temperature/wear
|
|
||||||
✅ Status Evaluation: All metrics properly evaluated against thresholds
|
|
||||||
✅ Notifications: Working email alerts on status changes
|
|
||||||
✅ Thresholds: All collectors using configured thresholds for status calculation
|
|
||||||
✅ Build Information: NixOS version displayed correctly
|
|
||||||
✅ Mount Point Consistency: Stable, sorted display order
|
|
||||||
```
|
|
||||||
|
|
||||||
### ✅ All Phases Completed Successfully
|
|
||||||
|
|
||||||
#### ✅ Phase 1: Storage Display - COMPLETED
|
|
||||||
- ✅ Use `lsblk` instead of `findmnt` (eliminated `/nix/store` bind mount issue)
|
|
||||||
- ✅ Add `sudo smartctl` for permissions (SMART data collection working)
|
|
||||||
- ✅ Fix NVMe SMART parsing (`Temperature:` and `Percentage Used:` fields)
|
|
||||||
- ✅ Consistent filesystem/tmpfs sorting (no more random order swapping)
|
|
||||||
- ✅ **VERIFIED**: Dashboard shows `● nvme0n1 T: 28°C W: 1%` correctly
|
|
||||||
|
|
||||||
#### ✅ Phase 2: Status Evaluation System - COMPLETED
|
|
||||||
- ✅ **CPU Status**: Load averages and temperature evaluated against `HysteresisThresholds`
|
|
||||||
- ✅ **Memory Status**: Usage percentage evaluated against thresholds
|
|
||||||
- ✅ **Storage Status**: Drive temperature, health, and filesystem usage evaluated
|
|
||||||
- ✅ **Service Status**: Service states properly tracked and evaluated
|
|
||||||
- ✅ **Status Fields**: All AgentData structures include status information
|
|
||||||
- ✅ **Threshold Integration**: All collectors use their configured thresholds
|
|
||||||
|
|
||||||
#### ✅ Phase 3: Notification System - COMPLETED
|
|
||||||
- ✅ **Status Change Detection**: Agent tracks status between collection cycles
|
|
||||||
- ✅ **Email Notifications**: Alerts sent on degradation (OK→Warning/Critical, Warning→Critical)
|
|
||||||
- ✅ **Notification Content**: Detailed alerts with metric values and timestamps
|
|
||||||
- ✅ **NotificationManager Integration**: Fully restored and operational
|
|
||||||
- ✅ **Maintenance Mode**: `/tmp/cm-maintenance` file support maintained
|
|
||||||
|
|
||||||
#### ✅ Phase 4: Integration & Testing - COMPLETED
|
|
||||||
- ✅ **AgentData Status Fields**: All structured data includes status evaluation
|
|
||||||
- ✅ **Status Processing**: Agent applies thresholds at collection time
|
|
||||||
- ✅ **End-to-End Flow**: Collection → Evaluation → Notification → Display
|
|
||||||
- ✅ **Dynamic Versioning**: Agent version from `CARGO_PKG_VERSION`
|
|
||||||
- ✅ **Build Information**: NixOS generation display restored
|
|
||||||
|
|
||||||
### ✅ Final Architecture - WORKING
|
|
||||||
|
|
||||||
**Complete Operational Flow:**
|
|
||||||
```
|
|
||||||
Collectors → AgentData (with Status) → NotificationManager → Email Alerts
|
|
||||||
↘ ↗
|
|
||||||
ZMQ → Dashboard → Perfect Display
|
|
||||||
```
|
|
||||||
|
|
||||||
**Operational Components:**
|
|
||||||
1. ✅ **Collectors**: Populate AgentData with metrics AND status evaluation
|
|
||||||
2. ✅ **Status Evaluation**: `HysteresisThresholds.evaluate()` applied per collector
|
|
||||||
3. ✅ **Notifications**: Email alerts on status change detection
|
|
||||||
4. ✅ **Display**: Correct mount points, temperature, wear, and build information
|
|
||||||
|
|
||||||
### ✅ Success Criteria - ALL MET
|
|
||||||
|
|
||||||
**Display Requirements:**
|
|
||||||
- ✅ Dashboard shows `● nvme0n1 T: 28°C W: 1%` format perfectly
|
|
||||||
- ✅ Mount points show `/` and `/boot` (not `root`/`boot`)
|
|
||||||
- ✅ Build information shows actual NixOS version (not "unknown")
|
|
||||||
- ✅ Consistent sorting eliminates random order changes
|
|
||||||
|
|
||||||
**Monitoring Requirements:**
|
|
||||||
- ✅ High CPU load triggers Warning/Critical status and email alert
|
|
||||||
- ✅ High memory usage triggers Warning/Critical status and email alert
|
|
||||||
- ✅ High disk temperature triggers Warning/Critical status and email alert
|
|
||||||
- ✅ Failed services trigger Warning/Critical status and email alert
|
|
||||||
- ✅ Maintenance mode suppresses notifications as expected
|
|
||||||
|
|
||||||
### 🚀 Production Ready
|
|
||||||
|
|
||||||
**CM Dashboard v0.1.141 is a complete, functional infrastructure monitoring system:**
|
|
||||||
|
|
||||||
- **Real-time Monitoring**: All system components with 1-second intervals
|
|
||||||
- **Intelligent Alerting**: Email notifications on threshold violations
|
|
||||||
- **Perfect Display**: Accurate mount points, temperatures, and system information
|
|
||||||
- **Status-Aware**: All metrics evaluated against configurable thresholds
|
|
||||||
- **Production Ready**: Full monitoring capabilities restored
|
|
||||||
|
|
||||||
**The monitoring system is fully operational and ready for production use.**
|
|
||||||
|
|
||||||
## Implementation Rules
|
## Implementation Rules
|
||||||
|
|
||||||
1. **Agent Status Authority**: Agent calculates status for each metric using thresholds
|
1. **Agent Status Authority**: Agent calculates status for each metric using thresholds
|
||||||
|
|||||||
1131
Cargo.lock
generated
1131
Cargo.lock
generated
@@ -1,6 +1,5 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
# This file is automatically generated by Cargo.
|
|
||||||
version = 4
|
version = 4
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -104,6 +103,137 @@ dependencies = [
|
|||||||
"object",
|
"object",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-broadcast"
|
||||||
|
version = "0.7.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532"
|
||||||
|
dependencies = [
|
||||||
|
"event-listener",
|
||||||
|
"event-listener-strategy",
|
||||||
|
"futures-core",
|
||||||
|
"pin-project-lite",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-channel"
|
||||||
|
version = "2.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2"
|
||||||
|
dependencies = [
|
||||||
|
"concurrent-queue",
|
||||||
|
"event-listener-strategy",
|
||||||
|
"futures-core",
|
||||||
|
"pin-project-lite",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-executor"
|
||||||
|
version = "1.13.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "497c00e0fd83a72a79a39fcbd8e3e2f055d6f6c7e025f3b3d91f4f8e76527fb8"
|
||||||
|
dependencies = [
|
||||||
|
"async-task",
|
||||||
|
"concurrent-queue",
|
||||||
|
"fastrand",
|
||||||
|
"futures-lite",
|
||||||
|
"pin-project-lite",
|
||||||
|
"slab",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-fs"
|
||||||
|
version = "2.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8034a681df4aed8b8edbd7fbe472401ecf009251c8b40556b304567052e294c5"
|
||||||
|
dependencies = [
|
||||||
|
"async-lock",
|
||||||
|
"blocking",
|
||||||
|
"futures-lite",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-io"
|
||||||
|
version = "2.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"cfg-if",
|
||||||
|
"concurrent-queue",
|
||||||
|
"futures-io",
|
||||||
|
"futures-lite",
|
||||||
|
"parking",
|
||||||
|
"polling",
|
||||||
|
"rustix",
|
||||||
|
"slab",
|
||||||
|
"windows-sys 0.61.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-lock"
|
||||||
|
version = "3.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5fd03604047cee9b6ce9de9f70c6cd540a0520c813cbd49bae61f33ab80ed1dc"
|
||||||
|
dependencies = [
|
||||||
|
"event-listener",
|
||||||
|
"event-listener-strategy",
|
||||||
|
"pin-project-lite",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-process"
|
||||||
|
version = "2.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75"
|
||||||
|
dependencies = [
|
||||||
|
"async-channel",
|
||||||
|
"async-io",
|
||||||
|
"async-lock",
|
||||||
|
"async-signal",
|
||||||
|
"async-task",
|
||||||
|
"blocking",
|
||||||
|
"cfg-if",
|
||||||
|
"event-listener",
|
||||||
|
"futures-lite",
|
||||||
|
"rustix",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-recursion"
|
||||||
|
version = "1.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-signal"
|
||||||
|
version = "0.2.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "43c070bbf59cd3570b6b2dd54cd772527c7c3620fce8be898406dd3ed6adc64c"
|
||||||
|
dependencies = [
|
||||||
|
"async-io",
|
||||||
|
"async-lock",
|
||||||
|
"atomic-waker",
|
||||||
|
"cfg-if",
|
||||||
|
"futures-core",
|
||||||
|
"futures-io",
|
||||||
|
"rustix",
|
||||||
|
"signal-hook-registry",
|
||||||
|
"slab",
|
||||||
|
"windows-sys 0.61.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "async-task"
|
||||||
|
version = "4.7.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "async-trait"
|
name = "async-trait"
|
||||||
version = "0.1.89"
|
version = "0.1.89"
|
||||||
@@ -115,6 +245,12 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "atomic-waker"
|
||||||
|
version = "1.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "1.5.0"
|
version = "1.5.0"
|
||||||
@@ -145,12 +281,84 @@ version = "2.10.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"
|
checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "block-buffer"
|
||||||
|
version = "0.10.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
|
||||||
|
dependencies = [
|
||||||
|
"generic-array",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "blocking"
|
||||||
|
version = "1.6.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e83f8d02be6967315521be875afa792a316e28d57b5a2d401897e2a7921b7f21"
|
||||||
|
dependencies = [
|
||||||
|
"async-channel",
|
||||||
|
"async-task",
|
||||||
|
"futures-io",
|
||||||
|
"futures-lite",
|
||||||
|
"piper",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bollard"
|
||||||
|
version = "0.17.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d41711ad46fda47cd701f6908e59d1bd6b9a2b7464c0d0aeab95c6d37096ff8a"
|
||||||
|
dependencies = [
|
||||||
|
"base64 0.22.1",
|
||||||
|
"bollard-stubs",
|
||||||
|
"bytes",
|
||||||
|
"futures-core",
|
||||||
|
"futures-util",
|
||||||
|
"hex",
|
||||||
|
"http 1.4.0",
|
||||||
|
"http-body-util",
|
||||||
|
"hyper 1.8.1",
|
||||||
|
"hyper-named-pipe",
|
||||||
|
"hyper-util",
|
||||||
|
"hyperlocal",
|
||||||
|
"log",
|
||||||
|
"pin-project-lite",
|
||||||
|
"serde",
|
||||||
|
"serde_derive",
|
||||||
|
"serde_json",
|
||||||
|
"serde_repr",
|
||||||
|
"serde_urlencoded",
|
||||||
|
"thiserror 1.0.69",
|
||||||
|
"tokio",
|
||||||
|
"tokio-util",
|
||||||
|
"tower-service",
|
||||||
|
"url",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bollard-stubs"
|
||||||
|
version = "1.45.0-rc.26.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6d7c5415e3a6bc6d3e99eff6268e488fd4ee25e7b28c10f08fa6760bd9de16e4"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
"serde_repr",
|
||||||
|
"serde_with",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bumpalo"
|
name = "bumpalo"
|
||||||
version = "3.19.0"
|
version = "3.19.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
|
checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "byteorder"
|
||||||
|
version = "1.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytes"
|
name = "bytes"
|
||||||
version = "1.11.0"
|
version = "1.11.0"
|
||||||
@@ -165,9 +373,9 @@ checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.2.46"
|
version = "1.2.47"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b97463e1064cb1b1c1384ad0a0b9c8abd0988e2a91f52606c80ef14aadb63e36"
|
checksum = "cd405d82c84ff7f35739f175f67d8b9fb7687a0e84ccdc78bd3568839827cf07"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"find-msvc-tools",
|
"find-msvc-tools",
|
||||||
"jobserver",
|
"jobserver",
|
||||||
@@ -191,6 +399,12 @@ version = "1.0.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg_aliases"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono"
|
name = "chrono"
|
||||||
version = "0.4.42"
|
version = "0.4.42"
|
||||||
@@ -239,9 +453,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.5.52"
|
version = "4.5.53"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "aa8120877db0e5c011242f96806ce3c94e0737ab8108532a76a3300a01db2ab8"
|
checksum = "c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap_builder",
|
"clap_builder",
|
||||||
"clap_derive",
|
"clap_derive",
|
||||||
@@ -249,9 +463,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_builder"
|
name = "clap_builder"
|
||||||
version = "4.5.52"
|
version = "4.5.53"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "02576b399397b659c26064fbc92a75fede9d18ffd5f80ca1cd74ddab167016e1"
|
checksum = "d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstream",
|
"anstream",
|
||||||
"anstyle",
|
"anstyle",
|
||||||
@@ -279,7 +493,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cm-dashboard"
|
name = "cm-dashboard"
|
||||||
version = "0.1.158"
|
version = "0.1.199"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"chrono",
|
"chrono",
|
||||||
@@ -290,7 +504,7 @@ dependencies = [
|
|||||||
"ratatui",
|
"ratatui",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"thiserror",
|
"thiserror 1.0.69",
|
||||||
"tokio",
|
"tokio",
|
||||||
"toml",
|
"toml",
|
||||||
"tracing",
|
"tracing",
|
||||||
@@ -301,35 +515,42 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cm-dashboard-agent"
|
name = "cm-dashboard-agent"
|
||||||
version = "0.1.158"
|
version = "0.1.199"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
"bollard",
|
||||||
"chrono",
|
"chrono",
|
||||||
"chrono-tz",
|
"chrono-tz",
|
||||||
"clap",
|
"clap",
|
||||||
"cm-dashboard-shared",
|
"cm-dashboard-shared",
|
||||||
|
"futures",
|
||||||
"gethostname",
|
"gethostname",
|
||||||
"lettre",
|
"lettre",
|
||||||
|
"libc",
|
||||||
|
"netlink-packet-route",
|
||||||
|
"nix 0.29.0",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
|
"rtnetlink",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"thiserror",
|
"thiserror 1.0.69",
|
||||||
"tokio",
|
"tokio",
|
||||||
"toml",
|
"toml",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
|
"zbus",
|
||||||
"zmq",
|
"zmq",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cm-dashboard-shared"
|
name = "cm-dashboard-shared"
|
||||||
version = "0.1.158"
|
version = "0.1.199"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"thiserror",
|
"thiserror 1.0.69",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -338,6 +559,15 @@ version = "1.0.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
|
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "concurrent-queue"
|
||||||
|
version = "2.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"
|
||||||
|
dependencies = [
|
||||||
|
"crossbeam-utils",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "core-foundation"
|
name = "core-foundation"
|
||||||
version = "0.9.4"
|
version = "0.9.4"
|
||||||
@@ -354,6 +584,15 @@ version = "0.8.7"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
|
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cpufeatures"
|
||||||
|
version = "0.2.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam"
|
name = "crossbeam"
|
||||||
version = "0.8.4"
|
version = "0.8.4"
|
||||||
@@ -435,6 +674,36 @@ dependencies = [
|
|||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crypto-common"
|
||||||
|
version = "0.1.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
|
||||||
|
dependencies = [
|
||||||
|
"generic-array",
|
||||||
|
"typenum",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "deranged"
|
||||||
|
version = "0.5.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587"
|
||||||
|
dependencies = [
|
||||||
|
"powerfmt",
|
||||||
|
"serde_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "digest"
|
||||||
|
version = "0.10.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
||||||
|
dependencies = [
|
||||||
|
"block-buffer",
|
||||||
|
"crypto-common",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dircpy"
|
name = "dircpy"
|
||||||
version = "0.3.19"
|
version = "0.3.19"
|
||||||
@@ -457,6 +726,12 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dyn-clone"
|
||||||
|
version = "1.0.20"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "either"
|
name = "either"
|
||||||
version = "1.15.0"
|
version = "1.15.0"
|
||||||
@@ -488,6 +763,33 @@ dependencies = [
|
|||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "endi"
|
||||||
|
version = "1.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "enumflags2"
|
||||||
|
version = "0.7.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef"
|
||||||
|
dependencies = [
|
||||||
|
"enumflags2_derive",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "enumflags2_derive"
|
||||||
|
version = "0.7.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "equivalent"
|
name = "equivalent"
|
||||||
version = "1.0.2"
|
version = "1.0.2"
|
||||||
@@ -504,6 +806,27 @@ dependencies = [
|
|||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "event-listener"
|
||||||
|
version = "5.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab"
|
||||||
|
dependencies = [
|
||||||
|
"concurrent-queue",
|
||||||
|
"parking",
|
||||||
|
"pin-project-lite",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "event-listener-strategy"
|
||||||
|
version = "0.5.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93"
|
||||||
|
dependencies = [
|
||||||
|
"event-listener",
|
||||||
|
"pin-project-lite",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fastrand"
|
name = "fastrand"
|
||||||
version = "2.3.0"
|
version = "2.3.0"
|
||||||
@@ -552,6 +875,21 @@ dependencies = [
|
|||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures"
|
||||||
|
version = "0.3.31"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876"
|
||||||
|
dependencies = [
|
||||||
|
"futures-channel",
|
||||||
|
"futures-core",
|
||||||
|
"futures-executor",
|
||||||
|
"futures-io",
|
||||||
|
"futures-sink",
|
||||||
|
"futures-task",
|
||||||
|
"futures-util",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-channel"
|
name = "futures-channel"
|
||||||
version = "0.3.31"
|
version = "0.3.31"
|
||||||
@@ -559,6 +897,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
|
checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-core",
|
"futures-core",
|
||||||
|
"futures-sink",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -567,12 +906,47 @@ version = "0.3.31"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
|
checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-executor"
|
||||||
|
version = "0.3.31"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f"
|
||||||
|
dependencies = [
|
||||||
|
"futures-core",
|
||||||
|
"futures-task",
|
||||||
|
"futures-util",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-io"
|
name = "futures-io"
|
||||||
version = "0.3.31"
|
version = "0.3.31"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
|
checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-lite"
|
||||||
|
version = "2.6.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad"
|
||||||
|
dependencies = [
|
||||||
|
"fastrand",
|
||||||
|
"futures-core",
|
||||||
|
"futures-io",
|
||||||
|
"parking",
|
||||||
|
"pin-project-lite",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-macro"
|
||||||
|
version = "0.3.31"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-sink"
|
name = "futures-sink"
|
||||||
version = "0.3.31"
|
version = "0.3.31"
|
||||||
@@ -591,8 +965,11 @@ version = "0.3.31"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
|
checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"futures-channel",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-io",
|
"futures-io",
|
||||||
|
"futures-macro",
|
||||||
|
"futures-sink",
|
||||||
"futures-task",
|
"futures-task",
|
||||||
"memchr",
|
"memchr",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
@@ -600,6 +977,16 @@ dependencies = [
|
|||||||
"slab",
|
"slab",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "generic-array"
|
||||||
|
version = "0.14.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
|
||||||
|
dependencies = [
|
||||||
|
"typenum",
|
||||||
|
"version_check",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gethostname"
|
name = "gethostname"
|
||||||
version = "0.4.3"
|
version = "0.4.3"
|
||||||
@@ -610,6 +997,17 @@ dependencies = [
|
|||||||
"windows-targets 0.48.5",
|
"windows-targets 0.48.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "getrandom"
|
||||||
|
version = "0.2.16"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"wasi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "getrandom"
|
name = "getrandom"
|
||||||
version = "0.3.4"
|
version = "0.3.4"
|
||||||
@@ -633,14 +1031,20 @@ dependencies = [
|
|||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-sink",
|
"futures-sink",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"http",
|
"http 0.2.12",
|
||||||
"indexmap",
|
"indexmap 2.12.1",
|
||||||
"slab",
|
"slab",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hashbrown"
|
||||||
|
version = "0.12.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.14.5"
|
version = "0.14.5"
|
||||||
@@ -664,9 +1068,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.16.0"
|
version = "0.16.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d"
|
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "heck"
|
name = "heck"
|
||||||
@@ -680,6 +1084,18 @@ version = "0.5.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hermit-abi"
|
||||||
|
version = "0.5.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hex"
|
||||||
|
version = "0.4.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "http"
|
name = "http"
|
||||||
version = "0.2.12"
|
version = "0.2.12"
|
||||||
@@ -691,6 +1107,16 @@ dependencies = [
|
|||||||
"itoa",
|
"itoa",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "http"
|
||||||
|
version = "1.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"itoa",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "http-body"
|
name = "http-body"
|
||||||
version = "0.4.6"
|
version = "0.4.6"
|
||||||
@@ -698,7 +1124,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2"
|
checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"http",
|
"http 0.2.12",
|
||||||
|
"pin-project-lite",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "http-body"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"http 1.4.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "http-body-util"
|
||||||
|
version = "0.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"futures-core",
|
||||||
|
"http 1.4.0",
|
||||||
|
"http-body 1.0.1",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -725,8 +1174,8 @@ dependencies = [
|
|||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"h2",
|
"h2",
|
||||||
"http",
|
"http 0.2.12",
|
||||||
"http-body",
|
"http-body 0.4.6",
|
||||||
"httparse",
|
"httparse",
|
||||||
"httpdate",
|
"httpdate",
|
||||||
"itoa",
|
"itoa",
|
||||||
@@ -738,6 +1187,43 @@ dependencies = [
|
|||||||
"want",
|
"want",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hyper"
|
||||||
|
version = "1.8.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11"
|
||||||
|
dependencies = [
|
||||||
|
"atomic-waker",
|
||||||
|
"bytes",
|
||||||
|
"futures-channel",
|
||||||
|
"futures-core",
|
||||||
|
"http 1.4.0",
|
||||||
|
"http-body 1.0.1",
|
||||||
|
"httparse",
|
||||||
|
"httpdate",
|
||||||
|
"itoa",
|
||||||
|
"pin-project-lite",
|
||||||
|
"pin-utils",
|
||||||
|
"smallvec",
|
||||||
|
"tokio",
|
||||||
|
"want",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hyper-named-pipe"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "73b7d8abf35697b81a825e386fc151e0d503e8cb5fcb93cc8669c376dfd6f278"
|
||||||
|
dependencies = [
|
||||||
|
"hex",
|
||||||
|
"hyper 1.8.1",
|
||||||
|
"hyper-util",
|
||||||
|
"pin-project-lite",
|
||||||
|
"tokio",
|
||||||
|
"tower-service",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hyper-tls"
|
name = "hyper-tls"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
@@ -745,12 +1231,48 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
|
checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"hyper",
|
"hyper 0.14.32",
|
||||||
"native-tls",
|
"native-tls",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-native-tls",
|
"tokio-native-tls",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hyper-util"
|
||||||
|
version = "0.1.18"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "52e9a2a24dc5c6821e71a7030e1e14b7b632acac55c40e9d2e082c621261bb56"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"futures-channel",
|
||||||
|
"futures-core",
|
||||||
|
"futures-util",
|
||||||
|
"http 1.4.0",
|
||||||
|
"http-body 1.0.1",
|
||||||
|
"hyper 1.8.1",
|
||||||
|
"libc",
|
||||||
|
"pin-project-lite",
|
||||||
|
"socket2 0.6.1",
|
||||||
|
"tokio",
|
||||||
|
"tower-service",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hyperlocal"
|
||||||
|
version = "0.9.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "986c5ce3b994526b3cd75578e62554abd09f0899d6206de48b3e96ab34ccc8c7"
|
||||||
|
dependencies = [
|
||||||
|
"hex",
|
||||||
|
"http-body-util",
|
||||||
|
"hyper 1.8.1",
|
||||||
|
"hyper-util",
|
||||||
|
"pin-project-lite",
|
||||||
|
"tokio",
|
||||||
|
"tower-service",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iana-time-zone"
|
name = "iana-time-zone"
|
||||||
version = "0.1.64"
|
version = "0.1.64"
|
||||||
@@ -879,12 +1401,25 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "2.12.0"
|
version = "1.9.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f"
|
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"hashbrown 0.12.3",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "indexmap"
|
||||||
|
version = "2.12.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"equivalent",
|
"equivalent",
|
||||||
"hashbrown 0.16.0",
|
"hashbrown 0.16.1",
|
||||||
|
"serde",
|
||||||
|
"serde_core",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -929,7 +1464,7 @@ version = "0.1.34"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33"
|
checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom",
|
"getrandom 0.3.4",
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1038,6 +1573,15 @@ version = "2.7.6"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
|
checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "memoffset"
|
||||||
|
version = "0.9.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mime"
|
name = "mime"
|
||||||
version = "0.3.17"
|
version = "0.3.17"
|
||||||
@@ -1084,6 +1628,94 @@ dependencies = [
|
|||||||
"tempfile",
|
"tempfile",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "netlink-packet-core"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "72724faf704479d67b388da142b186f916188505e7e0b26719019c525882eda4"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"byteorder",
|
||||||
|
"netlink-packet-utils",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "netlink-packet-route"
|
||||||
|
version = "0.19.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "74c171cd77b4ee8c7708da746ce392440cb7bcf618d122ec9ecc607b12938bf4"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"byteorder",
|
||||||
|
"libc",
|
||||||
|
"log",
|
||||||
|
"netlink-packet-core",
|
||||||
|
"netlink-packet-utils",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "netlink-packet-utils"
|
||||||
|
version = "0.5.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0ede8a08c71ad5a95cdd0e4e52facd37190977039a4704eb82a283f713747d34"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"byteorder",
|
||||||
|
"paste",
|
||||||
|
"thiserror 1.0.69",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "netlink-proto"
|
||||||
|
version = "0.11.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "72452e012c2f8d612410d89eea01e2d9b56205274abb35d53f60200b2ec41d60"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"futures",
|
||||||
|
"log",
|
||||||
|
"netlink-packet-core",
|
||||||
|
"netlink-sys",
|
||||||
|
"thiserror 2.0.17",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "netlink-sys"
|
||||||
|
version = "0.8.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "16c903aa70590cb93691bf97a767c8d1d6122d2cc9070433deb3bbf36ce8bd23"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"futures",
|
||||||
|
"libc",
|
||||||
|
"log",
|
||||||
|
"tokio",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nix"
|
||||||
|
version = "0.27.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.10.0",
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nix"
|
||||||
|
version = "0.29.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.10.0",
|
||||||
|
"cfg-if",
|
||||||
|
"cfg_aliases",
|
||||||
|
"libc",
|
||||||
|
"memoffset",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nom"
|
name = "nom"
|
||||||
version = "8.0.0"
|
version = "8.0.0"
|
||||||
@@ -1102,6 +1734,12 @@ dependencies = [
|
|||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-conv"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-traits"
|
name = "num-traits"
|
||||||
version = "0.2.19"
|
version = "0.2.19"
|
||||||
@@ -1176,6 +1814,22 @@ dependencies = [
|
|||||||
"vcpkg",
|
"vcpkg",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ordered-stream"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50"
|
||||||
|
dependencies = [
|
||||||
|
"futures-core",
|
||||||
|
"pin-project-lite",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "parking"
|
||||||
|
version = "2.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "parking_lot"
|
name = "parking_lot"
|
||||||
version = "0.12.5"
|
version = "0.12.5"
|
||||||
@@ -1270,12 +1924,37 @@ version = "0.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "piper"
|
||||||
|
version = "0.2.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066"
|
||||||
|
dependencies = [
|
||||||
|
"atomic-waker",
|
||||||
|
"fastrand",
|
||||||
|
"futures-io",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pkg-config"
|
name = "pkg-config"
|
||||||
version = "0.3.32"
|
version = "0.3.32"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
|
checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "polling"
|
||||||
|
version = "3.11.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"concurrent-queue",
|
||||||
|
"hermit-abi",
|
||||||
|
"pin-project-lite",
|
||||||
|
"rustix",
|
||||||
|
"windows-sys 0.61.2",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "potential_utf"
|
name = "potential_utf"
|
||||||
version = "0.1.4"
|
version = "0.1.4"
|
||||||
@@ -1285,6 +1964,30 @@ dependencies = [
|
|||||||
"zerovec",
|
"zerovec",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "powerfmt"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ppv-lite86"
|
||||||
|
version = "0.2.21"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
|
||||||
|
dependencies = [
|
||||||
|
"zerocopy",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro-crate"
|
||||||
|
version = "3.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983"
|
||||||
|
dependencies = [
|
||||||
|
"toml_edit 0.23.7",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.103"
|
version = "1.0.103"
|
||||||
@@ -1331,6 +2034,18 @@ version = "0.8.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"rand_chacha",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_chacha"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||||
|
dependencies = [
|
||||||
|
"ppv-lite86",
|
||||||
"rand_core",
|
"rand_core",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1339,6 +2054,9 @@ name = "rand_core"
|
|||||||
version = "0.6.4"
|
version = "0.6.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom 0.2.16",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ratatui"
|
name = "ratatui"
|
||||||
@@ -1387,6 +2105,26 @@ dependencies = [
|
|||||||
"bitflags 2.10.0",
|
"bitflags 2.10.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ref-cast"
|
||||||
|
version = "1.0.25"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d"
|
||||||
|
dependencies = [
|
||||||
|
"ref-cast-impl",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ref-cast-impl"
|
||||||
|
version = "1.0.25"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex"
|
name = "regex"
|
||||||
version = "1.12.2"
|
version = "1.12.2"
|
||||||
@@ -1428,9 +2166,9 @@ dependencies = [
|
|||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"h2",
|
"h2",
|
||||||
"http",
|
"http 0.2.12",
|
||||||
"http-body",
|
"http-body 0.4.6",
|
||||||
"hyper",
|
"hyper 0.14.32",
|
||||||
"hyper-tls",
|
"hyper-tls",
|
||||||
"ipnet",
|
"ipnet",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
@@ -1456,6 +2194,24 @@ dependencies = [
|
|||||||
"winreg",
|
"winreg",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rtnetlink"
|
||||||
|
version = "0.14.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b684475344d8df1859ddb2d395dd3dac4f8f3422a1aa0725993cb375fc5caba5"
|
||||||
|
dependencies = [
|
||||||
|
"futures",
|
||||||
|
"log",
|
||||||
|
"netlink-packet-core",
|
||||||
|
"netlink-packet-route",
|
||||||
|
"netlink-packet-utils",
|
||||||
|
"netlink-proto",
|
||||||
|
"netlink-sys",
|
||||||
|
"nix 0.27.1",
|
||||||
|
"thiserror 1.0.69",
|
||||||
|
"tokio",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustix"
|
name = "rustix"
|
||||||
version = "1.1.2"
|
version = "1.1.2"
|
||||||
@@ -1508,6 +2264,30 @@ dependencies = [
|
|||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "schemars"
|
||||||
|
version = "0.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f"
|
||||||
|
dependencies = [
|
||||||
|
"dyn-clone",
|
||||||
|
"ref-cast",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "schemars"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9558e172d4e8533736ba97870c4b2cd63f84b382a3d6eb063da41b91cce17289"
|
||||||
|
dependencies = [
|
||||||
|
"dyn-clone",
|
||||||
|
"ref-cast",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "scopeguard"
|
name = "scopeguard"
|
||||||
version = "1.2.0"
|
version = "1.2.0"
|
||||||
@@ -1580,6 +2360,17 @@ dependencies = [
|
|||||||
"serde_core",
|
"serde_core",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_repr"
|
||||||
|
version = "0.1.20"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_spanned"
|
name = "serde_spanned"
|
||||||
version = "0.6.9"
|
version = "0.6.9"
|
||||||
@@ -1601,6 +2392,35 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_with"
|
||||||
|
version = "3.16.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4fa237f2807440d238e0364a218270b98f767a00d3dada77b1c53ae88940e2e7"
|
||||||
|
dependencies = [
|
||||||
|
"base64 0.22.1",
|
||||||
|
"chrono",
|
||||||
|
"hex",
|
||||||
|
"indexmap 1.9.3",
|
||||||
|
"indexmap 2.12.1",
|
||||||
|
"schemars 0.9.0",
|
||||||
|
"schemars 1.1.0",
|
||||||
|
"serde_core",
|
||||||
|
"serde_json",
|
||||||
|
"time",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sha1"
|
||||||
|
version = "0.10.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"cpufeatures",
|
||||||
|
"digest",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sharded-slab"
|
name = "sharded-slab"
|
||||||
version = "0.1.7"
|
version = "0.1.7"
|
||||||
@@ -1639,9 +2459,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "signal-hook-registry"
|
name = "signal-hook-registry"
|
||||||
version = "1.4.6"
|
version = "1.4.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b"
|
checksum = "7664a098b8e616bdfcc2dc0e9ac44eb231eedf41db4e9fe95d8d32ec728dedad"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
@@ -1703,6 +2523,12 @@ dependencies = [
|
|||||||
"windows-sys 0.59.0",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "static_assertions"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strsim"
|
name = "strsim"
|
||||||
version = "0.11.1"
|
version = "0.11.1"
|
||||||
@@ -1733,9 +2559,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.110"
|
version = "2.0.111"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea"
|
checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -1806,7 +2632,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16"
|
checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fastrand",
|
"fastrand",
|
||||||
"getrandom",
|
"getrandom 0.3.4",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rustix",
|
"rustix",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
@@ -1818,7 +2644,16 @@ version = "1.0.69"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
|
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror-impl",
|
"thiserror-impl 1.0.69",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thiserror"
|
||||||
|
version = "2.0.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8"
|
||||||
|
dependencies = [
|
||||||
|
"thiserror-impl 2.0.17",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1832,6 +2667,17 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thiserror-impl"
|
||||||
|
version = "2.0.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thread_local"
|
name = "thread_local"
|
||||||
version = "1.1.9"
|
version = "1.1.9"
|
||||||
@@ -1841,6 +2687,37 @@ dependencies = [
|
|||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "time"
|
||||||
|
version = "0.3.44"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d"
|
||||||
|
dependencies = [
|
||||||
|
"deranged",
|
||||||
|
"itoa",
|
||||||
|
"num-conv",
|
||||||
|
"powerfmt",
|
||||||
|
"serde",
|
||||||
|
"time-core",
|
||||||
|
"time-macros",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "time-core"
|
||||||
|
version = "0.1.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "time-macros"
|
||||||
|
version = "0.2.24"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3"
|
||||||
|
dependencies = [
|
||||||
|
"num-conv",
|
||||||
|
"time-core",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tinystr"
|
name = "tinystr"
|
||||||
version = "0.8.2"
|
version = "0.8.2"
|
||||||
@@ -1910,8 +2787,8 @@ checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_spanned",
|
"serde_spanned",
|
||||||
"toml_datetime",
|
"toml_datetime 0.6.11",
|
||||||
"toml_edit",
|
"toml_edit 0.22.27",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1923,20 +2800,50 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml_datetime"
|
||||||
|
version = "0.7.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533"
|
||||||
|
dependencies = [
|
||||||
|
"serde_core",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_edit"
|
name = "toml_edit"
|
||||||
version = "0.22.27"
|
version = "0.22.27"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
|
checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap 2.12.1",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_spanned",
|
"serde_spanned",
|
||||||
"toml_datetime",
|
"toml_datetime 0.6.11",
|
||||||
"toml_write",
|
"toml_write",
|
||||||
"winnow",
|
"winnow",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml_edit"
|
||||||
|
version = "0.23.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6485ef6d0d9b5d0ec17244ff7eb05310113c3f316f2d14200d4de56b3cb98f8d"
|
||||||
|
dependencies = [
|
||||||
|
"indexmap 2.12.1",
|
||||||
|
"toml_datetime 0.7.3",
|
||||||
|
"toml_parser",
|
||||||
|
"winnow",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml_parser"
|
||||||
|
version = "1.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e"
|
||||||
|
dependencies = [
|
||||||
|
"winnow",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_write"
|
name = "toml_write"
|
||||||
version = "0.1.2"
|
version = "0.1.2"
|
||||||
@@ -1962,9 +2869,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing-attributes"
|
name = "tracing-attributes"
|
||||||
version = "0.1.30"
|
version = "0.1.31"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903"
|
checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -1973,9 +2880,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing-core"
|
name = "tracing-core"
|
||||||
version = "0.1.34"
|
version = "0.1.35"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678"
|
checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"valuable",
|
"valuable",
|
||||||
@@ -2016,6 +2923,23 @@ version = "0.2.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
|
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "typenum"
|
||||||
|
version = "1.19.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "uds_windows"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9"
|
||||||
|
dependencies = [
|
||||||
|
"memoffset",
|
||||||
|
"tempfile",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.22"
|
version = "1.0.22"
|
||||||
@@ -2513,9 +3437,9 @@ checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winnow"
|
name = "winnow"
|
||||||
version = "0.7.13"
|
version = "0.7.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf"
|
checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
@@ -2542,6 +3466,16 @@ version = "0.6.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9"
|
checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "xdg-home"
|
||||||
|
version = "1.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ec1cdab258fb55c0da61328dc52c8764709b249011b2cad0454c72f0bf10a1f6"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"windows-sys 0.59.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "yoke"
|
name = "yoke"
|
||||||
version = "0.8.1"
|
version = "0.8.1"
|
||||||
@@ -2566,19 +3500,81 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zerocopy"
|
name = "zbus"
|
||||||
version = "0.8.27"
|
version = "4.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c"
|
checksum = "bb97012beadd29e654708a0fdb4c84bc046f537aecfde2c3ee0a9e4b4d48c725"
|
||||||
|
dependencies = [
|
||||||
|
"async-broadcast",
|
||||||
|
"async-executor",
|
||||||
|
"async-fs",
|
||||||
|
"async-io",
|
||||||
|
"async-lock",
|
||||||
|
"async-process",
|
||||||
|
"async-recursion",
|
||||||
|
"async-task",
|
||||||
|
"async-trait",
|
||||||
|
"blocking",
|
||||||
|
"enumflags2",
|
||||||
|
"event-listener",
|
||||||
|
"futures-core",
|
||||||
|
"futures-sink",
|
||||||
|
"futures-util",
|
||||||
|
"hex",
|
||||||
|
"nix 0.29.0",
|
||||||
|
"ordered-stream",
|
||||||
|
"rand",
|
||||||
|
"serde",
|
||||||
|
"serde_repr",
|
||||||
|
"sha1",
|
||||||
|
"static_assertions",
|
||||||
|
"tracing",
|
||||||
|
"uds_windows",
|
||||||
|
"windows-sys 0.52.0",
|
||||||
|
"xdg-home",
|
||||||
|
"zbus_macros",
|
||||||
|
"zbus_names",
|
||||||
|
"zvariant",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zbus_macros"
|
||||||
|
version = "4.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "267db9407081e90bbfa46d841d3cbc60f59c0351838c4bc65199ecd79ab1983e"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro-crate",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"zvariant_utils",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zbus_names"
|
||||||
|
version = "3.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4b9b1fef7d021261cc16cba64c351d291b715febe0fa10dc3a443ac5a5022e6c"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
"static_assertions",
|
||||||
|
"zvariant",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zerocopy"
|
||||||
|
version = "0.8.30"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4ea879c944afe8a2b25fef16bb4ba234f47c694565e97383b36f3a878219065c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"zerocopy-derive",
|
"zerocopy-derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zerocopy-derive"
|
name = "zerocopy-derive"
|
||||||
version = "0.8.27"
|
version = "0.8.30"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831"
|
checksum = "cf955aa904d6040f70dc8e9384444cb1030aed272ba3cb09bbc4ab9e7c1f34f5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -2670,3 +3666,40 @@ dependencies = [
|
|||||||
"system-deps",
|
"system-deps",
|
||||||
"zeromq-src",
|
"zeromq-src",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zvariant"
|
||||||
|
version = "4.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2084290ab9a1c471c38fc524945837734fbf124487e105daec2bb57fd48c81fe"
|
||||||
|
dependencies = [
|
||||||
|
"endi",
|
||||||
|
"enumflags2",
|
||||||
|
"serde",
|
||||||
|
"static_assertions",
|
||||||
|
"zvariant_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zvariant_derive"
|
||||||
|
version = "4.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "73e2ba546bda683a90652bac4a279bc146adad1386f25379cf73200d2002c449"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro-crate",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
"zvariant_utils",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zvariant_utils"
|
||||||
|
version = "2.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c51bcff7cc3dbb5055396bcf774748c3dab426b4b8659046963523cee4808340"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cm-dashboard-agent"
|
name = "cm-dashboard-agent"
|
||||||
version = "0.1.158"
|
version = "0.1.199"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
@@ -20,4 +20,17 @@ gethostname = { workspace = true }
|
|||||||
chrono-tz = "0.8"
|
chrono-tz = "0.8"
|
||||||
toml = { workspace = true }
|
toml = { workspace = true }
|
||||||
async-trait = "0.1"
|
async-trait = "0.1"
|
||||||
reqwest = { version = "0.11", features = ["json", "blocking"] }
|
reqwest = { version = "0.11", features = ["json", "blocking"] }
|
||||||
|
|
||||||
|
# Native system APIs
|
||||||
|
nix = { version = "0.29", features = ["fs"] }
|
||||||
|
rtnetlink = "0.14"
|
||||||
|
netlink-packet-route = "0.19"
|
||||||
|
futures = "0.3"
|
||||||
|
libc = "0.2"
|
||||||
|
|
||||||
|
# Docker API client
|
||||||
|
bollard = "0.17"
|
||||||
|
|
||||||
|
# D-Bus client for systemd
|
||||||
|
zbus = "4.0"
|
||||||
@@ -4,7 +4,7 @@ use std::time::Duration;
|
|||||||
use tokio::time::interval;
|
use tokio::time::interval;
|
||||||
use tracing::{debug, error, info};
|
use tracing::{debug, error, info};
|
||||||
|
|
||||||
use crate::communication::{AgentCommand, ZmqHandler};
|
use crate::communication::ZmqHandler;
|
||||||
use crate::config::AgentConfig;
|
use crate::config::AgentConfig;
|
||||||
use crate::collectors::{
|
use crate::collectors::{
|
||||||
Collector,
|
Collector,
|
||||||
@@ -12,11 +12,11 @@ use crate::collectors::{
|
|||||||
cpu::CpuCollector,
|
cpu::CpuCollector,
|
||||||
disk::DiskCollector,
|
disk::DiskCollector,
|
||||||
memory::MemoryCollector,
|
memory::MemoryCollector,
|
||||||
|
network::NetworkCollector,
|
||||||
nixos::NixOSCollector,
|
nixos::NixOSCollector,
|
||||||
systemd::SystemdCollector,
|
systemd::SystemdCollector,
|
||||||
};
|
};
|
||||||
use crate::notifications::NotificationManager;
|
use crate::notifications::NotificationManager;
|
||||||
use crate::service_tracker::UserStoppedServiceTracker;
|
|
||||||
use cm_dashboard_shared::AgentData;
|
use cm_dashboard_shared::AgentData;
|
||||||
|
|
||||||
pub struct Agent {
|
pub struct Agent {
|
||||||
@@ -25,7 +25,6 @@ pub struct Agent {
|
|||||||
zmq_handler: ZmqHandler,
|
zmq_handler: ZmqHandler,
|
||||||
collectors: Vec<Box<dyn Collector>>,
|
collectors: Vec<Box<dyn Collector>>,
|
||||||
notification_manager: NotificationManager,
|
notification_manager: NotificationManager,
|
||||||
service_tracker: UserStoppedServiceTracker,
|
|
||||||
previous_status: Option<SystemStatus>,
|
previous_status: Option<SystemStatus>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +78,11 @@ impl Agent {
|
|||||||
if config.collectors.backup.enabled {
|
if config.collectors.backup.enabled {
|
||||||
collectors.push(Box::new(BackupCollector::new()));
|
collectors.push(Box::new(BackupCollector::new()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if config.collectors.network.enabled {
|
||||||
|
collectors.push(Box::new(NetworkCollector::new(config.collectors.network.clone())));
|
||||||
|
}
|
||||||
|
|
||||||
if config.collectors.nixos.enabled {
|
if config.collectors.nixos.enabled {
|
||||||
collectors.push(Box::new(NixOSCollector::new(config.collectors.nixos.clone())));
|
collectors.push(Box::new(NixOSCollector::new(config.collectors.nixos.clone())));
|
||||||
}
|
}
|
||||||
@@ -90,17 +93,12 @@ impl Agent {
|
|||||||
let notification_manager = NotificationManager::new(&config.notifications, &hostname)?;
|
let notification_manager = NotificationManager::new(&config.notifications, &hostname)?;
|
||||||
info!("Notification manager initialized");
|
info!("Notification manager initialized");
|
||||||
|
|
||||||
// Initialize service tracker
|
|
||||||
let service_tracker = UserStoppedServiceTracker::new();
|
|
||||||
info!("Service tracker initialized");
|
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
hostname,
|
hostname,
|
||||||
config,
|
config,
|
||||||
zmq_handler,
|
zmq_handler,
|
||||||
collectors,
|
collectors,
|
||||||
notification_manager,
|
notification_manager,
|
||||||
service_tracker,
|
|
||||||
previous_status: None,
|
previous_status: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -136,12 +134,6 @@ impl Agent {
|
|||||||
// NOTE: With structured data, we might need to implement status tracking differently
|
// NOTE: With structured data, we might need to implement status tracking differently
|
||||||
// For now, we skip this until status evaluation is migrated
|
// For now, we skip this until status evaluation is migrated
|
||||||
}
|
}
|
||||||
// Handle incoming commands (check periodically)
|
|
||||||
_ = tokio::time::sleep(Duration::from_millis(100)) => {
|
|
||||||
if let Err(e) = self.handle_commands().await {
|
|
||||||
error!("Error handling commands: {}", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ = &mut shutdown_rx => {
|
_ = &mut shutdown_rx => {
|
||||||
info!("Shutdown signal received, stopping agent loop");
|
info!("Shutdown signal received, stopping agent loop");
|
||||||
break;
|
break;
|
||||||
@@ -261,36 +253,4 @@ impl Agent {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handle incoming commands from dashboard
|
|
||||||
async fn handle_commands(&mut self) -> Result<()> {
|
|
||||||
// Try to receive a command (non-blocking)
|
|
||||||
if let Ok(Some(command)) = self.zmq_handler.try_receive_command() {
|
|
||||||
info!("Received command: {:?}", command);
|
|
||||||
|
|
||||||
match command {
|
|
||||||
AgentCommand::CollectNow => {
|
|
||||||
info!("Received immediate collection request");
|
|
||||||
if let Err(e) = self.collect_and_broadcast().await {
|
|
||||||
error!("Failed to collect on demand: {}", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
AgentCommand::SetInterval { seconds } => {
|
|
||||||
info!("Received interval change request: {}s", seconds);
|
|
||||||
// Note: This would require more complex handling to update the interval
|
|
||||||
// For now, just acknowledge
|
|
||||||
}
|
|
||||||
AgentCommand::ToggleCollector { name, enabled } => {
|
|
||||||
info!("Received collector toggle request: {} -> {}", name, enabled);
|
|
||||||
// Note: This would require more complex handling to enable/disable collectors
|
|
||||||
// For now, just acknowledge
|
|
||||||
}
|
|
||||||
AgentCommand::Ping => {
|
|
||||||
info!("Received ping command");
|
|
||||||
// Maybe send back a pong or status
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use chrono::{NaiveDateTime, DateTime};
|
|
||||||
use cm_dashboard_shared::{AgentData, BackupData, BackupDiskData};
|
use cm_dashboard_shared::{AgentData, BackupData, BackupDiskData};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|||||||
@@ -1,22 +1,25 @@
|
|||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use cm_dashboard_shared::{AgentData, Status, HysteresisThresholds};
|
use cm_dashboard_shared::{AgentData, Status, HysteresisThresholds, CpuData};
|
||||||
|
use std::sync::RwLock;
|
||||||
|
use std::time::Instant;
|
||||||
|
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
use super::{utils, Collector, CollectorError};
|
use super::{utils, Collector, CollectorError};
|
||||||
use crate::config::CpuConfig;
|
use crate::config::CpuConfig;
|
||||||
|
|
||||||
/// Extremely efficient CPU metrics collector
|
/// Extremely efficient CPU metrics collector with interval-based caching
|
||||||
///
|
|
||||||
/// EFFICIENCY OPTIMIZATIONS:
|
|
||||||
/// - Single /proc/loadavg read for all load metrics
|
|
||||||
/// - Single /proc/stat read for CPU usage
|
|
||||||
/// - Minimal string allocations
|
|
||||||
/// - No process spawning
|
|
||||||
/// - <0.1ms collection time target
|
|
||||||
pub struct CpuCollector {
|
pub struct CpuCollector {
|
||||||
load_thresholds: HysteresisThresholds,
|
load_thresholds: HysteresisThresholds,
|
||||||
temperature_thresholds: HysteresisThresholds,
|
temperature_thresholds: HysteresisThresholds,
|
||||||
|
config: CpuConfig,
|
||||||
|
state: RwLock<CpuCacheState>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
struct CpuCacheState {
|
||||||
|
last_collection: Option<Instant>,
|
||||||
|
cached_data: CpuData,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CpuCollector {
|
impl CpuCollector {
|
||||||
@@ -26,15 +29,39 @@ impl CpuCollector {
|
|||||||
config.load_warning_threshold,
|
config.load_warning_threshold,
|
||||||
config.load_critical_threshold,
|
config.load_critical_threshold,
|
||||||
);
|
);
|
||||||
|
|
||||||
let temperature_thresholds = HysteresisThresholds::new(
|
let temperature_thresholds = HysteresisThresholds::new(
|
||||||
config.temperature_warning_threshold,
|
config.temperature_warning_threshold,
|
||||||
config.temperature_critical_threshold,
|
config.temperature_critical_threshold,
|
||||||
);
|
);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
load_thresholds,
|
load_thresholds,
|
||||||
temperature_thresholds,
|
temperature_thresholds,
|
||||||
|
config,
|
||||||
|
state: RwLock::new(CpuCacheState {
|
||||||
|
last_collection: None,
|
||||||
|
cached_data: CpuData {
|
||||||
|
load_1min: 0.0,
|
||||||
|
load_5min: 0.0,
|
||||||
|
load_15min: 0.0,
|
||||||
|
frequency_mhz: 0.0,
|
||||||
|
temperature_celsius: None,
|
||||||
|
load_status: Status::Unknown,
|
||||||
|
temperature_status: Status::Unknown,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn should_update_cache(&self) -> bool {
|
||||||
|
let state = self.state.read().unwrap();
|
||||||
|
match state.last_collection {
|
||||||
|
None => true,
|
||||||
|
Some(last) => {
|
||||||
|
let cache_duration = std::time::Duration::from_secs(self.config.interval_seconds);
|
||||||
|
last.elapsed() > cache_duration
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,6 +183,14 @@ impl CpuCollector {
|
|||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl Collector for CpuCollector {
|
impl Collector for CpuCollector {
|
||||||
async fn collect_structured(&self, agent_data: &mut AgentData) -> Result<(), CollectorError> {
|
async fn collect_structured(&self, agent_data: &mut AgentData) -> Result<(), CollectorError> {
|
||||||
|
// Check if cache is valid
|
||||||
|
if !self.should_update_cache() {
|
||||||
|
let state = self.state.read().unwrap();
|
||||||
|
agent_data.system.cpu = state.cached_data.clone();
|
||||||
|
debug!("Using cached CPU data (interval: {}s)", self.config.interval_seconds);
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
debug!("Collecting CPU metrics");
|
debug!("Collecting CPU metrics");
|
||||||
let start = std::time::Instant::now();
|
let start = std::time::Instant::now();
|
||||||
|
|
||||||
@@ -187,6 +222,11 @@ impl Collector for CpuCollector {
|
|||||||
Status::Unknown
|
Status::Unknown
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Update cache
|
||||||
|
let mut state = self.state.write().unwrap();
|
||||||
|
state.last_collection = Some(Instant::now());
|
||||||
|
state.cached_data = agent_data.system.cpu.clone();
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use crate::config::DiskConfig;
|
|||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use std::sync::RwLock;
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
use super::{Collector, CollectorError};
|
use super::{Collector, CollectorError};
|
||||||
@@ -14,15 +15,26 @@ use super::{Collector, CollectorError};
|
|||||||
pub struct DiskCollector {
|
pub struct DiskCollector {
|
||||||
config: DiskConfig,
|
config: DiskConfig,
|
||||||
temperature_thresholds: HysteresisThresholds,
|
temperature_thresholds: HysteresisThresholds,
|
||||||
|
/// Cached state with thread-safe interior mutability
|
||||||
|
state: RwLock<DiskCacheState>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Internal state for disk caching
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
struct DiskCacheState {
|
||||||
|
/// Last collection time for performance tracking
|
||||||
|
last_collection: Option<Instant>,
|
||||||
|
/// Cached drive data
|
||||||
|
cached_drives: Vec<DriveData>,
|
||||||
|
/// Cached pool data
|
||||||
|
cached_pools: Vec<PoolData>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A physical drive with its filesystems
|
/// A physical drive with its filesystems
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
struct PhysicalDrive {
|
struct PhysicalDrive {
|
||||||
name: String, // e.g., "nvme0n1", "sda"
|
name: String, // e.g., "nvme0n1", "sda"
|
||||||
health: String, // SMART health status
|
health: String, // SMART health status
|
||||||
temperature_celsius: Option<f32>, // Drive temperature
|
|
||||||
wear_percent: Option<f32>, // SSD wear level
|
|
||||||
filesystems: Vec<Filesystem>, // mounted filesystems on this drive
|
filesystems: Vec<Filesystem>, // mounted filesystems on this drive
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,10 +72,17 @@ impl DiskCollector {
|
|||||||
config.temperature_warning_celsius,
|
config.temperature_warning_celsius,
|
||||||
config.temperature_critical_celsius,
|
config.temperature_critical_celsius,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let state = DiskCacheState {
|
||||||
|
last_collection: None,
|
||||||
|
cached_drives: Vec::new(),
|
||||||
|
cached_pools: Vec::new(),
|
||||||
|
};
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
config,
|
config,
|
||||||
temperature_thresholds,
|
temperature_thresholds,
|
||||||
|
state: RwLock::new(state),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,37 +125,70 @@ impl DiskCollector {
|
|||||||
self.populate_drives_data(&physical_drives, &smart_data, agent_data)?;
|
self.populate_drives_data(&physical_drives, &smart_data, agent_data)?;
|
||||||
self.populate_pools_data(&mergerfs_pools, &smart_data, agent_data)?;
|
self.populate_pools_data(&mergerfs_pools, &smart_data, agent_data)?;
|
||||||
|
|
||||||
|
// Step 7: Update cache with fresh data
|
||||||
|
{
|
||||||
|
let mut state = self.state.write().unwrap();
|
||||||
|
state.cached_drives = agent_data.system.storage.drives.clone();
|
||||||
|
state.cached_pools = agent_data.system.storage.pools.clone();
|
||||||
|
state.last_collection = Some(Instant::now());
|
||||||
|
}
|
||||||
|
|
||||||
let elapsed = start_time.elapsed();
|
let elapsed = start_time.elapsed();
|
||||||
debug!("Storage collection completed in {:?}", elapsed);
|
debug!("Storage collection completed in {:?}", elapsed);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get block devices and their mount points using lsblk
|
/// Check if disk collection cache should be updated
|
||||||
|
fn should_update_cache(&self) -> bool {
|
||||||
|
let state = self.state.read().unwrap();
|
||||||
|
|
||||||
|
match state.last_collection {
|
||||||
|
None => true,
|
||||||
|
Some(last) => {
|
||||||
|
let cache_duration = std::time::Duration::from_secs(self.config.interval_seconds);
|
||||||
|
last.elapsed() > cache_duration
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get cached disk data if available and fresh
|
||||||
|
fn get_cached_data(&self) -> Option<(Vec<DriveData>, Vec<PoolData>)> {
|
||||||
|
if !self.should_update_cache() {
|
||||||
|
let state = self.state.read().unwrap();
|
||||||
|
Some((state.cached_drives.clone(), state.cached_pools.clone()))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get block devices and their mount points by reading /proc/mounts
|
||||||
async fn get_mount_devices(&self) -> Result<HashMap<String, String>, CollectorError> {
|
async fn get_mount_devices(&self) -> Result<HashMap<String, String>, CollectorError> {
|
||||||
let output = Command::new("lsblk")
|
let content = std::fs::read_to_string("/proc/mounts")
|
||||||
.args(&["-rn", "-o", "NAME,MOUNTPOINT"])
|
|
||||||
.output()
|
|
||||||
.map_err(|e| CollectorError::SystemRead {
|
.map_err(|e| CollectorError::SystemRead {
|
||||||
path: "block devices".to_string(),
|
path: "/proc/mounts".to_string(),
|
||||||
error: e.to_string(),
|
error: e.to_string(),
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let mut mount_devices = HashMap::new();
|
let mut mount_devices = HashMap::new();
|
||||||
for line in String::from_utf8_lossy(&output.stdout).lines() {
|
|
||||||
|
for line in content.lines() {
|
||||||
let parts: Vec<&str> = line.split_whitespace().collect();
|
let parts: Vec<&str> = line.split_whitespace().collect();
|
||||||
if parts.len() >= 2 {
|
if parts.len() >= 3 {
|
||||||
let device_name = parts[0];
|
let device = parts[0];
|
||||||
let mount_point = parts[1];
|
let mount_point = parts[1];
|
||||||
|
let fs_type = parts[2];
|
||||||
// Skip swap partitions and unmounted devices
|
|
||||||
if mount_point == "[SWAP]" || mount_point.is_empty() {
|
// Skip pseudo filesystems and fuse mounts
|
||||||
|
if fs_type.starts_with("fuse") ||
|
||||||
|
matches!(fs_type, "proc" | "sysfs" | "tmpfs" | "devtmpfs" |
|
||||||
|
"devpts" | "cgroup" | "cgroup2" | "pstore" | "bpf" |
|
||||||
|
"tracefs" | "debugfs" | "securityfs" | "hugetlbfs" |
|
||||||
|
"mqueue" | "configfs" | "autofs") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert device name to full path
|
mount_devices.insert(mount_point.to_string(), device.to_string());
|
||||||
let device_path = format!("/dev/{}", device_name);
|
|
||||||
mount_devices.insert(mount_point.to_string(), device_path);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,44 +238,20 @@ impl DiskCollector {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get filesystem info for a single mount point
|
/// Get filesystem info for a single mount point using statvfs syscall
|
||||||
fn get_filesystem_info(&self, mount_point: &str) -> Result<(u64, u64), CollectorError> {
|
fn get_filesystem_info(&self, mount_point: &str) -> Result<(u64, u64), CollectorError> {
|
||||||
let output = Command::new("df")
|
use nix::sys::statvfs::statvfs;
|
||||||
.args(&["--block-size=1", mount_point])
|
|
||||||
.output()
|
|
||||||
.map_err(|e| CollectorError::SystemRead {
|
|
||||||
path: format!("df {}", mount_point),
|
|
||||||
error: e.to_string(),
|
|
||||||
})?;
|
|
||||||
|
|
||||||
let output_str = String::from_utf8_lossy(&output.stdout);
|
let stat = statvfs(mount_point).map_err(|e| CollectorError::SystemRead {
|
||||||
let lines: Vec<&str> = output_str.lines().collect();
|
path: mount_point.to_string(),
|
||||||
|
error: format!("statvfs failed: {}", e),
|
||||||
if lines.len() < 2 {
|
|
||||||
return Err(CollectorError::Parse {
|
|
||||||
value: output_str.to_string(),
|
|
||||||
error: "Expected at least 2 lines from df output".to_string(),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse the data line (skip header)
|
|
||||||
let parts: Vec<&str> = lines[1].split_whitespace().collect();
|
|
||||||
if parts.len() < 4 {
|
|
||||||
return Err(CollectorError::Parse {
|
|
||||||
value: lines[1].to_string(),
|
|
||||||
error: "Expected at least 4 fields in df output".to_string(),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
let total_bytes: u64 = parts[1].parse().map_err(|e| CollectorError::Parse {
|
|
||||||
value: parts[1].to_string(),
|
|
||||||
error: format!("Failed to parse total bytes: {}", e),
|
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let used_bytes: u64 = parts[2].parse().map_err(|e| CollectorError::Parse {
|
// Calculate total and used bytes
|
||||||
value: parts[2].to_string(),
|
let block_size = stat.fragment_size() as u64;
|
||||||
error: format!("Failed to parse used bytes: {}", e),
|
let total_bytes = stat.blocks() as u64 * block_size;
|
||||||
})?;
|
let available_bytes = stat.blocks_available() as u64 * block_size;
|
||||||
|
let used_bytes = total_bytes - available_bytes;
|
||||||
|
|
||||||
Ok((total_bytes, used_bytes))
|
Ok((total_bytes, used_bytes))
|
||||||
}
|
}
|
||||||
@@ -351,8 +379,6 @@ impl DiskCollector {
|
|||||||
let physical_drive = PhysicalDrive {
|
let physical_drive = PhysicalDrive {
|
||||||
name: drive_name,
|
name: drive_name,
|
||||||
health: "UNKNOWN".to_string(), // Will be updated with SMART data
|
health: "UNKNOWN".to_string(), // Will be updated with SMART data
|
||||||
temperature_celsius: None,
|
|
||||||
wear_percent: None,
|
|
||||||
filesystems,
|
filesystems,
|
||||||
};
|
};
|
||||||
physical_drives.push(physical_drive);
|
physical_drives.push(physical_drive);
|
||||||
@@ -390,7 +416,7 @@ impl DiskCollector {
|
|||||||
/// Get SMART data for drives
|
/// Get SMART data for drives
|
||||||
async fn get_smart_data_for_drives(&self, physical_drives: &[PhysicalDrive], mergerfs_pools: &[MergerfsPool]) -> HashMap<String, SmartData> {
|
async fn get_smart_data_for_drives(&self, physical_drives: &[PhysicalDrive], mergerfs_pools: &[MergerfsPool]) -> HashMap<String, SmartData> {
|
||||||
let mut smart_data = HashMap::new();
|
let mut smart_data = HashMap::new();
|
||||||
|
|
||||||
// Collect all drive names
|
// Collect all drive names
|
||||||
let mut all_drives = std::collections::HashSet::new();
|
let mut all_drives = std::collections::HashSet::new();
|
||||||
for drive in physical_drives {
|
for drive in physical_drives {
|
||||||
@@ -417,23 +443,26 @@ impl DiskCollector {
|
|||||||
|
|
||||||
/// Get SMART data for a single drive
|
/// Get SMART data for a single drive
|
||||||
async fn get_smart_data(&self, drive_name: &str) -> Result<SmartData, CollectorError> {
|
async fn get_smart_data(&self, drive_name: &str) -> Result<SmartData, CollectorError> {
|
||||||
let output = Command::new("sudo")
|
use super::run_command_with_timeout;
|
||||||
.args(&["smartctl", "-a", &format!("/dev/{}", drive_name)])
|
|
||||||
.output()
|
// Use direct smartctl (no sudo) - service has CAP_SYS_RAWIO and CAP_SYS_ADMIN capabilities
|
||||||
|
// For NVMe drives, specify device type explicitly
|
||||||
|
let mut cmd = Command::new("smartctl");
|
||||||
|
if drive_name.starts_with("nvme") {
|
||||||
|
cmd.args(&["-d", "nvme", "-a", &format!("/dev/{}", drive_name)]);
|
||||||
|
} else {
|
||||||
|
cmd.args(&["-a", &format!("/dev/{}", drive_name)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
let output = run_command_with_timeout(cmd, 3).await
|
||||||
.map_err(|e| CollectorError::SystemRead {
|
.map_err(|e| CollectorError::SystemRead {
|
||||||
path: format!("SMART data for {}", drive_name),
|
path: format!("SMART data for {}", drive_name),
|
||||||
error: e.to_string(),
|
error: e.to_string(),
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let output_str = String::from_utf8_lossy(&output.stdout);
|
let output_str = String::from_utf8_lossy(&output.stdout);
|
||||||
let error_str = String::from_utf8_lossy(&output.stderr);
|
|
||||||
|
|
||||||
// Debug logging for SMART command results
|
|
||||||
debug!("SMART output for {}: status={}, stdout_len={}, stderr={}",
|
|
||||||
drive_name, output.status, output_str.len(), error_str);
|
|
||||||
|
|
||||||
if !output.status.success() {
|
if !output.status.success() {
|
||||||
debug!("SMART command failed for {}: {}", drive_name, error_str);
|
|
||||||
// Return unknown data rather than failing completely
|
// Return unknown data rather than failing completely
|
||||||
return Ok(SmartData {
|
return Ok(SmartData {
|
||||||
health: "UNKNOWN".to_string(),
|
health: "UNKNOWN".to_string(),
|
||||||
@@ -758,32 +787,29 @@ impl DiskCollector {
|
|||||||
Ok((data_drives, parity_drives))
|
Ok((data_drives, parity_drives))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get drive information for a mount path
|
/// Get drive information for a mount path by reading /proc/mounts
|
||||||
fn get_drive_info_for_path(&self, path: &str) -> anyhow::Result<PoolDrive> {
|
fn get_drive_info_for_path(&self, path: &str) -> anyhow::Result<PoolDrive> {
|
||||||
// Use lsblk to find the backing device
|
// Read /proc/mounts to find the backing device
|
||||||
let output = Command::new("lsblk")
|
let content = std::fs::read_to_string("/proc/mounts")
|
||||||
.args(&["-rn", "-o", "NAME,MOUNTPOINT"])
|
.map_err(|e| anyhow::anyhow!("Failed to read /proc/mounts: {}", e))?;
|
||||||
.output()
|
|
||||||
.map_err(|e| anyhow::anyhow!("Failed to run lsblk: {}", e))?;
|
|
||||||
|
|
||||||
let output_str = String::from_utf8_lossy(&output.stdout);
|
|
||||||
let mut device = String::new();
|
let mut device = String::new();
|
||||||
|
|
||||||
for line in output_str.lines() {
|
for line in content.lines() {
|
||||||
let parts: Vec<&str> = line.split_whitespace().collect();
|
let parts: Vec<&str> = line.split_whitespace().collect();
|
||||||
if parts.len() >= 2 && parts[1] == path {
|
if parts.len() >= 2 && parts[1] == path {
|
||||||
device = parts[0].to_string();
|
device = parts[0].to_string();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if device.is_empty() {
|
if device.is_empty() {
|
||||||
return Err(anyhow::anyhow!("Could not find device for path {}", path));
|
return Err(anyhow::anyhow!("Could not find device for path {}", path));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract base device name (e.g., "sda1" -> "sda")
|
// Extract base device name (e.g., "/dev/sda1" -> "sda")
|
||||||
let base_device = self.extract_base_device(&format!("/dev/{}", device));
|
let base_device = self.extract_base_device(&device);
|
||||||
|
|
||||||
// Get temperature from SMART data if available
|
// Get temperature from SMART data if available
|
||||||
let temperature = if let Ok(smart_data) = tokio::task::block_in_place(|| {
|
let temperature = if let Ok(smart_data) = tokio::task::block_in_place(|| {
|
||||||
tokio::runtime::Handle::current().block_on(self.get_smart_data(&base_device))
|
tokio::runtime::Handle::current().block_on(self.get_smart_data(&base_device))
|
||||||
@@ -792,7 +818,7 @@ impl DiskCollector {
|
|||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(PoolDrive {
|
Ok(PoolDrive {
|
||||||
name: base_device,
|
name: base_device,
|
||||||
mount_point: path.to_string(),
|
mount_point: path.to_string(),
|
||||||
@@ -836,7 +862,15 @@ impl DiskCollector {
|
|||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl Collector for DiskCollector {
|
impl Collector for DiskCollector {
|
||||||
async fn collect_structured(&self, agent_data: &mut AgentData) -> Result<(), CollectorError> {
|
async fn collect_structured(&self, agent_data: &mut AgentData) -> Result<(), CollectorError> {
|
||||||
self.collect_storage_data(agent_data).await
|
// Use cached data if available and fresh
|
||||||
|
if let Some((cached_drives, cached_pools)) = self.get_cached_data() {
|
||||||
|
agent_data.system.storage.drives = cached_drives;
|
||||||
|
agent_data.system.storage.pools = cached_pools;
|
||||||
|
Ok(())
|
||||||
|
} else {
|
||||||
|
// Collect fresh data
|
||||||
|
self.collect_storage_data(agent_data).await
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,62 +95,47 @@ impl MemoryCollector {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Populate tmpfs data into AgentData
|
/// Populate tmpfs data into AgentData using statvfs syscall
|
||||||
async fn populate_tmpfs_data(&self, agent_data: &mut AgentData) -> Result<(), CollectorError> {
|
async fn populate_tmpfs_data(&self, agent_data: &mut AgentData) -> Result<(), CollectorError> {
|
||||||
|
use nix::sys::statvfs::statvfs;
|
||||||
|
|
||||||
// Discover all tmpfs mount points
|
// Discover all tmpfs mount points
|
||||||
let tmpfs_mounts = self.discover_tmpfs_mounts()?;
|
let tmpfs_mounts = self.discover_tmpfs_mounts()?;
|
||||||
|
|
||||||
if tmpfs_mounts.is_empty() {
|
if tmpfs_mounts.is_empty() {
|
||||||
debug!("No tmpfs mounts found to monitor");
|
debug!("No tmpfs mounts found to monitor");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get usage data for all tmpfs mounts at once using df
|
// Get usage data for each tmpfs mount using statvfs syscall
|
||||||
let mut df_args = vec!["df", "--output=target,size,used", "--block-size=1"];
|
for mount_point in tmpfs_mounts {
|
||||||
df_args.extend(tmpfs_mounts.iter().map(|s| s.as_str()));
|
match statvfs(mount_point.as_str()) {
|
||||||
|
Ok(stat) => {
|
||||||
|
let block_size = stat.fragment_size() as u64;
|
||||||
|
let total_bytes = stat.blocks() as u64 * block_size;
|
||||||
|
let available_bytes = stat.blocks_available() as u64 * block_size;
|
||||||
|
let used_bytes = total_bytes - available_bytes;
|
||||||
|
|
||||||
let df_output = std::process::Command::new(df_args[0])
|
if total_bytes == 0 {
|
||||||
.args(&df_args[1..])
|
continue;
|
||||||
.output()
|
}
|
||||||
.map_err(|e| CollectorError::SystemRead {
|
|
||||||
path: "tmpfs mounts".to_string(),
|
|
||||||
error: e.to_string(),
|
|
||||||
})?;
|
|
||||||
|
|
||||||
let df_str = String::from_utf8_lossy(&df_output.stdout);
|
let total_gb = total_bytes as f32 / (1024.0 * 1024.0 * 1024.0);
|
||||||
let df_lines: Vec<&str> = df_str.lines().skip(1).collect(); // Skip header
|
let used_gb = used_bytes as f32 / (1024.0 * 1024.0 * 1024.0);
|
||||||
|
let usage_percent = (used_bytes as f32 / total_bytes as f32) * 100.0;
|
||||||
|
|
||||||
// Process each tmpfs mount
|
// Add to tmpfs list
|
||||||
for (i, mount_point) in tmpfs_mounts.iter().enumerate() {
|
agent_data.system.memory.tmpfs.push(TmpfsData {
|
||||||
if i >= df_lines.len() {
|
mount: mount_point.clone(),
|
||||||
debug!("Not enough df output lines for tmpfs mount: {}", mount_point);
|
usage_percent,
|
||||||
continue;
|
used_gb,
|
||||||
|
total_gb,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
debug!("Failed to get stats for tmpfs mount {}: {}", mount_point, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let parts: Vec<&str> = df_lines[i].split_whitespace().collect();
|
|
||||||
if parts.len() < 3 {
|
|
||||||
debug!("Invalid df output for tmpfs mount: {}", mount_point);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
let total_bytes: u64 = parts[1].parse().unwrap_or(0);
|
|
||||||
let used_bytes: u64 = parts[2].parse().unwrap_or(0);
|
|
||||||
|
|
||||||
if total_bytes == 0 {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
let total_gb = total_bytes as f32 / (1024.0 * 1024.0 * 1024.0);
|
|
||||||
let used_gb = used_bytes as f32 / (1024.0 * 1024.0 * 1024.0);
|
|
||||||
let usage_percent = (used_bytes as f32 / total_bytes as f32) * 100.0;
|
|
||||||
|
|
||||||
// Add to tmpfs list
|
|
||||||
agent_data.system.memory.tmpfs.push(TmpfsData {
|
|
||||||
mount: mount_point.clone(),
|
|
||||||
usage_percent,
|
|
||||||
used_gb,
|
|
||||||
total_gb,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort tmpfs mounts by mount point for consistent display order
|
// Sort tmpfs mounts by mount point for consistent display order
|
||||||
|
|||||||
@@ -1,17 +1,34 @@
|
|||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use cm_dashboard_shared::{AgentData};
|
use cm_dashboard_shared::{AgentData};
|
||||||
|
use std::process::{Command, Output};
|
||||||
|
use std::time::Duration;
|
||||||
|
use tokio::time::timeout;
|
||||||
|
|
||||||
pub mod backup;
|
pub mod backup;
|
||||||
pub mod cpu;
|
pub mod cpu;
|
||||||
pub mod disk;
|
pub mod disk;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod memory;
|
pub mod memory;
|
||||||
|
pub mod network;
|
||||||
pub mod nixos;
|
pub mod nixos;
|
||||||
pub mod systemd;
|
pub mod systemd;
|
||||||
|
|
||||||
pub use error::CollectorError;
|
pub use error::CollectorError;
|
||||||
|
|
||||||
|
/// Run a command with a timeout to prevent blocking
|
||||||
|
pub async fn run_command_with_timeout(mut cmd: Command, timeout_secs: u64) -> std::io::Result<Output> {
|
||||||
|
let timeout_duration = Duration::from_secs(timeout_secs);
|
||||||
|
|
||||||
|
match timeout(timeout_duration, tokio::task::spawn_blocking(move || cmd.output())).await {
|
||||||
|
Ok(Ok(result)) => result,
|
||||||
|
Ok(Err(e)) => Err(std::io::Error::new(std::io::ErrorKind::Other, e)),
|
||||||
|
Err(_) => Err(std::io::Error::new(
|
||||||
|
std::io::ErrorKind::TimedOut,
|
||||||
|
format!("Command timed out after {} seconds", timeout_secs)
|
||||||
|
)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Base trait for all collectors with direct structured data output
|
/// Base trait for all collectors with direct structured data output
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
|
|||||||
248
agent/src/collectors/network.rs
Normal file
248
agent/src/collectors/network.rs
Normal file
@@ -0,0 +1,248 @@
|
|||||||
|
use async_trait::async_trait;
|
||||||
|
use cm_dashboard_shared::{AgentData, NetworkInterfaceData, Status};
|
||||||
|
use tracing::debug;
|
||||||
|
use futures::stream::TryStreamExt;
|
||||||
|
use rtnetlink::{new_connection, IpVersion};
|
||||||
|
use netlink_packet_route::link::LinkAttribute;
|
||||||
|
use netlink_packet_route::address::AddressAttribute;
|
||||||
|
use netlink_packet_route::route::RouteAttribute;
|
||||||
|
use std::net::IpAddr;
|
||||||
|
|
||||||
|
use super::{Collector, CollectorError};
|
||||||
|
use crate::config::NetworkConfig;
|
||||||
|
|
||||||
|
/// Network interface collector with physical/virtual classification and link status
|
||||||
|
pub struct NetworkCollector {
|
||||||
|
_config: NetworkConfig,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl NetworkCollector {
|
||||||
|
pub fn new(config: NetworkConfig) -> Self {
|
||||||
|
Self { _config: config }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Check if interface is physical (not virtual)
|
||||||
|
fn is_physical_interface(name: &str) -> bool {
|
||||||
|
// Physical interface patterns
|
||||||
|
matches!(
|
||||||
|
&name[..],
|
||||||
|
s if s.starts_with("eth")
|
||||||
|
|| s.starts_with("ens")
|
||||||
|
|| s.starts_with("enp")
|
||||||
|
|| s.starts_with("wlan")
|
||||||
|
|| s.starts_with("wlp")
|
||||||
|
|| s.starts_with("eno")
|
||||||
|
|| s.starts_with("enx")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get link status for an interface
|
||||||
|
fn get_link_status(interface: &str) -> Status {
|
||||||
|
let operstate_path = format!("/sys/class/net/{}/operstate", interface);
|
||||||
|
|
||||||
|
match std::fs::read_to_string(&operstate_path) {
|
||||||
|
Ok(state) => {
|
||||||
|
let state = state.trim();
|
||||||
|
match state {
|
||||||
|
"up" => Status::Ok,
|
||||||
|
"down" => Status::Inactive,
|
||||||
|
"unknown" => Status::Warning,
|
||||||
|
_ => Status::Unknown,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(_) => Status::Unknown,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get the primary physical interface (the one with default route) using rtnetlink
|
||||||
|
async fn get_primary_physical_interface() -> Option<String> {
|
||||||
|
let (connection, handle, _) = match new_connection() {
|
||||||
|
Ok(conn) => conn,
|
||||||
|
Err(e) => {
|
||||||
|
debug!("Failed to create netlink connection: {}", e);
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
tokio::spawn(connection);
|
||||||
|
|
||||||
|
// Get default route
|
||||||
|
let mut routes = handle.route().get(IpVersion::V4).execute();
|
||||||
|
|
||||||
|
while let Ok(Some(route)) = routes.try_next().await {
|
||||||
|
// Check if this is a default route (destination is 0.0.0.0/0)
|
||||||
|
if route.header.destination_prefix_length == 0 {
|
||||||
|
// Find the output interface (OIF) attribute
|
||||||
|
if let Some(oif) = route.attributes.iter().find_map(|attr| {
|
||||||
|
if let RouteAttribute::Oif(index) = attr {
|
||||||
|
Some(*index)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
// Get interface name from index
|
||||||
|
let mut link = handle.link().get().match_index(oif).execute();
|
||||||
|
if let Ok(Some(link_msg)) = link.try_next().await {
|
||||||
|
if let Some(name) = link_msg.attributes.iter().find_map(|attr| {
|
||||||
|
if let LinkAttribute::IfName(n) = attr {
|
||||||
|
Some(n.to_string())
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
if Self::is_physical_interface(&name) {
|
||||||
|
return Some(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Parse VLAN configuration from /proc/net/vlan/config
|
||||||
|
/// Returns a map of interface name -> VLAN ID
|
||||||
|
fn parse_vlan_config() -> std::collections::HashMap<String, u16> {
|
||||||
|
let mut vlan_map = std::collections::HashMap::new();
|
||||||
|
|
||||||
|
if let Ok(contents) = std::fs::read_to_string("/proc/net/vlan/config") {
|
||||||
|
for line in contents.lines().skip(2) { // Skip header lines
|
||||||
|
let parts: Vec<&str> = line.split('|').collect();
|
||||||
|
if parts.len() >= 2 {
|
||||||
|
let interface_name = parts[0].trim();
|
||||||
|
let vlan_id_str = parts[1].trim();
|
||||||
|
|
||||||
|
if let Ok(vlan_id) = vlan_id_str.parse::<u16>() {
|
||||||
|
vlan_map.insert(interface_name.to_string(), vlan_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vlan_map
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Collect network interfaces using rtnetlink
|
||||||
|
async fn collect_interfaces(&self) -> Vec<NetworkInterfaceData> {
|
||||||
|
let mut interfaces = Vec::new();
|
||||||
|
|
||||||
|
// Parse VLAN configuration
|
||||||
|
let vlan_map = Self::parse_vlan_config();
|
||||||
|
|
||||||
|
// Create netlink connection
|
||||||
|
let (connection, handle, _) = match new_connection() {
|
||||||
|
Ok(conn) => conn,
|
||||||
|
Err(e) => {
|
||||||
|
debug!("Failed to create netlink connection: {}", e);
|
||||||
|
return interfaces;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
tokio::spawn(connection);
|
||||||
|
|
||||||
|
// Get all links
|
||||||
|
let mut links = handle.link().get().execute();
|
||||||
|
|
||||||
|
while let Ok(Some(link)) = links.try_next().await {
|
||||||
|
// Get interface name
|
||||||
|
let name = match link.attributes.iter().find_map(|attr| {
|
||||||
|
if let LinkAttribute::IfName(n) = attr {
|
||||||
|
Some(n.to_string())
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
Some(n) => n,
|
||||||
|
None => continue,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Skip loopback and ifb interfaces
|
||||||
|
if name == "lo" || name.starts_with("ifb") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse parent interface from @parent notation (e.g., lan@enp0s31f6)
|
||||||
|
let (interface_name, parent_interface) = if let Some(at_pos) = name.find('@') {
|
||||||
|
let (child, parent) = name.split_at(at_pos);
|
||||||
|
(child.to_string(), Some(parent[1..].to_string()))
|
||||||
|
} else {
|
||||||
|
(name.clone(), None)
|
||||||
|
};
|
||||||
|
|
||||||
|
// Get IP addresses for this interface
|
||||||
|
let mut ipv4_addresses = Vec::new();
|
||||||
|
let mut ipv6_addresses = Vec::new();
|
||||||
|
|
||||||
|
let mut addrs = handle.address().get().set_link_index_filter(link.header.index).execute();
|
||||||
|
while let Ok(Some(addr)) = addrs.try_next().await {
|
||||||
|
for nla in &addr.attributes {
|
||||||
|
if let AddressAttribute::Address(ip) = nla {
|
||||||
|
match ip {
|
||||||
|
IpAddr::V4(ipv4) => ipv4_addresses.push(ipv4.to_string()),
|
||||||
|
IpAddr::V6(ipv6) => {
|
||||||
|
// Skip link-local IPv6 addresses (fe80::)
|
||||||
|
if !ipv6.to_string().starts_with("fe80:") {
|
||||||
|
ipv6_addresses.push(ipv6.to_string());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine if physical
|
||||||
|
let is_physical = Self::is_physical_interface(&interface_name);
|
||||||
|
|
||||||
|
// Only filter out virtual interfaces without IPs
|
||||||
|
if !is_physical && ipv4_addresses.is_empty() && ipv6_addresses.is_empty() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let link_status = if is_physical {
|
||||||
|
Self::get_link_status(&name)
|
||||||
|
} else {
|
||||||
|
Status::Unknown
|
||||||
|
};
|
||||||
|
|
||||||
|
// Look up VLAN ID
|
||||||
|
let vlan_id = vlan_map.get(&name).copied();
|
||||||
|
|
||||||
|
interfaces.push(NetworkInterfaceData {
|
||||||
|
name: interface_name,
|
||||||
|
ipv4_addresses,
|
||||||
|
ipv6_addresses,
|
||||||
|
is_physical,
|
||||||
|
link_status,
|
||||||
|
parent_interface,
|
||||||
|
vlan_id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assign primary physical interface as parent to virtual interfaces
|
||||||
|
if let Some(primary) = Self::get_primary_physical_interface().await {
|
||||||
|
for interface in interfaces.iter_mut() {
|
||||||
|
if !interface.is_physical && interface.parent_interface.is_none() {
|
||||||
|
interface.parent_interface = Some(primary.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interfaces
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
|
impl Collector for NetworkCollector {
|
||||||
|
async fn collect_structured(&self, agent_data: &mut AgentData) -> Result<(), CollectorError> {
|
||||||
|
debug!("Collecting network interface data");
|
||||||
|
|
||||||
|
// Collect all network interfaces
|
||||||
|
let interfaces = self.collect_interfaces().await;
|
||||||
|
|
||||||
|
agent_data.system.network.interfaces = interfaces;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,21 +5,18 @@ use std::process::Command;
|
|||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
use super::{Collector, CollectorError};
|
use super::{Collector, CollectorError};
|
||||||
use crate::config::NixOSConfig;
|
|
||||||
|
|
||||||
/// NixOS system information collector with structured data output
|
/// NixOS system information collector with structured data output
|
||||||
///
|
///
|
||||||
/// This collector gathers NixOS-specific information like:
|
/// This collector gathers NixOS-specific information like:
|
||||||
/// - System generation/build information
|
/// - System generation/build information
|
||||||
/// - Version information
|
/// - Version information
|
||||||
/// - Agent version from Nix store path
|
/// - Agent version from Nix store path
|
||||||
pub struct NixOSCollector {
|
pub struct NixOSCollector;
|
||||||
config: NixOSConfig,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl NixOSCollector {
|
impl NixOSCollector {
|
||||||
pub fn new(config: NixOSConfig) -> Self {
|
pub fn new(_config: crate::config::NixOSConfig) -> Self {
|
||||||
Self { config }
|
Self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Collect NixOS system information and populate AgentData
|
/// Collect NixOS system information and populate AgentData
|
||||||
@@ -46,8 +43,8 @@ impl NixOSCollector {
|
|||||||
match fs::read_to_string("/etc/hostname") {
|
match fs::read_to_string("/etc/hostname") {
|
||||||
Ok(hostname) => Some(hostname.trim().to_string()),
|
Ok(hostname) => Some(hostname.trim().to_string()),
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
// Fallback to hostname command
|
// Fallback to hostname command (with 2 second timeout)
|
||||||
match Command::new("hostname").output() {
|
match Command::new("timeout").args(["2", "hostname"]).output() {
|
||||||
Ok(output) => Some(String::from_utf8_lossy(&output.stdout).trim().to_string()),
|
Ok(output) => Some(String::from_utf8_lossy(&output.stdout).trim().to_string()),
|
||||||
Err(_) => None,
|
Err(_) => None,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,10 @@ use cm_dashboard_shared::{AgentData, ServiceData, SubServiceData, SubServiceMetr
|
|||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::sync::RwLock;
|
use std::sync::RwLock;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
use tracing::debug;
|
use tracing::{debug, warn};
|
||||||
|
use bollard::Docker;
|
||||||
|
use bollard::container::ListContainersOptions;
|
||||||
|
use zbus::Connection;
|
||||||
|
|
||||||
use super::{Collector, CollectorError};
|
use super::{Collector, CollectorError};
|
||||||
use crate::config::SystemdConfig;
|
use crate::config::SystemdConfig;
|
||||||
@@ -22,8 +25,6 @@ pub struct SystemdCollector {
|
|||||||
struct ServiceCacheState {
|
struct ServiceCacheState {
|
||||||
/// Last collection time for performance tracking
|
/// Last collection time for performance tracking
|
||||||
last_collection: Option<Instant>,
|
last_collection: Option<Instant>,
|
||||||
/// Cached service data
|
|
||||||
services: Vec<ServiceInfo>,
|
|
||||||
/// Cached complete service data with sub-services
|
/// Cached complete service data with sub-services
|
||||||
cached_service_data: Vec<ServiceData>,
|
cached_service_data: Vec<ServiceData>,
|
||||||
/// Interesting services to monitor (cached after discovery)
|
/// Interesting services to monitor (cached after discovery)
|
||||||
@@ -50,20 +51,10 @@ struct ServiceStatusInfo {
|
|||||||
sub_state: String,
|
sub_state: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Internal service information
|
|
||||||
#[derive(Debug, Clone)]
|
|
||||||
struct ServiceInfo {
|
|
||||||
name: String,
|
|
||||||
status: String, // "active", "inactive", "failed", etc.
|
|
||||||
memory_mb: f32, // Memory usage in MB
|
|
||||||
disk_gb: f32, // Disk usage in GB
|
|
||||||
}
|
|
||||||
|
|
||||||
impl SystemdCollector {
|
impl SystemdCollector {
|
||||||
pub fn new(config: SystemdConfig) -> Self {
|
pub fn new(config: SystemdConfig) -> Self {
|
||||||
let state = ServiceCacheState {
|
let state = ServiceCacheState {
|
||||||
last_collection: None,
|
last_collection: None,
|
||||||
services: Vec::new(),
|
|
||||||
cached_service_data: Vec::new(),
|
cached_service_data: Vec::new(),
|
||||||
monitored_services: Vec::new(),
|
monitored_services: Vec::new(),
|
||||||
service_status_cache: std::collections::HashMap::new(),
|
service_status_cache: std::collections::HashMap::new(),
|
||||||
@@ -73,7 +64,7 @@ impl SystemdCollector {
|
|||||||
last_nginx_check_time: None,
|
last_nginx_check_time: None,
|
||||||
nginx_check_interval_seconds: config.nginx_check_interval_seconds,
|
nginx_check_interval_seconds: config.nginx_check_interval_seconds,
|
||||||
};
|
};
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
state: RwLock::new(state),
|
state: RwLock::new(state),
|
||||||
config,
|
config,
|
||||||
@@ -86,7 +77,7 @@ impl SystemdCollector {
|
|||||||
debug!("Collecting systemd services metrics");
|
debug!("Collecting systemd services metrics");
|
||||||
|
|
||||||
// Get cached services (discovery only happens when needed)
|
// Get cached services (discovery only happens when needed)
|
||||||
let monitored_services = match self.get_monitored_services() {
|
let monitored_services = match self.get_monitored_services().await {
|
||||||
Ok(services) => services,
|
Ok(services) => services,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
debug!("Failed to get monitored services: {}", e);
|
debug!("Failed to get monitored services: {}", e);
|
||||||
@@ -95,7 +86,6 @@ impl SystemdCollector {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Collect service data for each monitored service
|
// Collect service data for each monitored service
|
||||||
let mut services = Vec::new();
|
|
||||||
let mut complete_service_data = Vec::new();
|
let mut complete_service_data = Vec::new();
|
||||||
for service_name in &monitored_services {
|
for service_name in &monitored_services {
|
||||||
match self.get_service_status(service_name) {
|
match self.get_service_status(service_name) {
|
||||||
@@ -107,7 +97,7 @@ impl SystemdCollector {
|
|||||||
|
|
||||||
// Sub-service metrics for specific services (always include cached results)
|
// Sub-service metrics for specific services (always include cached results)
|
||||||
if service_name.contains("nginx") && active_status == "active" {
|
if service_name.contains("nginx") && active_status == "active" {
|
||||||
let nginx_sites = self.get_nginx_site_metrics();
|
let nginx_sites = self.get_nginx_site_metrics().await;
|
||||||
for (site_name, latency_ms) in nginx_sites {
|
for (site_name, latency_ms) in nginx_sites {
|
||||||
let site_status = if latency_ms >= 0.0 && latency_ms < self.config.nginx_latency_critical_ms {
|
let site_status = if latency_ms >= 0.0 && latency_ms < self.config.nginx_latency_critical_ms {
|
||||||
"active"
|
"active"
|
||||||
@@ -126,33 +116,45 @@ impl SystemdCollector {
|
|||||||
name: site_name.clone(),
|
name: site_name.clone(),
|
||||||
service_status: self.calculate_service_status(&site_name, &site_status),
|
service_status: self.calculate_service_status(&site_name, &site_status),
|
||||||
metrics,
|
metrics,
|
||||||
|
service_type: "nginx_site".to_string(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if service_name.contains("docker") && active_status == "active" {
|
if service_name.contains("docker") && active_status == "active" {
|
||||||
let docker_containers = self.get_docker_containers();
|
let docker_containers = self.get_docker_containers().await;
|
||||||
for (container_name, container_status) in docker_containers {
|
for (container_name, container_status) in docker_containers {
|
||||||
// For now, docker containers have no additional metrics
|
// For now, docker containers have no additional metrics
|
||||||
// Future: could add memory_mb, cpu_percent, restart_count, etc.
|
// Future: could add memory_mb, cpu_percent, restart_count, etc.
|
||||||
let metrics = Vec::new();
|
let metrics = Vec::new();
|
||||||
|
|
||||||
sub_services.push(SubServiceData {
|
sub_services.push(SubServiceData {
|
||||||
name: container_name.clone(),
|
name: container_name.clone(),
|
||||||
service_status: self.calculate_service_status(&container_name, &container_status),
|
service_status: self.calculate_service_status(&container_name, &container_status),
|
||||||
metrics,
|
metrics,
|
||||||
|
service_type: "container".to_string(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add Docker images
|
||||||
|
let docker_images = self.get_docker_images().await;
|
||||||
|
for (image_name, image_status, image_size_mb) in docker_images {
|
||||||
|
let mut metrics = Vec::new();
|
||||||
|
metrics.push(SubServiceMetric {
|
||||||
|
label: "size".to_string(),
|
||||||
|
value: image_size_mb,
|
||||||
|
unit: Some("MB".to_string()),
|
||||||
|
});
|
||||||
|
|
||||||
|
sub_services.push(SubServiceData {
|
||||||
|
name: image_name.to_string(),
|
||||||
|
service_status: self.calculate_service_status(&image_name, &image_status),
|
||||||
|
metrics,
|
||||||
|
service_type: "image".to_string(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let service_info = ServiceInfo {
|
|
||||||
name: service_name.clone(),
|
|
||||||
status: active_status.clone(),
|
|
||||||
memory_mb,
|
|
||||||
disk_gb,
|
|
||||||
};
|
|
||||||
services.push(service_info);
|
|
||||||
|
|
||||||
// Create complete service data
|
// Create complete service data
|
||||||
let service_data = ServiceData {
|
let service_data = ServiceData {
|
||||||
name: service_name.clone(),
|
name: service_name.clone(),
|
||||||
@@ -172,12 +174,15 @@ impl SystemdCollector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sort services alphabetically by name
|
||||||
|
agent_data.services.sort_by(|a, b| a.name.cmp(&b.name));
|
||||||
|
complete_service_data.sort_by(|a, b| a.name.cmp(&b.name));
|
||||||
|
|
||||||
// Update cached state
|
// Update cached state
|
||||||
{
|
{
|
||||||
let mut state = self.state.write().unwrap();
|
let mut state = self.state.write().unwrap();
|
||||||
state.last_collection = Some(start_time);
|
state.last_collection = Some(start_time);
|
||||||
state.services = services;
|
|
||||||
state.cached_service_data = complete_service_data;
|
state.cached_service_data = complete_service_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,7 +193,7 @@ impl SystemdCollector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get monitored services, discovering them if needed or cache is expired
|
/// Get monitored services, discovering them if needed or cache is expired
|
||||||
fn get_monitored_services(&self) -> Result<Vec<String>> {
|
async fn get_monitored_services(&self) -> Result<Vec<String>> {
|
||||||
// Check if we need discovery without holding the lock
|
// Check if we need discovery without holding the lock
|
||||||
let needs_discovery = {
|
let needs_discovery = {
|
||||||
let state = self.state.read().unwrap();
|
let state = self.state.read().unwrap();
|
||||||
@@ -203,7 +208,7 @@ impl SystemdCollector {
|
|||||||
|
|
||||||
if needs_discovery {
|
if needs_discovery {
|
||||||
debug!("Discovering systemd services (cache expired or first run)");
|
debug!("Discovering systemd services (cache expired or first run)");
|
||||||
match self.discover_services_internal() {
|
match self.discover_services_internal().await {
|
||||||
Ok((services, status_cache)) => {
|
Ok((services, status_cache)) => {
|
||||||
if let Ok(mut state) = self.state.write() {
|
if let Ok(mut state) = self.state.write() {
|
||||||
state.monitored_services = services.clone();
|
state.monitored_services = services.clone();
|
||||||
@@ -226,44 +231,52 @@ impl SystemdCollector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get nginx site metrics, checking them if cache is expired (like old working version)
|
/// Get nginx site metrics, checking them if cache is expired (like old working version)
|
||||||
fn get_nginx_site_metrics(&self) -> Vec<(String, f32)> {
|
async fn get_nginx_site_metrics(&self) -> Vec<(String, f32)> {
|
||||||
let mut state = self.state.write().unwrap();
|
// Check if we need to refresh (read lock)
|
||||||
|
let needs_refresh = {
|
||||||
// Check if we need to refresh nginx site metrics
|
let state = self.state.read().unwrap();
|
||||||
let needs_refresh = match state.last_nginx_check_time {
|
match state.last_nginx_check_time {
|
||||||
None => true, // First time
|
None => true,
|
||||||
Some(last_time) => {
|
Some(last_time) => {
|
||||||
let elapsed = last_time.elapsed().as_secs();
|
let elapsed = last_time.elapsed().as_secs();
|
||||||
elapsed >= state.nginx_check_interval_seconds
|
elapsed >= state.nginx_check_interval_seconds
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if needs_refresh {
|
if needs_refresh {
|
||||||
// Only check nginx sites if nginx service is active
|
// Check if nginx is active (read lock)
|
||||||
if state.monitored_services.iter().any(|s| s.contains("nginx")) {
|
let has_nginx = {
|
||||||
let fresh_metrics = self.get_nginx_sites_internal();
|
let state = self.state.read().unwrap();
|
||||||
|
state.monitored_services.iter().any(|s| s.contains("nginx"))
|
||||||
|
};
|
||||||
|
|
||||||
|
if has_nginx {
|
||||||
|
let fresh_metrics = self.get_nginx_sites_internal().await;
|
||||||
|
let mut state = self.state.write().unwrap();
|
||||||
state.nginx_site_metrics = fresh_metrics;
|
state.nginx_site_metrics = fresh_metrics;
|
||||||
state.last_nginx_check_time = Some(Instant::now());
|
state.last_nginx_check_time = Some(Instant::now());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let state = self.state.read().unwrap();
|
||||||
state.nginx_site_metrics.clone()
|
state.nginx_site_metrics.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Auto-discover interesting services to monitor
|
/// Auto-discover interesting services to monitor using systemctl
|
||||||
fn discover_services_internal(&self) -> Result<(Vec<String>, std::collections::HashMap<String, ServiceStatusInfo>)> {
|
async fn discover_services_internal(&self) -> Result<(Vec<String>, std::collections::HashMap<String, ServiceStatusInfo>)> {
|
||||||
// First: Get all service unit files
|
// First: Get all service unit files (with 3 second timeout)
|
||||||
let unit_files_output = Command::new("systemctl")
|
let unit_files_output = Command::new("timeout")
|
||||||
.args(&["list-unit-files", "--type=service", "--no-pager", "--plain"])
|
.args(&["3", "systemctl", "list-unit-files", "--type=service", "--no-pager", "--plain"])
|
||||||
.output()?;
|
.output()?;
|
||||||
|
|
||||||
if !unit_files_output.status.success() {
|
if !unit_files_output.status.success() {
|
||||||
return Err(anyhow::anyhow!("systemctl list-unit-files command failed"));
|
return Err(anyhow::anyhow!("systemctl list-unit-files command failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Second: Get runtime status of all units
|
// Second: Get runtime status of all units (with 3 second timeout)
|
||||||
let units_status_output = Command::new("systemctl")
|
let units_status_output = Command::new("timeout")
|
||||||
.args(&["list-units", "--type=service", "--all", "--no-pager", "--plain"])
|
.args(&["3", "systemctl", "list-units", "--type=service", "--all", "--no-pager", "--plain"])
|
||||||
.output()?;
|
.output()?;
|
||||||
|
|
||||||
if !units_status_output.status.success() {
|
if !units_status_output.status.success() {
|
||||||
@@ -343,9 +356,9 @@ impl SystemdCollector {
|
|||||||
Ok((services, status_cache))
|
Ok((services, status_cache))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get service status from cache (if available) or fallback to systemctl
|
/// Get service status from D-Bus cache
|
||||||
fn get_service_status(&self, service: &str) -> Result<(String, String)> {
|
fn get_service_status(&self, service: &str) -> Result<(String, String)> {
|
||||||
// Try to get status from cache first
|
// Get status from D-Bus cache (populated by discover_services_internal)
|
||||||
if let Ok(state) = self.state.read() {
|
if let Ok(state) = self.state.read() {
|
||||||
if let Some(cached_info) = state.service_status_cache.get(service) {
|
if let Some(cached_info) = state.service_status_cache.get(service) {
|
||||||
let active_status = cached_info.active_state.clone();
|
let active_status = cached_info.active_state.clone();
|
||||||
@@ -359,20 +372,45 @@ impl SystemdCollector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback to systemctl if not in cache
|
// Service not found in D-Bus cache - treat as inactive
|
||||||
let output = Command::new("systemctl")
|
Ok(("inactive".to_string(), "LoadState=not-found\nActiveState=inactive\nSubState=dead".to_string()))
|
||||||
.args(&["is-active", &format!("{}.service", service)])
|
}
|
||||||
.output()?;
|
|
||||||
|
|
||||||
let active_status = String::from_utf8(output.stdout)?.trim().to_string();
|
/// Get a unit property via D-Bus
|
||||||
|
async fn get_unit_property(&self, service_name: &str, property: &str) -> Option<zbus::zvariant::OwnedValue> {
|
||||||
|
// Connect to system D-Bus
|
||||||
|
let connection = Connection::system().await.ok()?;
|
||||||
|
|
||||||
// Get more detailed info
|
// Get systemd manager proxy
|
||||||
let output = Command::new("systemctl")
|
let manager_proxy = zbus::Proxy::new(
|
||||||
.args(&["show", &format!("{}.service", service), "--property=LoadState,ActiveState,SubState"])
|
&connection,
|
||||||
.output()?;
|
"org.freedesktop.systemd1",
|
||||||
|
"/org/freedesktop/systemd1",
|
||||||
|
"org.freedesktop.systemd1.Manager",
|
||||||
|
).await.ok()?;
|
||||||
|
|
||||||
let detailed_info = String::from_utf8(output.stdout)?;
|
// Get unit path for service
|
||||||
Ok((active_status, detailed_info))
|
let unit_name = format!("{}.service", service_name);
|
||||||
|
let unit_path: zbus::zvariant::OwnedObjectPath = manager_proxy
|
||||||
|
.call("GetUnit", &(unit_name,))
|
||||||
|
.await
|
||||||
|
.ok()?;
|
||||||
|
|
||||||
|
// Get property using standard D-Bus Properties interface
|
||||||
|
let prop_proxy = zbus::Proxy::new(
|
||||||
|
&connection,
|
||||||
|
"org.freedesktop.systemd1",
|
||||||
|
unit_path.as_str(),
|
||||||
|
"org.freedesktop.DBus.Properties",
|
||||||
|
).await.ok()?;
|
||||||
|
|
||||||
|
// Try Service interface first, fallback to Unit interface
|
||||||
|
// Get returns a Variant, we need to extract the inner value
|
||||||
|
if let Ok(variant) = prop_proxy.call("Get", &("org.freedesktop.systemd1.Service", property)).await {
|
||||||
|
return Some(variant);
|
||||||
|
}
|
||||||
|
|
||||||
|
prop_proxy.call("Get", &("org.freedesktop.systemd1.Unit", property)).await.ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if service name matches pattern (supports wildcards like nginx*)
|
/// Check if service name matches pattern (supports wildcards like nginx*)
|
||||||
@@ -420,7 +458,7 @@ impl SystemdCollector {
|
|||||||
if let Some(dirs) = self.config.service_directories.get(service_name) {
|
if let Some(dirs) = self.config.service_directories.get(service_name) {
|
||||||
// Service has configured paths - use the first accessible one
|
// Service has configured paths - use the first accessible one
|
||||||
for dir in dirs {
|
for dir in dirs {
|
||||||
if let Some(size) = self.get_directory_size(dir) {
|
if let Some(size) = self.get_directory_size(dir).await {
|
||||||
return Ok(size);
|
return Ok(size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -428,21 +466,12 @@ impl SystemdCollector {
|
|||||||
return Ok(0.0);
|
return Ok(0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// No configured path - try to get WorkingDirectory from systemctl
|
// No configured path - try to get WorkingDirectory from D-Bus
|
||||||
let output = Command::new("systemctl")
|
if let Some(value) = self.get_unit_property(service_name, "WorkingDirectory").await {
|
||||||
.args(&["show", &format!("{}.service", service_name), "--property=WorkingDirectory"])
|
// WorkingDirectory is a string property - try to extract as string
|
||||||
.output()
|
if let Ok(dir_str) = <String>::try_from(value) {
|
||||||
.map_err(|e| CollectorError::SystemRead {
|
if !dir_str.is_empty() && dir_str != "/" && dir_str != "[not set]" {
|
||||||
path: format!("WorkingDirectory for {}", service_name),
|
return Ok(self.get_directory_size(&dir_str).await.unwrap_or(0.0));
|
||||||
error: e.to_string(),
|
|
||||||
})?;
|
|
||||||
|
|
||||||
let output_str = String::from_utf8_lossy(&output.stdout);
|
|
||||||
for line in output_str.lines() {
|
|
||||||
if line.starts_with("WorkingDirectory=") && !line.contains("[not set]") {
|
|
||||||
let dir = line.strip_prefix("WorkingDirectory=").unwrap_or("");
|
|
||||||
if !dir.is_empty() && dir != "/" {
|
|
||||||
return Ok(self.get_directory_size(dir).unwrap_or(0.0));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -450,18 +479,23 @@ impl SystemdCollector {
|
|||||||
Ok(0.0)
|
Ok(0.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get size of a directory in GB
|
/// Get size of a directory in GB (with 2 second timeout)
|
||||||
fn get_directory_size(&self, path: &str) -> Option<f32> {
|
async fn get_directory_size(&self, path: &str) -> Option<f32> {
|
||||||
let output = Command::new("sudo")
|
use super::run_command_with_timeout;
|
||||||
.args(&["du", "-sb", path])
|
|
||||||
.output()
|
// Use -s (summary) and --apparent-size for speed, 2 second timeout
|
||||||
.ok()?;
|
let mut cmd = Command::new("sudo");
|
||||||
|
cmd.args(&["du", "-s", "--apparent-size", "--block-size=1", path]);
|
||||||
|
|
||||||
|
let output = run_command_with_timeout(cmd, 2).await.ok()?;
|
||||||
|
|
||||||
if !output.status.success() {
|
if !output.status.success() {
|
||||||
// Log permission errors for debugging but don't spam logs
|
// Log permission errors for debugging but don't spam logs
|
||||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||||
if stderr.contains("Permission denied") {
|
if stderr.contains("Permission denied") {
|
||||||
debug!("Permission denied accessing directory: {}", path);
|
debug!("Permission denied accessing directory: {}", path);
|
||||||
|
} else if stderr.contains("timed out") {
|
||||||
|
warn!("Directory size check timed out for {}", path);
|
||||||
} else {
|
} else {
|
||||||
debug!("Failed to get size for directory {}: {}", path, stderr);
|
debug!("Failed to get size for directory {}: {}", path, stderr);
|
||||||
}
|
}
|
||||||
@@ -483,25 +517,6 @@ impl SystemdCollector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get service memory usage (if available)
|
|
||||||
fn get_service_memory(&self, service: &str) -> Option<f32> {
|
|
||||||
let output = Command::new("systemctl")
|
|
||||||
.args(&["show", &format!("{}.service", service), "--property=MemoryCurrent"])
|
|
||||||
.output()
|
|
||||||
.ok()?;
|
|
||||||
|
|
||||||
let output_str = String::from_utf8(output.stdout).ok()?;
|
|
||||||
for line in output_str.lines() {
|
|
||||||
if line.starts_with("MemoryCurrent=") {
|
|
||||||
let memory_str = line.strip_prefix("MemoryCurrent=")?;
|
|
||||||
if let Ok(memory_bytes) = memory_str.parse::<u64>() {
|
|
||||||
return Some(memory_bytes as f32 / (1024.0 * 1024.0)); // Convert to MB
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Calculate service status, taking user-stopped services into account
|
/// Calculate service status, taking user-stopped services into account
|
||||||
fn calculate_service_status(&self, service_name: &str, active_status: &str) -> Status {
|
fn calculate_service_status(&self, service_name: &str, active_status: &str) -> Status {
|
||||||
match active_status.to_lowercase().as_str() {
|
match active_status.to_lowercase().as_str() {
|
||||||
@@ -519,27 +534,13 @@ impl SystemdCollector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get memory usage for a specific service
|
/// Get memory usage for a specific service via D-Bus
|
||||||
async fn get_service_memory_usage(&self, service_name: &str) -> Result<f32, CollectorError> {
|
async fn get_service_memory_usage(&self, service_name: &str) -> Result<f32, CollectorError> {
|
||||||
let output = Command::new("systemctl")
|
// Get MemoryCurrent property from D-Bus
|
||||||
.args(&["show", &format!("{}.service", service_name), "--property=MemoryCurrent"])
|
if let Some(value) = self.get_unit_property(service_name, "MemoryCurrent").await {
|
||||||
.output()
|
// MemoryCurrent is a u64 property (bytes) - try to extract
|
||||||
.map_err(|e| CollectorError::SystemRead {
|
if let Ok(memory_bytes) = <u64>::try_from(value) {
|
||||||
path: format!("memory usage for {}", service_name),
|
return Ok(memory_bytes as f32 / (1024.0 * 1024.0)); // Convert to MB
|
||||||
error: e.to_string(),
|
|
||||||
})?;
|
|
||||||
|
|
||||||
let output_str = String::from_utf8_lossy(&output.stdout);
|
|
||||||
|
|
||||||
for line in output_str.lines() {
|
|
||||||
if line.starts_with("MemoryCurrent=") {
|
|
||||||
if let Some(mem_str) = line.strip_prefix("MemoryCurrent=") {
|
|
||||||
if mem_str != "[not set]" {
|
|
||||||
if let Ok(memory_bytes) = mem_str.parse::<u64>() {
|
|
||||||
return Ok(memory_bytes as f32 / (1024.0 * 1024.0)); // Convert to MB
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -549,26 +550,16 @@ impl SystemdCollector {
|
|||||||
/// Check if service collection cache should be updated
|
/// Check if service collection cache should be updated
|
||||||
fn should_update_cache(&self) -> bool {
|
fn should_update_cache(&self) -> bool {
|
||||||
let state = self.state.read().unwrap();
|
let state = self.state.read().unwrap();
|
||||||
|
|
||||||
match state.last_collection {
|
match state.last_collection {
|
||||||
None => true,
|
None => true,
|
||||||
Some(last) => {
|
Some(last) => {
|
||||||
let cache_duration = std::time::Duration::from_secs(30);
|
let cache_duration = std::time::Duration::from_secs(self.config.interval_seconds);
|
||||||
last.elapsed() > cache_duration
|
last.elapsed() > cache_duration
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get cached service data if available and fresh
|
|
||||||
fn get_cached_services(&self) -> Option<Vec<ServiceInfo>> {
|
|
||||||
if !self.should_update_cache() {
|
|
||||||
let state = self.state.read().unwrap();
|
|
||||||
Some(state.services.clone())
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get cached complete service data with sub-services if available and fresh
|
/// Get cached complete service data with sub-services if available and fresh
|
||||||
fn get_cached_complete_services(&self) -> Option<Vec<ServiceData>> {
|
fn get_cached_complete_services(&self) -> Option<Vec<ServiceData>> {
|
||||||
if !self.should_update_cache() {
|
if !self.should_update_cache() {
|
||||||
@@ -580,11 +571,11 @@ impl SystemdCollector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get nginx sites with latency checks (internal - no caching)
|
/// Get nginx sites with latency checks (internal - no caching)
|
||||||
fn get_nginx_sites_internal(&self) -> Vec<(String, f32)> {
|
async fn get_nginx_sites_internal(&self) -> Vec<(String, f32)> {
|
||||||
let mut sites = Vec::new();
|
let mut sites = Vec::new();
|
||||||
|
|
||||||
// Discover nginx sites from configuration
|
// Discover nginx sites from configuration
|
||||||
let discovered_sites = self.discover_nginx_sites();
|
let discovered_sites = self.discover_nginx_sites().await;
|
||||||
|
|
||||||
// Always add all discovered sites, even if checks fail (like old version)
|
// Always add all discovered sites, even if checks fail (like old version)
|
||||||
for (site_name, url) in &discovered_sites {
|
for (site_name, url) in &discovered_sites {
|
||||||
@@ -603,9 +594,9 @@ impl SystemdCollector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Discover nginx sites from configuration
|
/// Discover nginx sites from configuration
|
||||||
fn discover_nginx_sites(&self) -> Vec<(String, String)> {
|
async fn discover_nginx_sites(&self) -> Vec<(String, String)> {
|
||||||
// Use the same approach as the old working agent: get nginx config from systemd
|
// Use the same approach as the old working agent: get nginx config from systemd
|
||||||
let config_content = match self.get_nginx_config_from_systemd() {
|
let config_content = match self.get_nginx_config_from_systemd().await {
|
||||||
Some(content) => content,
|
Some(content) => content,
|
||||||
None => {
|
None => {
|
||||||
debug!("Could not get nginx config from systemd, trying nginx -T fallback");
|
debug!("Could not get nginx config from systemd, trying nginx -T fallback");
|
||||||
@@ -638,30 +629,20 @@ impl SystemdCollector {
|
|||||||
Some(String::from_utf8_lossy(&output.stdout).to_string())
|
Some(String::from_utf8_lossy(&output.stdout).to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get nginx config from systemd service definition (NixOS compatible)
|
/// Get nginx config from systemd service definition via D-Bus (NixOS compatible)
|
||||||
fn get_nginx_config_from_systemd(&self) -> Option<String> {
|
async fn get_nginx_config_from_systemd(&self) -> Option<String> {
|
||||||
let output = Command::new("systemctl")
|
// Get ExecStart property from D-Bus
|
||||||
.args(&["show", "nginx", "--property=ExecStart", "--no-pager"])
|
let value = self.get_unit_property("nginx", "ExecStart").await?;
|
||||||
.output()
|
|
||||||
.ok()?;
|
|
||||||
|
|
||||||
if !output.status.success() {
|
// ExecStart is a complex structure: array of (path, args, unclean_exit)
|
||||||
debug!("Failed to get nginx ExecStart from systemd");
|
// For our purposes, we need to extract the command line
|
||||||
return None;
|
let exec_start_str = format!("{:?}", value);
|
||||||
}
|
debug!("nginx ExecStart from D-Bus: {}", exec_start_str);
|
||||||
|
|
||||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
// Extract config path from ExecStart structure
|
||||||
debug!("systemctl show nginx output: {}", stdout);
|
if let Some(config_path) = self.extract_config_path_from_exec_start(&exec_start_str) {
|
||||||
|
debug!("Extracted config path: {}", config_path);
|
||||||
// Parse ExecStart to extract -c config path
|
return std::fs::read_to_string(&config_path).ok();
|
||||||
for line in stdout.lines() {
|
|
||||||
if line.starts_with("ExecStart=") {
|
|
||||||
debug!("Found ExecStart line: {}", line);
|
|
||||||
if let Some(config_path) = self.extract_config_path_from_exec_start(line) {
|
|
||||||
debug!("Extracted config path: {}", config_path);
|
|
||||||
return std::fs::read_to_string(&config_path).ok();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
None
|
None
|
||||||
@@ -803,49 +784,99 @@ impl SystemdCollector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get docker containers as sub-services
|
/// Get docker containers as sub-services using bollard API
|
||||||
fn get_docker_containers(&self) -> Vec<(String, String)> {
|
async fn get_docker_containers(&self) -> Vec<(String, String)> {
|
||||||
let mut containers = Vec::new();
|
let mut containers = Vec::new();
|
||||||
|
|
||||||
// Check if docker is available
|
// Connect to Docker daemon
|
||||||
let output = Command::new("docker")
|
let docker = match Docker::connect_with_local_defaults() {
|
||||||
.args(&["ps", "--format", "{{.Names}},{{.Status}}"])
|
Ok(d) => d,
|
||||||
.output();
|
Err(e) => {
|
||||||
|
debug!("Failed to connect to Docker daemon: {}", e);
|
||||||
let output = match output {
|
return containers;
|
||||||
Ok(out) if out.status.success() => out,
|
}
|
||||||
_ => return containers, // Docker not available or failed
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let output_str = match String::from_utf8(output.stdout) {
|
// List all containers (running and stopped)
|
||||||
Ok(s) => s,
|
let list_options = Some(ListContainersOptions::<String> {
|
||||||
Err(_) => return containers,
|
all: true,
|
||||||
|
..Default::default()
|
||||||
|
});
|
||||||
|
|
||||||
|
let container_list = match docker.list_containers(list_options).await {
|
||||||
|
Ok(list) => list,
|
||||||
|
Err(e) => {
|
||||||
|
debug!("Failed to list Docker containers: {}", e);
|
||||||
|
return containers;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
for line in output_str.lines() {
|
for container in container_list {
|
||||||
if line.trim().is_empty() {
|
// Get container name (remove leading slash if present)
|
||||||
continue;
|
let container_name = container.names
|
||||||
}
|
.and_then(|names| names.first().map(|n| n.trim_start_matches('/').to_string()))
|
||||||
|
.unwrap_or_else(|| container.id.clone().unwrap_or_default());
|
||||||
|
|
||||||
let parts: Vec<&str> = line.split(',').collect();
|
// Map container state to service status
|
||||||
if parts.len() >= 2 {
|
let container_status = match container.state.as_deref() {
|
||||||
let container_name = parts[0].trim();
|
Some("running") => "active",
|
||||||
let status_str = parts[1].trim();
|
Some("exited") | Some("created") => "inactive",
|
||||||
|
_ => "failed", // restarting, paused, dead, etc.
|
||||||
|
};
|
||||||
|
|
||||||
let container_status = if status_str.contains("Up") {
|
containers.push((format!("docker_{}", container_name), container_status.to_string()));
|
||||||
"active"
|
|
||||||
} else if status_str.contains("Exited") {
|
|
||||||
"warning" // Match original: Exited → Warning, not inactive
|
|
||||||
} else {
|
|
||||||
"failed" // Other states → failed
|
|
||||||
};
|
|
||||||
|
|
||||||
containers.push((format!("docker_{}", container_name), container_status.to_string()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
containers
|
containers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get docker images as sub-services using bollard API
|
||||||
|
async fn get_docker_images(&self) -> Vec<(String, String, f32)> {
|
||||||
|
let mut images = Vec::new();
|
||||||
|
|
||||||
|
// Connect to Docker daemon
|
||||||
|
let docker = match Docker::connect_with_local_defaults() {
|
||||||
|
Ok(d) => d,
|
||||||
|
Err(e) => {
|
||||||
|
debug!("Failed to connect to Docker daemon: {}", e);
|
||||||
|
return images;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// List all images
|
||||||
|
let image_list = match docker.list_images::<String>(None).await {
|
||||||
|
Ok(list) => list,
|
||||||
|
Err(e) => {
|
||||||
|
debug!("Failed to list Docker images: {}", e);
|
||||||
|
return images;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
for image in image_list {
|
||||||
|
// Get image name from repo tags
|
||||||
|
let image_names: Vec<String> = image.repo_tags
|
||||||
|
.into_iter()
|
||||||
|
.filter(|tag| !tag.contains("<none>"))
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
if image_names.is_empty() {
|
||||||
|
continue; // Skip untagged images
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get size in MB
|
||||||
|
let size_mb = image.size as f32 / (1024.0 * 1024.0);
|
||||||
|
|
||||||
|
for image_name in image_names {
|
||||||
|
images.push((
|
||||||
|
image_name,
|
||||||
|
"inactive".to_string(), // Images are informational - use inactive for neutral display
|
||||||
|
size_mb
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
images
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
|
|||||||
@@ -5,10 +5,9 @@ use zmq::{Context, Socket, SocketType};
|
|||||||
|
|
||||||
use crate::config::ZmqConfig;
|
use crate::config::ZmqConfig;
|
||||||
|
|
||||||
/// ZMQ communication handler for publishing metrics and receiving commands
|
/// ZMQ communication handler for publishing metrics
|
||||||
pub struct ZmqHandler {
|
pub struct ZmqHandler {
|
||||||
publisher: Socket,
|
publisher: Socket,
|
||||||
command_receiver: Socket,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ZmqHandler {
|
impl ZmqHandler {
|
||||||
@@ -26,20 +25,8 @@ impl ZmqHandler {
|
|||||||
publisher.set_sndhwm(1000)?; // High water mark for outbound messages
|
publisher.set_sndhwm(1000)?; // High water mark for outbound messages
|
||||||
publisher.set_linger(1000)?; // Linger time on close
|
publisher.set_linger(1000)?; // Linger time on close
|
||||||
|
|
||||||
// Create command receiver socket (PULL socket to receive commands from dashboard)
|
|
||||||
let command_receiver = context.socket(SocketType::PULL)?;
|
|
||||||
let cmd_bind_address = format!("tcp://{}:{}", config.bind_address, config.command_port);
|
|
||||||
command_receiver.bind(&cmd_bind_address)?;
|
|
||||||
|
|
||||||
info!("ZMQ command receiver bound to {}", cmd_bind_address);
|
|
||||||
|
|
||||||
// Set non-blocking mode for command receiver
|
|
||||||
command_receiver.set_rcvtimeo(0)?; // Non-blocking receive
|
|
||||||
command_receiver.set_linger(1000)?;
|
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
publisher,
|
publisher,
|
||||||
command_receiver,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,36 +52,4 @@ impl ZmqHandler {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Try to receive a command (non-blocking)
|
|
||||||
pub fn try_receive_command(&self) -> Result<Option<AgentCommand>> {
|
|
||||||
match self.command_receiver.recv_bytes(zmq::DONTWAIT) {
|
|
||||||
Ok(bytes) => {
|
|
||||||
debug!("Received command message ({} bytes)", bytes.len());
|
|
||||||
|
|
||||||
let command: AgentCommand = serde_json::from_slice(&bytes)
|
|
||||||
.map_err(|e| anyhow::anyhow!("Failed to deserialize command: {}", e))?;
|
|
||||||
|
|
||||||
debug!("Parsed command: {:?}", command);
|
|
||||||
Ok(Some(command))
|
|
||||||
}
|
|
||||||
Err(zmq::Error::EAGAIN) => {
|
|
||||||
// No message available (non-blocking)
|
|
||||||
Ok(None)
|
|
||||||
}
|
|
||||||
Err(e) => Err(anyhow::anyhow!("ZMQ receive error: {}", e)),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Commands that can be sent to the agent
|
|
||||||
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
|
|
||||||
pub enum AgentCommand {
|
|
||||||
/// Request immediate metric collection
|
|
||||||
CollectNow,
|
|
||||||
/// Change collection interval
|
|
||||||
SetInterval { seconds: u64 },
|
|
||||||
/// Enable/disable a collector
|
|
||||||
ToggleCollector { name: String, enabled: bool },
|
|
||||||
/// Request status/health check
|
|
||||||
Ping,
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
// This file is now empty - all configuration values come from config files
|
|
||||||
// No hardcoded defaults are used
|
|
||||||
@@ -20,7 +20,6 @@ pub struct AgentConfig {
|
|||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct ZmqConfig {
|
pub struct ZmqConfig {
|
||||||
pub publisher_port: u16,
|
pub publisher_port: u16,
|
||||||
pub command_port: u16,
|
|
||||||
pub bind_address: String,
|
pub bind_address: String,
|
||||||
pub transmission_interval_seconds: u64,
|
pub transmission_interval_seconds: u64,
|
||||||
/// Heartbeat transmission interval in seconds for host connectivity detection
|
/// Heartbeat transmission interval in seconds for host connectivity detection
|
||||||
|
|||||||
@@ -7,14 +7,6 @@ pub fn validate_config(config: &AgentConfig) -> Result<()> {
|
|||||||
bail!("ZMQ publisher port cannot be 0");
|
bail!("ZMQ publisher port cannot be 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.zmq.command_port == 0 {
|
|
||||||
bail!("ZMQ command port cannot be 0");
|
|
||||||
}
|
|
||||||
|
|
||||||
if config.zmq.publisher_port == config.zmq.command_port {
|
|
||||||
bail!("ZMQ publisher and command ports cannot be the same");
|
|
||||||
}
|
|
||||||
|
|
||||||
if config.zmq.bind_address.is_empty() {
|
if config.zmq.bind_address.is_empty() {
|
||||||
bail!("ZMQ bind address cannot be empty");
|
bail!("ZMQ bind address cannot be empty");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ mod collectors;
|
|||||||
mod communication;
|
mod communication;
|
||||||
mod config;
|
mod config;
|
||||||
mod notifications;
|
mod notifications;
|
||||||
mod service_tracker;
|
|
||||||
|
|
||||||
use agent::Agent;
|
use agent::Agent;
|
||||||
|
|
||||||
|
|||||||
@@ -1,164 +0,0 @@
|
|||||||
use anyhow::Result;
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use std::collections::HashSet;
|
|
||||||
use std::fs;
|
|
||||||
use std::path::Path;
|
|
||||||
use std::sync::{Arc, Mutex, OnceLock};
|
|
||||||
use tracing::{debug, info, warn};
|
|
||||||
|
|
||||||
/// Shared instance for global access
|
|
||||||
static GLOBAL_TRACKER: OnceLock<Arc<Mutex<UserStoppedServiceTracker>>> = OnceLock::new();
|
|
||||||
|
|
||||||
/// Tracks services that have been stopped by user action
|
|
||||||
/// These services should be treated as OK status instead of Warning
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct UserStoppedServiceTracker {
|
|
||||||
/// Set of services stopped by user action
|
|
||||||
user_stopped_services: HashSet<String>,
|
|
||||||
/// Path to persistent storage file
|
|
||||||
storage_path: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Serializable data structure for persistence
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
|
||||||
struct UserStoppedData {
|
|
||||||
services: Vec<String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl UserStoppedServiceTracker {
|
|
||||||
/// Create new tracker with default storage path
|
|
||||||
pub fn new() -> Self {
|
|
||||||
Self::with_storage_path("/var/lib/cm-dashboard/user-stopped-services.json")
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Initialize global instance (called by agent)
|
|
||||||
pub fn init_global() -> Result<Self> {
|
|
||||||
let tracker = Self::new();
|
|
||||||
|
|
||||||
// Set global instance
|
|
||||||
let global_instance = Arc::new(Mutex::new(tracker));
|
|
||||||
if GLOBAL_TRACKER.set(global_instance).is_err() {
|
|
||||||
warn!("Global service tracker was already initialized");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return a new instance for the agent to use
|
|
||||||
Ok(Self::new())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Check if a service is user-stopped (global access for collectors)
|
|
||||||
pub fn is_service_user_stopped(service_name: &str) -> bool {
|
|
||||||
if let Some(global) = GLOBAL_TRACKER.get() {
|
|
||||||
if let Ok(tracker) = global.lock() {
|
|
||||||
tracker.is_user_stopped(service_name)
|
|
||||||
} else {
|
|
||||||
debug!("Failed to lock global service tracker");
|
|
||||||
false
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
debug!("Global service tracker not initialized");
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Update global tracker (called by agent when tracker state changes)
|
|
||||||
pub fn update_global(updated_tracker: &UserStoppedServiceTracker) {
|
|
||||||
if let Some(global) = GLOBAL_TRACKER.get() {
|
|
||||||
if let Ok(mut tracker) = global.lock() {
|
|
||||||
tracker.user_stopped_services = updated_tracker.user_stopped_services.clone();
|
|
||||||
} else {
|
|
||||||
debug!("Failed to lock global service tracker for update");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
debug!("Global service tracker not initialized for update");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create new tracker with custom storage path
|
|
||||||
pub fn with_storage_path<P: AsRef<Path>>(storage_path: P) -> Self {
|
|
||||||
let storage_path = storage_path.as_ref().to_string_lossy().to_string();
|
|
||||||
let mut tracker = Self {
|
|
||||||
user_stopped_services: HashSet::new(),
|
|
||||||
storage_path,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Load existing data from storage
|
|
||||||
if let Err(e) = tracker.load_from_storage() {
|
|
||||||
warn!("Failed to load user-stopped services from storage: {}", e);
|
|
||||||
info!("Starting with empty user-stopped services list");
|
|
||||||
}
|
|
||||||
|
|
||||||
tracker
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Clear user-stopped flag for a service (when user starts it)
|
|
||||||
pub fn clear_user_stopped(&mut self, service_name: &str) -> Result<()> {
|
|
||||||
if self.user_stopped_services.remove(service_name) {
|
|
||||||
info!("Cleared user-stopped flag for service '{}'", service_name);
|
|
||||||
self.save_to_storage()?;
|
|
||||||
debug!("Service '{}' user-stopped flag cleared and saved to storage", service_name);
|
|
||||||
} else {
|
|
||||||
debug!("Service '{}' was not marked as user-stopped", service_name);
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Check if a service is marked as user-stopped
|
|
||||||
pub fn is_user_stopped(&self, service_name: &str) -> bool {
|
|
||||||
let is_stopped = self.user_stopped_services.contains(service_name);
|
|
||||||
debug!("Service '{}' user-stopped status: {}", service_name, is_stopped);
|
|
||||||
is_stopped
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Save current state to persistent storage
|
|
||||||
fn save_to_storage(&self) -> Result<()> {
|
|
||||||
// Create parent directory if it doesn't exist
|
|
||||||
if let Some(parent_dir) = Path::new(&self.storage_path).parent() {
|
|
||||||
if !parent_dir.exists() {
|
|
||||||
fs::create_dir_all(parent_dir)?;
|
|
||||||
debug!("Created parent directory: {}", parent_dir.display());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let data = UserStoppedData {
|
|
||||||
services: self.user_stopped_services.iter().cloned().collect(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let json_data = serde_json::to_string_pretty(&data)?;
|
|
||||||
fs::write(&self.storage_path, json_data)?;
|
|
||||||
|
|
||||||
debug!(
|
|
||||||
"Saved {} user-stopped services to {}",
|
|
||||||
data.services.len(),
|
|
||||||
self.storage_path
|
|
||||||
);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Load state from persistent storage
|
|
||||||
fn load_from_storage(&mut self) -> Result<()> {
|
|
||||||
if !Path::new(&self.storage_path).exists() {
|
|
||||||
debug!("Storage file {} does not exist, starting fresh", self.storage_path);
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
|
|
||||||
let json_data = fs::read_to_string(&self.storage_path)?;
|
|
||||||
let data: UserStoppedData = serde_json::from_str(&json_data)?;
|
|
||||||
|
|
||||||
self.user_stopped_services = data.services.into_iter().collect();
|
|
||||||
|
|
||||||
info!(
|
|
||||||
"Loaded {} user-stopped services from {}",
|
|
||||||
self.user_stopped_services.len(),
|
|
||||||
self.storage_path
|
|
||||||
);
|
|
||||||
|
|
||||||
if !self.user_stopped_services.is_empty() {
|
|
||||||
debug!("User-stopped services: {:?}", self.user_stopped_services);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
1001
agent_stream.log
1001
agent_stream.log
@@ -1,1001 +0,0 @@
|
|||||||
warning: fields `total_services`, `backup_disk_filesystem_label`, `services_completed_count`, `services_failed_count`, and `services_disabled_count` are never read
|
|
||||||
--> dashboard/src/ui/widgets/backup.rs:22:5
|
|
||||||
|
|
|
||||||
14 | pub struct BackupWidget {
|
|
||||||
| ------------ fields in this struct
|
|
||||||
...
|
|
||||||
22 | total_services: Option<i64>,
|
|
||||||
| ^^^^^^^^^^^^^^
|
|
||||||
...
|
|
||||||
36 | backup_disk_filesystem_label: Option<String>,
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
37 | /// Number of completed services
|
|
||||||
38 | services_completed_count: Option<i64>,
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
39 | /// Number of failed services
|
|
||||||
40 | services_failed_count: Option<i64>,
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
41 | /// Number of disabled services
|
|
||||||
42 | services_disabled_count: Option<i64>,
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: `BackupWidget` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis
|
|
||||||
= note: `#[warn(dead_code)]` on by default
|
|
||||||
|
|
||||||
warning: field `exit_code` is never read
|
|
||||||
--> dashboard/src/ui/widgets/backup.rs:53:5
|
|
||||||
|
|
|
||||||
50 | struct ServiceMetricData {
|
|
||||||
| ----------------- field in this struct
|
|
||||||
...
|
|
||||||
53 | exit_code: Option<i64>,
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: `ServiceMetricData` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis
|
|
||||||
|
|
||||||
warning: associated function `extract_service_name` is never used
|
|
||||||
--> dashboard/src/ui/widgets/backup.rs:115:8
|
|
||||||
|
|
|
||||||
58 | impl BackupWidget {
|
|
||||||
| ----------------- associated function in this implementation
|
|
||||||
...
|
|
||||||
115 | fn extract_service_name(metric_name: &str) -> Option<String> {
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
warning: method `update_from_metrics` is never used
|
|
||||||
--> dashboard/src/ui/widgets/backup.rs:157:8
|
|
||||||
|
|
|
||||||
156 | impl BackupWidget {
|
|
||||||
| ----------------- method in this implementation
|
|
||||||
157 | fn update_from_metrics(&mut self, metrics: &[&Metric]) {
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
warning: associated function `extract_service_info` is never used
|
|
||||||
--> dashboard/src/ui/widgets/services.rs:50:8
|
|
||||||
|
|
|
||||||
38 | impl ServicesWidget {
|
|
||||||
| ------------------- associated function in this implementation
|
|
||||||
...
|
|
||||||
50 | fn extract_service_info(metric_name: &str) -> Option<(String, Option<String>)> {
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
warning: method `update_from_metrics` is never used
|
|
||||||
--> dashboard/src/ui/widgets/services.rs:285:8
|
|
||||||
|
|
|
||||||
284 | impl ServicesWidget {
|
|
||||||
| ------------------- method in this implementation
|
|
||||||
285 | fn update_from_metrics(&mut self, metrics: &[&Metric]) {
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
warning: field `health_status` is never read
|
|
||||||
--> dashboard/src/ui/widgets/system.rs:53:5
|
|
||||||
|
|
|
||||||
43 | struct StoragePool {
|
|
||||||
| ----------- field in this struct
|
|
||||||
...
|
|
||||||
53 | health_status: Status, // Separate status for pool health vs usage
|
|
||||||
| ^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: `StoragePool` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis
|
|
||||||
|
|
||||||
warning: `cm-dashboard` (bin "cm-dashboard") generated 7 warnings
|
|
||||||
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.16s
|
|
||||||
Running `target/debug/cm-dashboard --headless --raw-data`
|
|
||||||
RAW AGENT DATA FROM cmbox:
|
|
||||||
{
|
|
||||||
"hostname": "cmbox",
|
|
||||||
"agent_version": "v0.1.133",
|
|
||||||
"timestamp": 1763936501,
|
|
||||||
"system": {
|
|
||||||
"cpu": {
|
|
||||||
"load_1min": 1.82,
|
|
||||||
"load_5min": 2.1,
|
|
||||||
"load_15min": 2.1,
|
|
||||||
"frequency_mhz": 3743.09,
|
|
||||||
"temperature_celsius": 55.0
|
|
||||||
},
|
|
||||||
"memory": {
|
|
||||||
"usage_percent": 27.183601,
|
|
||||||
"total_gb": 23.339516,
|
|
||||||
"used_gb": 6.3445206,
|
|
||||||
"available_gb": 16.994995,
|
|
||||||
"swap_total_gb": 14.634708,
|
|
||||||
"swap_used_gb": 0.17599106,
|
|
||||||
"tmpfs": [
|
|
||||||
{
|
|
||||||
"mount": "/tmp",
|
|
||||||
"usage_percent": 15.094376,
|
|
||||||
"used_gb": 0.3018875,
|
|
||||||
"total_gb": 2.0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"storage": {
|
|
||||||
"drives": [
|
|
||||||
{
|
|
||||||
"name": "nvme0n1",
|
|
||||||
"health": "PASSED",
|
|
||||||
"temperature_celsius": 28.0,
|
|
||||||
"wear_percent": 1.0,
|
|
||||||
"filesystems": [
|
|
||||||
{
|
|
||||||
"mount": "root",
|
|
||||||
"usage_percent": 24.404377,
|
|
||||||
"used_gb": 226.51398,
|
|
||||||
"total_gb": 928.1695
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mount": "boot",
|
|
||||||
"usage_percent": 10.666672,
|
|
||||||
"used_gb": 0.10645676,
|
|
||||||
"total_gb": 0.9980316
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"pools": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"services": [
|
|
||||||
{
|
|
||||||
"name": "tailscaled",
|
|
||||||
"status": "active",
|
|
||||||
"memory_mb": 25.582031,
|
|
||||||
"disk_gb": 0.0,
|
|
||||||
"user_stopped": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "sshd",
|
|
||||||
"status": "active",
|
|
||||||
"memory_mb": 4.3085938,
|
|
||||||
"disk_gb": 0.0,
|
|
||||||
"user_stopped": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"backup": {
|
|
||||||
"status": "unknown",
|
|
||||||
"last_run": null,
|
|
||||||
"next_scheduled": null,
|
|
||||||
"total_size_gb": null,
|
|
||||||
"repository_health": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
────────────────────────────────────────────────────────────────────────────────
|
|
||||||
RAW AGENT DATA FROM cmbox:
|
|
||||||
{
|
|
||||||
"hostname": "cmbox",
|
|
||||||
"agent_version": "v0.1.133",
|
|
||||||
"timestamp": 1763936502,
|
|
||||||
"system": {
|
|
||||||
"cpu": {
|
|
||||||
"load_1min": 1.82,
|
|
||||||
"load_5min": 2.1,
|
|
||||||
"load_15min": 2.1,
|
|
||||||
"frequency_mhz": 3743.09,
|
|
||||||
"temperature_celsius": 55.0
|
|
||||||
},
|
|
||||||
"memory": {
|
|
||||||
"usage_percent": 27.183601,
|
|
||||||
"total_gb": 23.339516,
|
|
||||||
"used_gb": 6.3445206,
|
|
||||||
"available_gb": 16.994995,
|
|
||||||
"swap_total_gb": 14.634708,
|
|
||||||
"swap_used_gb": 0.17599106,
|
|
||||||
"tmpfs": [
|
|
||||||
{
|
|
||||||
"mount": "/tmp",
|
|
||||||
"usage_percent": 15.094376,
|
|
||||||
"used_gb": 0.3018875,
|
|
||||||
"total_gb": 2.0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"storage": {
|
|
||||||
"drives": [
|
|
||||||
{
|
|
||||||
"name": "nvme0n1",
|
|
||||||
"health": "PASSED",
|
|
||||||
"temperature_celsius": 28.0,
|
|
||||||
"wear_percent": 1.0,
|
|
||||||
"filesystems": [
|
|
||||||
{
|
|
||||||
"mount": "root",
|
|
||||||
"usage_percent": 24.404377,
|
|
||||||
"used_gb": 226.51398,
|
|
||||||
"total_gb": 928.1695
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mount": "boot",
|
|
||||||
"usage_percent": 10.666672,
|
|
||||||
"used_gb": 0.10645676,
|
|
||||||
"total_gb": 0.9980316
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"pools": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"services": [
|
|
||||||
{
|
|
||||||
"name": "tailscaled",
|
|
||||||
"status": "active",
|
|
||||||
"memory_mb": 25.582031,
|
|
||||||
"disk_gb": 0.0,
|
|
||||||
"user_stopped": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "sshd",
|
|
||||||
"status": "active",
|
|
||||||
"memory_mb": 4.3085938,
|
|
||||||
"disk_gb": 0.0,
|
|
||||||
"user_stopped": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"backup": {
|
|
||||||
"status": "unknown",
|
|
||||||
"last_run": null,
|
|
||||||
"next_scheduled": null,
|
|
||||||
"total_size_gb": null,
|
|
||||||
"repository_health": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
────────────────────────────────────────────────────────────────────────────────
|
|
||||||
RAW AGENT DATA FROM cmbox:
|
|
||||||
{
|
|
||||||
"hostname": "cmbox",
|
|
||||||
"agent_version": "v0.1.133",
|
|
||||||
"timestamp": 1763936503,
|
|
||||||
"system": {
|
|
||||||
"cpu": {
|
|
||||||
"load_1min": 1.82,
|
|
||||||
"load_5min": 2.1,
|
|
||||||
"load_15min": 2.1,
|
|
||||||
"frequency_mhz": 3743.09,
|
|
||||||
"temperature_celsius": 55.0
|
|
||||||
},
|
|
||||||
"memory": {
|
|
||||||
"usage_percent": 27.183601,
|
|
||||||
"total_gb": 23.339516,
|
|
||||||
"used_gb": 6.3445206,
|
|
||||||
"available_gb": 16.994995,
|
|
||||||
"swap_total_gb": 14.634708,
|
|
||||||
"swap_used_gb": 0.17599106,
|
|
||||||
"tmpfs": [
|
|
||||||
{
|
|
||||||
"mount": "/tmp",
|
|
||||||
"usage_percent": 15.094376,
|
|
||||||
"used_gb": 0.3018875,
|
|
||||||
"total_gb": 2.0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"storage": {
|
|
||||||
"drives": [
|
|
||||||
{
|
|
||||||
"name": "nvme0n1",
|
|
||||||
"health": "PASSED",
|
|
||||||
"temperature_celsius": 28.0,
|
|
||||||
"wear_percent": 1.0,
|
|
||||||
"filesystems": [
|
|
||||||
{
|
|
||||||
"mount": "root",
|
|
||||||
"usage_percent": 24.404377,
|
|
||||||
"used_gb": 226.51398,
|
|
||||||
"total_gb": 928.1695
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mount": "boot",
|
|
||||||
"usage_percent": 10.666672,
|
|
||||||
"used_gb": 0.10645676,
|
|
||||||
"total_gb": 0.9980316
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"pools": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"services": [
|
|
||||||
{
|
|
||||||
"name": "tailscaled",
|
|
||||||
"status": "active",
|
|
||||||
"memory_mb": 25.582031,
|
|
||||||
"disk_gb": 0.0,
|
|
||||||
"user_stopped": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "sshd",
|
|
||||||
"status": "active",
|
|
||||||
"memory_mb": 4.3085938,
|
|
||||||
"disk_gb": 0.0,
|
|
||||||
"user_stopped": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"backup": {
|
|
||||||
"status": "unknown",
|
|
||||||
"last_run": null,
|
|
||||||
"next_scheduled": null,
|
|
||||||
"total_size_gb": null,
|
|
||||||
"repository_health": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
────────────────────────────────────────────────────────────────────────────────
|
|
||||||
RAW AGENT DATA FROM cmbox:
|
|
||||||
{
|
|
||||||
"hostname": "cmbox",
|
|
||||||
"agent_version": "v0.1.133",
|
|
||||||
"timestamp": 1763936505,
|
|
||||||
"system": {
|
|
||||||
"cpu": {
|
|
||||||
"load_1min": 1.75,
|
|
||||||
"load_5min": 2.08,
|
|
||||||
"load_15min": 2.1,
|
|
||||||
"frequency_mhz": 3600.005,
|
|
||||||
"temperature_celsius": 56.0
|
|
||||||
},
|
|
||||||
"memory": {
|
|
||||||
"usage_percent": 26.780334,
|
|
||||||
"total_gb": 23.339516,
|
|
||||||
"used_gb": 6.2504005,
|
|
||||||
"available_gb": 17.089115,
|
|
||||||
"swap_total_gb": 14.634708,
|
|
||||||
"swap_used_gb": 0.17599106,
|
|
||||||
"tmpfs": [
|
|
||||||
{
|
|
||||||
"mount": "/tmp",
|
|
||||||
"usage_percent": 15.095139,
|
|
||||||
"used_gb": 0.30190277,
|
|
||||||
"total_gb": 2.0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"storage": {
|
|
||||||
"drives": [
|
|
||||||
{
|
|
||||||
"name": "nvme0n1",
|
|
||||||
"health": "PASSED",
|
|
||||||
"temperature_celsius": 28.0,
|
|
||||||
"wear_percent": 1.0,
|
|
||||||
"filesystems": [
|
|
||||||
{
|
|
||||||
"mount": "root",
|
|
||||||
"usage_percent": 24.404377,
|
|
||||||
"used_gb": 226.51398,
|
|
||||||
"total_gb": 928.1695
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mount": "boot",
|
|
||||||
"usage_percent": 10.666672,
|
|
||||||
"used_gb": 0.10645676,
|
|
||||||
"total_gb": 0.9980316
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"pools": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"services": [
|
|
||||||
{
|
|
||||||
"name": "tailscaled",
|
|
||||||
"status": "active",
|
|
||||||
"memory_mb": 25.59375,
|
|
||||||
"disk_gb": 0.0,
|
|
||||||
"user_stopped": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "sshd",
|
|
||||||
"status": "active",
|
|
||||||
"memory_mb": 4.3085938,
|
|
||||||
"disk_gb": 0.0,
|
|
||||||
"user_stopped": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"backup": {
|
|
||||||
"status": "unknown",
|
|
||||||
"last_run": null,
|
|
||||||
"next_scheduled": null,
|
|
||||||
"total_size_gb": null,
|
|
||||||
"repository_health": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
────────────────────────────────────────────────────────────────────────────────
|
|
||||||
RAW AGENT DATA FROM cmbox:
|
|
||||||
{
|
|
||||||
"hostname": "cmbox",
|
|
||||||
"agent_version": "v0.1.133",
|
|
||||||
"timestamp": 1763936506,
|
|
||||||
"system": {
|
|
||||||
"cpu": {
|
|
||||||
"load_1min": 1.75,
|
|
||||||
"load_5min": 2.08,
|
|
||||||
"load_15min": 2.1,
|
|
||||||
"frequency_mhz": 3600.005,
|
|
||||||
"temperature_celsius": 56.0
|
|
||||||
},
|
|
||||||
"memory": {
|
|
||||||
"usage_percent": 26.780334,
|
|
||||||
"total_gb": 23.339516,
|
|
||||||
"used_gb": 6.2504005,
|
|
||||||
"available_gb": 17.089115,
|
|
||||||
"swap_total_gb": 14.634708,
|
|
||||||
"swap_used_gb": 0.17599106,
|
|
||||||
"tmpfs": [
|
|
||||||
{
|
|
||||||
"mount": "/tmp",
|
|
||||||
"usage_percent": 15.095139,
|
|
||||||
"used_gb": 0.30190277,
|
|
||||||
"total_gb": 2.0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"storage": {
|
|
||||||
"drives": [
|
|
||||||
{
|
|
||||||
"name": "nvme0n1",
|
|
||||||
"health": "PASSED",
|
|
||||||
"temperature_celsius": 28.0,
|
|
||||||
"wear_percent": 1.0,
|
|
||||||
"filesystems": [
|
|
||||||
{
|
|
||||||
"mount": "root",
|
|
||||||
"usage_percent": 24.404377,
|
|
||||||
"used_gb": 226.51398,
|
|
||||||
"total_gb": 928.1695
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mount": "boot",
|
|
||||||
"usage_percent": 10.666672,
|
|
||||||
"used_gb": 0.10645676,
|
|
||||||
"total_gb": 0.9980316
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"pools": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"services": [
|
|
||||||
{
|
|
||||||
"name": "tailscaled",
|
|
||||||
"status": "active",
|
|
||||||
"memory_mb": 25.59375,
|
|
||||||
"disk_gb": 0.0,
|
|
||||||
"user_stopped": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "sshd",
|
|
||||||
"status": "active",
|
|
||||||
"memory_mb": 4.3085938,
|
|
||||||
"disk_gb": 0.0,
|
|
||||||
"user_stopped": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"backup": {
|
|
||||||
"status": "unknown",
|
|
||||||
"last_run": null,
|
|
||||||
"next_scheduled": null,
|
|
||||||
"total_size_gb": null,
|
|
||||||
"repository_health": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
────────────────────────────────────────────────────────────────────────────────
|
|
||||||
RAW AGENT DATA FROM cmbox:
|
|
||||||
{
|
|
||||||
"hostname": "cmbox",
|
|
||||||
"agent_version": "v0.1.133",
|
|
||||||
"timestamp": 1763936507,
|
|
||||||
"system": {
|
|
||||||
"cpu": {
|
|
||||||
"load_1min": 1.75,
|
|
||||||
"load_5min": 2.08,
|
|
||||||
"load_15min": 2.1,
|
|
||||||
"frequency_mhz": 3600.005,
|
|
||||||
"temperature_celsius": 56.0
|
|
||||||
},
|
|
||||||
"memory": {
|
|
||||||
"usage_percent": 26.780334,
|
|
||||||
"total_gb": 23.339516,
|
|
||||||
"used_gb": 6.2504005,
|
|
||||||
"available_gb": 17.089115,
|
|
||||||
"swap_total_gb": 14.634708,
|
|
||||||
"swap_used_gb": 0.17599106,
|
|
||||||
"tmpfs": [
|
|
||||||
{
|
|
||||||
"mount": "/tmp",
|
|
||||||
"usage_percent": 15.095139,
|
|
||||||
"used_gb": 0.30190277,
|
|
||||||
"total_gb": 2.0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"storage": {
|
|
||||||
"drives": [
|
|
||||||
{
|
|
||||||
"name": "nvme0n1",
|
|
||||||
"health": "PASSED",
|
|
||||||
"temperature_celsius": 28.0,
|
|
||||||
"wear_percent": 1.0,
|
|
||||||
"filesystems": [
|
|
||||||
{
|
|
||||||
"mount": "root",
|
|
||||||
"usage_percent": 24.404377,
|
|
||||||
"used_gb": 226.51398,
|
|
||||||
"total_gb": 928.1695
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mount": "boot",
|
|
||||||
"usage_percent": 10.666672,
|
|
||||||
"used_gb": 0.10645676,
|
|
||||||
"total_gb": 0.9980316
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"pools": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"services": [
|
|
||||||
{
|
|
||||||
"name": "tailscaled",
|
|
||||||
"status": "active",
|
|
||||||
"memory_mb": 25.59375,
|
|
||||||
"disk_gb": 0.0,
|
|
||||||
"user_stopped": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "sshd",
|
|
||||||
"status": "active",
|
|
||||||
"memory_mb": 4.3085938,
|
|
||||||
"disk_gb": 0.0,
|
|
||||||
"user_stopped": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"backup": {
|
|
||||||
"status": "unknown",
|
|
||||||
"last_run": null,
|
|
||||||
"next_scheduled": null,
|
|
||||||
"total_size_gb": null,
|
|
||||||
"repository_health": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
────────────────────────────────────────────────────────────────────────────────
|
|
||||||
RAW AGENT DATA FROM cmbox:
|
|
||||||
{
|
|
||||||
"hostname": "cmbox",
|
|
||||||
"agent_version": "v0.1.133",
|
|
||||||
"timestamp": 1763936508,
|
|
||||||
"system": {
|
|
||||||
"cpu": {
|
|
||||||
"load_1min": 1.75,
|
|
||||||
"load_5min": 2.08,
|
|
||||||
"load_15min": 2.1,
|
|
||||||
"frequency_mhz": 3600.005,
|
|
||||||
"temperature_celsius": 56.0
|
|
||||||
},
|
|
||||||
"memory": {
|
|
||||||
"usage_percent": 26.780334,
|
|
||||||
"total_gb": 23.339516,
|
|
||||||
"used_gb": 6.2504005,
|
|
||||||
"available_gb": 17.089115,
|
|
||||||
"swap_total_gb": 14.634708,
|
|
||||||
"swap_used_gb": 0.17599106,
|
|
||||||
"tmpfs": [
|
|
||||||
{
|
|
||||||
"mount": "/tmp",
|
|
||||||
"usage_percent": 15.095139,
|
|
||||||
"used_gb": 0.30190277,
|
|
||||||
"total_gb": 2.0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"storage": {
|
|
||||||
"drives": [
|
|
||||||
{
|
|
||||||
"name": "nvme0n1",
|
|
||||||
"health": "PASSED",
|
|
||||||
"temperature_celsius": 28.0,
|
|
||||||
"wear_percent": 1.0,
|
|
||||||
"filesystems": [
|
|
||||||
{
|
|
||||||
"mount": "root",
|
|
||||||
"usage_percent": 24.404377,
|
|
||||||
"used_gb": 226.51398,
|
|
||||||
"total_gb": 928.1695
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mount": "boot",
|
|
||||||
"usage_percent": 10.666672,
|
|
||||||
"used_gb": 0.10645676,
|
|
||||||
"total_gb": 0.9980316
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"pools": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"services": [
|
|
||||||
{
|
|
||||||
"name": "tailscaled",
|
|
||||||
"status": "active",
|
|
||||||
"memory_mb": 25.59375,
|
|
||||||
"disk_gb": 0.0,
|
|
||||||
"user_stopped": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "sshd",
|
|
||||||
"status": "active",
|
|
||||||
"memory_mb": 4.3085938,
|
|
||||||
"disk_gb": 0.0,
|
|
||||||
"user_stopped": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"backup": {
|
|
||||||
"status": "unknown",
|
|
||||||
"last_run": null,
|
|
||||||
"next_scheduled": null,
|
|
||||||
"total_size_gb": null,
|
|
||||||
"repository_health": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
────────────────────────────────────────────────────────────────────────────────
|
|
||||||
RAW AGENT DATA FROM cmbox:
|
|
||||||
{
|
|
||||||
"hostname": "cmbox",
|
|
||||||
"agent_version": "v0.1.133",
|
|
||||||
"timestamp": 1763936509,
|
|
||||||
"system": {
|
|
||||||
"cpu": {
|
|
||||||
"load_1min": 1.75,
|
|
||||||
"load_5min": 2.08,
|
|
||||||
"load_15min": 2.1,
|
|
||||||
"frequency_mhz": 3638.71,
|
|
||||||
"temperature_celsius": 56.0
|
|
||||||
},
|
|
||||||
"memory": {
|
|
||||||
"usage_percent": 27.014532,
|
|
||||||
"total_gb": 23.339516,
|
|
||||||
"used_gb": 6.3050613,
|
|
||||||
"available_gb": 17.034454,
|
|
||||||
"swap_total_gb": 14.634708,
|
|
||||||
"swap_used_gb": 0.17599106,
|
|
||||||
"tmpfs": [
|
|
||||||
{
|
|
||||||
"mount": "/tmp",
|
|
||||||
"usage_percent": 15.095139,
|
|
||||||
"used_gb": 0.30190277,
|
|
||||||
"total_gb": 2.0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"storage": {
|
|
||||||
"drives": [
|
|
||||||
{
|
|
||||||
"name": "nvme0n1",
|
|
||||||
"health": "PASSED",
|
|
||||||
"temperature_celsius": 28.0,
|
|
||||||
"wear_percent": 1.0,
|
|
||||||
"filesystems": [
|
|
||||||
{
|
|
||||||
"mount": "root",
|
|
||||||
"usage_percent": 24.404377,
|
|
||||||
"used_gb": 226.51398,
|
|
||||||
"total_gb": 928.1695
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mount": "boot",
|
|
||||||
"usage_percent": 10.666672,
|
|
||||||
"used_gb": 0.10645676,
|
|
||||||
"total_gb": 0.9980316
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"pools": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"services": [
|
|
||||||
{
|
|
||||||
"name": "tailscaled",
|
|
||||||
"status": "active",
|
|
||||||
"memory_mb": 25.59375,
|
|
||||||
"disk_gb": 0.0,
|
|
||||||
"user_stopped": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "sshd",
|
|
||||||
"status": "active",
|
|
||||||
"memory_mb": 4.3085938,
|
|
||||||
"disk_gb": 0.0,
|
|
||||||
"user_stopped": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"backup": {
|
|
||||||
"status": "unknown",
|
|
||||||
"last_run": null,
|
|
||||||
"next_scheduled": null,
|
|
||||||
"total_size_gb": null,
|
|
||||||
"repository_health": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
────────────────────────────────────────────────────────────────────────────────
|
|
||||||
RAW AGENT DATA FROM cmbox:
|
|
||||||
{
|
|
||||||
"hostname": "cmbox",
|
|
||||||
"agent_version": "v0.1.133",
|
|
||||||
"timestamp": 1763936509,
|
|
||||||
"system": {
|
|
||||||
"cpu": {
|
|
||||||
"load_1min": 0.0,
|
|
||||||
"load_5min": 0.0,
|
|
||||||
"load_15min": 0.0,
|
|
||||||
"frequency_mhz": 0.0,
|
|
||||||
"temperature_celsius": null
|
|
||||||
},
|
|
||||||
"memory": {
|
|
||||||
"usage_percent": 0.0,
|
|
||||||
"total_gb": 0.0,
|
|
||||||
"used_gb": 0.0,
|
|
||||||
"available_gb": 0.0,
|
|
||||||
"swap_total_gb": 0.0,
|
|
||||||
"swap_used_gb": 0.0,
|
|
||||||
"tmpfs": []
|
|
||||||
},
|
|
||||||
"storage": {
|
|
||||||
"drives": [],
|
|
||||||
"pools": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"services": [],
|
|
||||||
"backup": {
|
|
||||||
"status": "unknown",
|
|
||||||
"last_run": null,
|
|
||||||
"next_scheduled": null,
|
|
||||||
"total_size_gb": null,
|
|
||||||
"repository_health": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
────────────────────────────────────────────────────────────────────────────────
|
|
||||||
RAW AGENT DATA FROM cmbox:
|
|
||||||
{
|
|
||||||
"hostname": "cmbox",
|
|
||||||
"agent_version": "v0.1.133",
|
|
||||||
"timestamp": 1763936510,
|
|
||||||
"system": {
|
|
||||||
"cpu": {
|
|
||||||
"load_1min": 1.75,
|
|
||||||
"load_5min": 2.08,
|
|
||||||
"load_15min": 2.1,
|
|
||||||
"frequency_mhz": 3638.71,
|
|
||||||
"temperature_celsius": 56.0
|
|
||||||
},
|
|
||||||
"memory": {
|
|
||||||
"usage_percent": 27.014532,
|
|
||||||
"total_gb": 23.339516,
|
|
||||||
"used_gb": 6.3050613,
|
|
||||||
"available_gb": 17.034454,
|
|
||||||
"swap_total_gb": 14.634708,
|
|
||||||
"swap_used_gb": 0.17599106,
|
|
||||||
"tmpfs": [
|
|
||||||
{
|
|
||||||
"mount": "/tmp",
|
|
||||||
"usage_percent": 15.095139,
|
|
||||||
"used_gb": 0.30190277,
|
|
||||||
"total_gb": 2.0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"storage": {
|
|
||||||
"drives": [
|
|
||||||
{
|
|
||||||
"name": "nvme0n1",
|
|
||||||
"health": "PASSED",
|
|
||||||
"temperature_celsius": 28.0,
|
|
||||||
"wear_percent": 1.0,
|
|
||||||
"filesystems": [
|
|
||||||
{
|
|
||||||
"mount": "root",
|
|
||||||
"usage_percent": 24.404377,
|
|
||||||
"used_gb": 226.51398,
|
|
||||||
"total_gb": 928.1695
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mount": "boot",
|
|
||||||
"usage_percent": 10.666672,
|
|
||||||
"used_gb": 0.10645676,
|
|
||||||
"total_gb": 0.9980316
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"pools": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"services": [
|
|
||||||
{
|
|
||||||
"name": "tailscaled",
|
|
||||||
"status": "active",
|
|
||||||
"memory_mb": 25.59375,
|
|
||||||
"disk_gb": 0.0,
|
|
||||||
"user_stopped": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "sshd",
|
|
||||||
"status": "active",
|
|
||||||
"memory_mb": 4.3085938,
|
|
||||||
"disk_gb": 0.0,
|
|
||||||
"user_stopped": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"backup": {
|
|
||||||
"status": "unknown",
|
|
||||||
"last_run": null,
|
|
||||||
"next_scheduled": null,
|
|
||||||
"total_size_gb": null,
|
|
||||||
"repository_health": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
────────────────────────────────────────────────────────────────────────────────
|
|
||||||
RAW AGENT DATA FROM cmbox:
|
|
||||||
{
|
|
||||||
"hostname": "cmbox",
|
|
||||||
"agent_version": "v0.1.133",
|
|
||||||
"timestamp": 1763936511,
|
|
||||||
"system": {
|
|
||||||
"cpu": {
|
|
||||||
"load_1min": 1.75,
|
|
||||||
"load_5min": 2.08,
|
|
||||||
"load_15min": 2.1,
|
|
||||||
"frequency_mhz": 3638.71,
|
|
||||||
"temperature_celsius": 56.0
|
|
||||||
},
|
|
||||||
"memory": {
|
|
||||||
"usage_percent": 27.014532,
|
|
||||||
"total_gb": 23.339516,
|
|
||||||
"used_gb": 6.3050613,
|
|
||||||
"available_gb": 17.034454,
|
|
||||||
"swap_total_gb": 14.634708,
|
|
||||||
"swap_used_gb": 0.17599106,
|
|
||||||
"tmpfs": [
|
|
||||||
{
|
|
||||||
"mount": "/tmp",
|
|
||||||
"usage_percent": 15.095139,
|
|
||||||
"used_gb": 0.30190277,
|
|
||||||
"total_gb": 2.0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"storage": {
|
|
||||||
"drives": [
|
|
||||||
{
|
|
||||||
"name": "nvme0n1",
|
|
||||||
"health": "PASSED",
|
|
||||||
"temperature_celsius": 28.0,
|
|
||||||
"wear_percent": 1.0,
|
|
||||||
"filesystems": [
|
|
||||||
{
|
|
||||||
"mount": "root",
|
|
||||||
"usage_percent": 24.404377,
|
|
||||||
"used_gb": 226.51398,
|
|
||||||
"total_gb": 928.1695
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mount": "boot",
|
|
||||||
"usage_percent": 10.666672,
|
|
||||||
"used_gb": 0.10645676,
|
|
||||||
"total_gb": 0.9980316
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"pools": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"services": [
|
|
||||||
{
|
|
||||||
"name": "tailscaled",
|
|
||||||
"status": "active",
|
|
||||||
"memory_mb": 25.59375,
|
|
||||||
"disk_gb": 0.0,
|
|
||||||
"user_stopped": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "sshd",
|
|
||||||
"status": "active",
|
|
||||||
"memory_mb": 4.3085938,
|
|
||||||
"disk_gb": 0.0,
|
|
||||||
"user_stopped": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"backup": {
|
|
||||||
"status": "unknown",
|
|
||||||
"last_run": null,
|
|
||||||
"next_scheduled": null,
|
|
||||||
"total_size_gb": null,
|
|
||||||
"repository_health": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
────────────────────────────────────────────────────────────────────────────────
|
|
||||||
RAW AGENT DATA FROM cmbox:
|
|
||||||
{
|
|
||||||
"hostname": "cmbox",
|
|
||||||
"agent_version": "v0.1.133",
|
|
||||||
"timestamp": 1763936512,
|
|
||||||
"system": {
|
|
||||||
"cpu": {
|
|
||||||
"load_1min": 1.75,
|
|
||||||
"load_5min": 2.08,
|
|
||||||
"load_15min": 2.1,
|
|
||||||
"frequency_mhz": 3638.71,
|
|
||||||
"temperature_celsius": 56.0
|
|
||||||
},
|
|
||||||
"memory": {
|
|
||||||
"usage_percent": 27.014532,
|
|
||||||
"total_gb": 23.339516,
|
|
||||||
"used_gb": 6.3050613,
|
|
||||||
"available_gb": 17.034454,
|
|
||||||
"swap_total_gb": 14.634708,
|
|
||||||
"swap_used_gb": 0.17599106,
|
|
||||||
"tmpfs": [
|
|
||||||
{
|
|
||||||
"mount": "/tmp",
|
|
||||||
"usage_percent": 15.095139,
|
|
||||||
"used_gb": 0.30190277,
|
|
||||||
"total_gb": 2.0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"storage": {
|
|
||||||
"drives": [
|
|
||||||
{
|
|
||||||
"name": "nvme0n1",
|
|
||||||
"health": "PASSED",
|
|
||||||
"temperature_celsius": 28.0,
|
|
||||||
"wear_percent": 1.0,
|
|
||||||
"filesystems": [
|
|
||||||
{
|
|
||||||
"mount": "root",
|
|
||||||
"usage_percent": 24.404377,
|
|
||||||
"used_gb": 226.51398,
|
|
||||||
"total_gb": 928.1695
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"mount": "boot",
|
|
||||||
"usage_percent": 10.666672,
|
|
||||||
"used_gb": 0.10645676,
|
|
||||||
"total_gb": 0.9980316
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"pools": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"services": [
|
|
||||||
{
|
|
||||||
"name": "tailscaled",
|
|
||||||
"status": "active",
|
|
||||||
"memory_mb": 25.59375,
|
|
||||||
"disk_gb": 0.0,
|
|
||||||
"user_stopped": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "sshd",
|
|
||||||
"status": "active",
|
|
||||||
"memory_mb": 4.3085938,
|
|
||||||
"disk_gb": 0.0,
|
|
||||||
"user_stopped": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"backup": {
|
|
||||||
"status": "unknown",
|
|
||||||
"last_run": null,
|
|
||||||
"next_scheduled": null,
|
|
||||||
"total_size_gb": null,
|
|
||||||
"repository_health": null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
────────────────────────────────────────────────────────────────────────────────
|
|
||||||
Terminated
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cm-dashboard"
|
name = "cm-dashboard"
|
||||||
version = "0.1.158"
|
version = "0.1.199"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@@ -20,13 +20,12 @@ pub struct Dashboard {
|
|||||||
tui_app: Option<TuiApp>,
|
tui_app: Option<TuiApp>,
|
||||||
terminal: Option<Terminal<CrosstermBackend<io::Stdout>>>,
|
terminal: Option<Terminal<CrosstermBackend<io::Stdout>>>,
|
||||||
headless: bool,
|
headless: bool,
|
||||||
raw_data: bool,
|
|
||||||
initial_commands_sent: std::collections::HashSet<String>,
|
initial_commands_sent: std::collections::HashSet<String>,
|
||||||
config: DashboardConfig,
|
config: DashboardConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Dashboard {
|
impl Dashboard {
|
||||||
pub async fn new(config_path: Option<String>, headless: bool, raw_data: bool) -> Result<Self> {
|
pub async fn new(config_path: Option<String>, headless: bool) -> Result<Self> {
|
||||||
info!("Initializing dashboard");
|
info!("Initializing dashboard");
|
||||||
|
|
||||||
// Load configuration - try default path if not specified
|
// Load configuration - try default path if not specified
|
||||||
@@ -120,7 +119,6 @@ impl Dashboard {
|
|||||||
tui_app,
|
tui_app,
|
||||||
terminal,
|
terminal,
|
||||||
headless,
|
headless,
|
||||||
raw_data,
|
|
||||||
initial_commands_sent: std::collections::HashSet::new(),
|
initial_commands_sent: std::collections::HashSet::new(),
|
||||||
config,
|
config,
|
||||||
})
|
})
|
||||||
@@ -205,13 +203,6 @@ impl Dashboard {
|
|||||||
.insert(agent_data.hostname.clone());
|
.insert(agent_data.hostname.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show raw data if requested (before processing)
|
|
||||||
if self.raw_data {
|
|
||||||
println!("RAW AGENT DATA FROM {}:", agent_data.hostname);
|
|
||||||
println!("{}", serde_json::to_string_pretty(&agent_data).unwrap_or_else(|e| format!("Serialization error: {}", e)));
|
|
||||||
println!("{}", "─".repeat(80));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Store structured data directly
|
// Store structured data directly
|
||||||
self.metric_store.store_agent_data(agent_data);
|
self.metric_store.store_agent_data(agent_data);
|
||||||
|
|
||||||
@@ -224,7 +215,7 @@ impl Dashboard {
|
|||||||
|
|
||||||
// Update TUI with new metrics (only if not headless)
|
// Update TUI with new metrics (only if not headless)
|
||||||
if let Some(ref mut tui_app) = self.tui_app {
|
if let Some(ref mut tui_app) = self.tui_app {
|
||||||
tui_app.update_metrics(&self.metric_store);
|
tui_app.update_metrics(&mut self.metric_store);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,10 +51,6 @@ struct Cli {
|
|||||||
/// Run in headless mode (no TUI, just logging)
|
/// Run in headless mode (no TUI, just logging)
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
headless: bool,
|
headless: bool,
|
||||||
|
|
||||||
/// Show raw agent data in headless mode
|
|
||||||
#[arg(long)]
|
|
||||||
raw_data: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
@@ -90,7 +86,7 @@ async fn main() -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create and run dashboard
|
// Create and run dashboard
|
||||||
let mut dashboard = Dashboard::new(cli.config, cli.headless, cli.raw_data).await?;
|
let mut dashboard = Dashboard::new(cli.config, cli.headless).await?;
|
||||||
|
|
||||||
// Setup graceful shutdown
|
// Setup graceful shutdown
|
||||||
let ctrl_c = async {
|
let ctrl_c = async {
|
||||||
|
|||||||
@@ -5,6 +5,14 @@ use tracing::{debug, info, warn};
|
|||||||
|
|
||||||
use super::MetricDataPoint;
|
use super::MetricDataPoint;
|
||||||
|
|
||||||
|
/// ZMQ communication statistics per host
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct ZmqStats {
|
||||||
|
pub packets_received: u64,
|
||||||
|
pub last_packet_time: Instant,
|
||||||
|
pub last_packet_age_secs: f64,
|
||||||
|
}
|
||||||
|
|
||||||
/// Central metric storage for the dashboard
|
/// Central metric storage for the dashboard
|
||||||
pub struct MetricStore {
|
pub struct MetricStore {
|
||||||
/// Current structured data: hostname -> AgentData
|
/// Current structured data: hostname -> AgentData
|
||||||
@@ -13,6 +21,8 @@ pub struct MetricStore {
|
|||||||
historical_metrics: HashMap<String, Vec<MetricDataPoint>>,
|
historical_metrics: HashMap<String, Vec<MetricDataPoint>>,
|
||||||
/// Last heartbeat timestamp per host
|
/// Last heartbeat timestamp per host
|
||||||
last_heartbeat: HashMap<String, Instant>,
|
last_heartbeat: HashMap<String, Instant>,
|
||||||
|
/// ZMQ communication statistics per host
|
||||||
|
zmq_stats: HashMap<String, ZmqStats>,
|
||||||
/// Configuration
|
/// Configuration
|
||||||
max_metrics_per_host: usize,
|
max_metrics_per_host: usize,
|
||||||
history_retention: Duration,
|
history_retention: Duration,
|
||||||
@@ -24,6 +34,7 @@ impl MetricStore {
|
|||||||
current_agent_data: HashMap::new(),
|
current_agent_data: HashMap::new(),
|
||||||
historical_metrics: HashMap::new(),
|
historical_metrics: HashMap::new(),
|
||||||
last_heartbeat: HashMap::new(),
|
last_heartbeat: HashMap::new(),
|
||||||
|
zmq_stats: HashMap::new(),
|
||||||
max_metrics_per_host,
|
max_metrics_per_host,
|
||||||
history_retention: Duration::from_secs(history_retention_hours * 3600),
|
history_retention: Duration::from_secs(history_retention_hours * 3600),
|
||||||
}
|
}
|
||||||
@@ -44,6 +55,16 @@ impl MetricStore {
|
|||||||
self.last_heartbeat.insert(hostname.clone(), now);
|
self.last_heartbeat.insert(hostname.clone(), now);
|
||||||
debug!("Updated heartbeat for host {}", hostname);
|
debug!("Updated heartbeat for host {}", hostname);
|
||||||
|
|
||||||
|
// Update ZMQ stats
|
||||||
|
let stats = self.zmq_stats.entry(hostname.clone()).or_insert(ZmqStats {
|
||||||
|
packets_received: 0,
|
||||||
|
last_packet_time: now,
|
||||||
|
last_packet_age_secs: 0.0,
|
||||||
|
});
|
||||||
|
stats.packets_received += 1;
|
||||||
|
stats.last_packet_time = now;
|
||||||
|
stats.last_packet_age_secs = 0.0; // Just received
|
||||||
|
|
||||||
// Add to history
|
// Add to history
|
||||||
let host_history = self
|
let host_history = self
|
||||||
.historical_metrics
|
.historical_metrics
|
||||||
@@ -65,6 +86,15 @@ impl MetricStore {
|
|||||||
self.current_agent_data.get(hostname)
|
self.current_agent_data.get(hostname)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get ZMQ communication statistics for a host
|
||||||
|
pub fn get_zmq_stats(&mut self, hostname: &str) -> Option<ZmqStats> {
|
||||||
|
let now = Instant::now();
|
||||||
|
self.zmq_stats.get_mut(hostname).map(|stats| {
|
||||||
|
// Update packet age
|
||||||
|
stats.last_packet_age_secs = now.duration_since(stats.last_packet_time).as_secs_f64();
|
||||||
|
stats.clone()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/// Get connected hosts (hosts with recent heartbeats)
|
/// Get connected hosts (hosts with recent heartbeats)
|
||||||
pub fn get_connected_hosts(&self, timeout: Duration) -> Vec<String> {
|
pub fn get_connected_hosts(&self, timeout: Duration) -> Vec<String> {
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ impl TuiApp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Update widgets with structured data from store (only for current host)
|
/// Update widgets with structured data from store (only for current host)
|
||||||
pub fn update_metrics(&mut self, metric_store: &MetricStore) {
|
pub fn update_metrics(&mut self, metric_store: &mut MetricStore) {
|
||||||
if let Some(hostname) = self.current_host.clone() {
|
if let Some(hostname) = self.current_host.clone() {
|
||||||
// Get structured data for this host
|
// Get structured data for this host
|
||||||
if let Some(agent_data) = metric_store.get_agent_data(&hostname) {
|
if let Some(agent_data) = metric_store.get_agent_data(&hostname) {
|
||||||
@@ -110,6 +110,14 @@ impl TuiApp {
|
|||||||
host_widgets.system_widget.update_from_agent_data(agent_data);
|
host_widgets.system_widget.update_from_agent_data(agent_data);
|
||||||
host_widgets.services_widget.update_from_agent_data(agent_data);
|
host_widgets.services_widget.update_from_agent_data(agent_data);
|
||||||
|
|
||||||
|
// Update ZMQ stats
|
||||||
|
if let Some(zmq_stats) = metric_store.get_zmq_stats(&hostname) {
|
||||||
|
host_widgets.system_widget.update_zmq_stats(
|
||||||
|
zmq_stats.packets_received,
|
||||||
|
zmq_stats.last_packet_age_secs
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
host_widgets.last_update = Some(Instant::now());
|
host_widgets.last_update = Some(Instant::now());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -225,9 +225,6 @@ impl Layout {
|
|||||||
pub const LEFT_PANEL_WIDTH: u16 = 45;
|
pub const LEFT_PANEL_WIDTH: u16 = 45;
|
||||||
/// Right panel percentage (services)
|
/// Right panel percentage (services)
|
||||||
pub const RIGHT_PANEL_WIDTH: u16 = 55;
|
pub const RIGHT_PANEL_WIDTH: u16 = 55;
|
||||||
/// System vs backup split (equal)
|
|
||||||
pub const SYSTEM_PANEL_HEIGHT: u16 = 50;
|
|
||||||
pub const BACKUP_PANEL_HEIGHT: u16 = 50;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Typography system
|
/// Typography system
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
// This file is intentionally left minimal - CPU functionality is handled by the SystemWidget
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
// This file is intentionally left minimal - Memory functionality is handled by the SystemWidget
|
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
use cm_dashboard_shared::AgentData;
|
use cm_dashboard_shared::AgentData;
|
||||||
|
|
||||||
pub mod cpu;
|
|
||||||
pub mod memory;
|
|
||||||
pub mod services;
|
pub mod services;
|
||||||
pub mod system;
|
pub mod system;
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ struct ServiceInfo {
|
|||||||
disk_gb: Option<f32>,
|
disk_gb: Option<f32>,
|
||||||
metrics: Vec<(String, f32, Option<String>)>, // (label, value, unit)
|
metrics: Vec<(String, f32, Option<String>)>, // (label, value, unit)
|
||||||
widget_status: Status,
|
widget_status: Status,
|
||||||
|
service_type: String, // "nginx_site", "container", "image", or empty for parent services
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ServicesWidget {
|
impl ServicesWidget {
|
||||||
@@ -169,7 +170,7 @@ impl ServicesWidget {
|
|||||||
// Convert Status enum to display text for sub-services
|
// Convert Status enum to display text for sub-services
|
||||||
match info.widget_status {
|
match info.widget_status {
|
||||||
Status::Ok => "active",
|
Status::Ok => "active",
|
||||||
Status::Inactive => "inactive",
|
Status::Inactive => "inactive",
|
||||||
Status::Critical => "failed",
|
Status::Critical => "failed",
|
||||||
Status::Pending => "pending",
|
Status::Pending => "pending",
|
||||||
Status::Warning => "warning",
|
Status::Warning => "warning",
|
||||||
@@ -179,32 +180,62 @@ impl ServicesWidget {
|
|||||||
};
|
};
|
||||||
let tree_symbol = if is_last { "└─" } else { "├─" };
|
let tree_symbol = if is_last { "└─" } else { "├─" };
|
||||||
|
|
||||||
vec![
|
// Docker images use docker whale icon
|
||||||
// Indentation and tree prefix
|
if info.service_type == "image" {
|
||||||
ratatui::text::Span::styled(
|
vec![
|
||||||
format!(" {} ", tree_symbol),
|
// Indentation and tree prefix
|
||||||
Typography::tree(),
|
ratatui::text::Span::styled(
|
||||||
),
|
format!(" {} ", tree_symbol),
|
||||||
// Status icon
|
Typography::tree(),
|
||||||
ratatui::text::Span::styled(
|
),
|
||||||
format!("{} ", icon),
|
// Docker icon (simple character for performance)
|
||||||
Style::default().fg(status_color).bg(Theme::background()),
|
ratatui::text::Span::styled(
|
||||||
),
|
"D ".to_string(),
|
||||||
// Service name
|
Style::default().fg(Theme::highlight()).bg(Theme::background()),
|
||||||
ratatui::text::Span::styled(
|
),
|
||||||
format!("{:<18} ", short_name),
|
// Service name
|
||||||
Style::default()
|
ratatui::text::Span::styled(
|
||||||
.fg(Theme::secondary_text())
|
format!("{:<18} ", short_name),
|
||||||
.bg(Theme::background()),
|
Style::default()
|
||||||
),
|
.fg(Theme::secondary_text())
|
||||||
// Status/latency text
|
.bg(Theme::background()),
|
||||||
ratatui::text::Span::styled(
|
),
|
||||||
status_str,
|
// Status/metrics text
|
||||||
Style::default()
|
ratatui::text::Span::styled(
|
||||||
.fg(Theme::secondary_text())
|
status_str,
|
||||||
.bg(Theme::background()),
|
Style::default()
|
||||||
),
|
.fg(Theme::secondary_text())
|
||||||
]
|
.bg(Theme::background()),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
} else {
|
||||||
|
vec![
|
||||||
|
// Indentation and tree prefix
|
||||||
|
ratatui::text::Span::styled(
|
||||||
|
format!(" {} ", tree_symbol),
|
||||||
|
Typography::tree(),
|
||||||
|
),
|
||||||
|
// Status icon
|
||||||
|
ratatui::text::Span::styled(
|
||||||
|
format!("{} ", icon),
|
||||||
|
Style::default().fg(status_color).bg(Theme::background()),
|
||||||
|
),
|
||||||
|
// Service name
|
||||||
|
ratatui::text::Span::styled(
|
||||||
|
format!("{:<18} ", short_name),
|
||||||
|
Style::default()
|
||||||
|
.fg(Theme::secondary_text())
|
||||||
|
.bg(Theme::background()),
|
||||||
|
),
|
||||||
|
// Status/latency text
|
||||||
|
ratatui::text::Span::styled(
|
||||||
|
status_str,
|
||||||
|
Style::default()
|
||||||
|
.fg(Theme::secondary_text())
|
||||||
|
.bg(Theme::background()),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Move selection up
|
/// Move selection up
|
||||||
@@ -282,9 +313,10 @@ impl Widget for ServicesWidget {
|
|||||||
disk_gb: Some(service.disk_gb),
|
disk_gb: Some(service.disk_gb),
|
||||||
metrics: Vec::new(), // Parent services don't have custom metrics
|
metrics: Vec::new(), // Parent services don't have custom metrics
|
||||||
widget_status: service.service_status,
|
widget_status: service.service_status,
|
||||||
|
service_type: String::new(), // Parent services have no type
|
||||||
};
|
};
|
||||||
self.parent_services.insert(service.name.clone(), parent_info);
|
self.parent_services.insert(service.name.clone(), parent_info);
|
||||||
|
|
||||||
// Process sub-services if any
|
// Process sub-services if any
|
||||||
if !service.sub_services.is_empty() {
|
if !service.sub_services.is_empty() {
|
||||||
let mut sub_list = Vec::new();
|
let mut sub_list = Vec::new();
|
||||||
@@ -293,12 +325,13 @@ impl Widget for ServicesWidget {
|
|||||||
let metrics: Vec<(String, f32, Option<String>)> = sub_service.metrics.iter()
|
let metrics: Vec<(String, f32, Option<String>)> = sub_service.metrics.iter()
|
||||||
.map(|m| (m.label.clone(), m.value, m.unit.clone()))
|
.map(|m| (m.label.clone(), m.value, m.unit.clone()))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let sub_info = ServiceInfo {
|
let sub_info = ServiceInfo {
|
||||||
memory_mb: None, // Not used for sub-services
|
memory_mb: None, // Not used for sub-services
|
||||||
disk_gb: None, // Not used for sub-services
|
disk_gb: None, // Not used for sub-services
|
||||||
metrics,
|
metrics,
|
||||||
widget_status: sub_service.service_status,
|
widget_status: sub_service.service_status,
|
||||||
|
service_type: sub_service.service_type.clone(),
|
||||||
};
|
};
|
||||||
sub_list.push((sub_service.name.clone(), sub_info));
|
sub_list.push((sub_service.name.clone(), sub_info));
|
||||||
}
|
}
|
||||||
@@ -342,6 +375,7 @@ impl ServicesWidget {
|
|||||||
disk_gb: None,
|
disk_gb: None,
|
||||||
metrics: Vec::new(),
|
metrics: Vec::new(),
|
||||||
widget_status: Status::Unknown,
|
widget_status: Status::Unknown,
|
||||||
|
service_type: String::new(),
|
||||||
});
|
});
|
||||||
|
|
||||||
if metric.name.ends_with("_status") {
|
if metric.name.ends_with("_status") {
|
||||||
@@ -377,6 +411,7 @@ impl ServicesWidget {
|
|||||||
disk_gb: None,
|
disk_gb: None,
|
||||||
metrics: Vec::new(),
|
metrics: Vec::new(),
|
||||||
widget_status: Status::Unknown,
|
widget_status: Status::Unknown,
|
||||||
|
service_type: String::new(), // Unknown type in legacy path
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
&mut sub_service_list.last_mut().unwrap().1
|
&mut sub_service_list.last_mut().unwrap().1
|
||||||
|
|||||||
@@ -8,13 +8,20 @@ use ratatui::{
|
|||||||
|
|
||||||
use crate::ui::theme::{StatusIcons, Typography};
|
use crate::ui::theme::{StatusIcons, Typography};
|
||||||
|
|
||||||
/// System widget displaying NixOS info, CPU, RAM, and Storage in unified layout
|
/// System widget displaying NixOS info, Network, CPU, RAM, and Storage in unified layout
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct SystemWidget {
|
pub struct SystemWidget {
|
||||||
// NixOS information
|
// NixOS information
|
||||||
nixos_build: Option<String>,
|
nixos_build: Option<String>,
|
||||||
agent_hash: Option<String>,
|
agent_hash: Option<String>,
|
||||||
|
|
||||||
|
// ZMQ communication stats
|
||||||
|
zmq_packets_received: Option<u64>,
|
||||||
|
zmq_last_packet_age: Option<f64>,
|
||||||
|
|
||||||
|
// Network interfaces
|
||||||
|
network_interfaces: Vec<cm_dashboard_shared::NetworkInterfaceData>,
|
||||||
|
|
||||||
// CPU metrics
|
// CPU metrics
|
||||||
cpu_load_1min: Option<f32>,
|
cpu_load_1min: Option<f32>,
|
||||||
cpu_load_5min: Option<f32>,
|
cpu_load_5min: Option<f32>,
|
||||||
@@ -89,6 +96,9 @@ impl SystemWidget {
|
|||||||
Self {
|
Self {
|
||||||
nixos_build: None,
|
nixos_build: None,
|
||||||
agent_hash: None,
|
agent_hash: None,
|
||||||
|
zmq_packets_received: None,
|
||||||
|
zmq_last_packet_age: None,
|
||||||
|
network_interfaces: Vec::new(),
|
||||||
cpu_load_1min: None,
|
cpu_load_1min: None,
|
||||||
cpu_load_5min: None,
|
cpu_load_5min: None,
|
||||||
cpu_load_15min: None,
|
cpu_load_15min: None,
|
||||||
@@ -150,6 +160,12 @@ impl SystemWidget {
|
|||||||
pub fn _get_agent_hash(&self) -> Option<&String> {
|
pub fn _get_agent_hash(&self) -> Option<&String> {
|
||||||
self.agent_hash.as_ref()
|
self.agent_hash.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Update ZMQ communication statistics
|
||||||
|
pub fn update_zmq_stats(&mut self, packets_received: u64, last_packet_age_secs: f64) {
|
||||||
|
self.zmq_packets_received = Some(packets_received);
|
||||||
|
self.zmq_last_packet_age = Some(last_packet_age_secs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use super::Widget;
|
use super::Widget;
|
||||||
@@ -164,6 +180,9 @@ impl Widget for SystemWidget {
|
|||||||
// Extract build version
|
// Extract build version
|
||||||
self.nixos_build = agent_data.build_version.clone();
|
self.nixos_build = agent_data.build_version.clone();
|
||||||
|
|
||||||
|
// Extract network interfaces
|
||||||
|
self.network_interfaces = agent_data.system.network.interfaces.clone();
|
||||||
|
|
||||||
// Extract CPU data directly
|
// Extract CPU data directly
|
||||||
let cpu = &agent_data.system.cpu;
|
let cpu = &agent_data.system.cpu;
|
||||||
self.cpu_load_1min = Some(cpu.load_1min);
|
self.cpu_load_1min = Some(cpu.load_1min);
|
||||||
@@ -508,55 +527,6 @@ fn truncate_serial(serial: &str) -> String {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper function to render a drive in a MergerFS pool
|
|
||||||
fn render_mergerfs_drive<'a>(drive: &StorageDrive, tree_symbol: &'a str, lines: &mut Vec<Line<'a>>) {
|
|
||||||
let mut drive_details = Vec::new();
|
|
||||||
if let Some(temp) = drive.temperature {
|
|
||||||
drive_details.push(format!("T: {}°C", temp as i32));
|
|
||||||
}
|
|
||||||
if let Some(wear) = drive.wear_percent {
|
|
||||||
drive_details.push(format!("W: {}%", wear as i32));
|
|
||||||
}
|
|
||||||
|
|
||||||
let drive_text = if !drive_details.is_empty() {
|
|
||||||
format!("{} {}", drive.name, drive_details.join(" "))
|
|
||||||
} else {
|
|
||||||
drive.name.clone()
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut drive_spans = vec![
|
|
||||||
Span::styled(tree_symbol, Typography::tree()),
|
|
||||||
];
|
|
||||||
drive_spans.extend(StatusIcons::create_status_spans(drive.status.clone(), &drive_text));
|
|
||||||
lines.push(Line::from(drive_spans));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Helper function to render a drive in a storage pool
|
|
||||||
fn render_pool_drive(drive: &StorageDrive, is_last: bool, lines: &mut Vec<Line<'_>>) {
|
|
||||||
let tree_symbol = if is_last { " └─" } else { " ├─" };
|
|
||||||
|
|
||||||
let mut drive_details = Vec::new();
|
|
||||||
if let Some(temp) = drive.temperature {
|
|
||||||
drive_details.push(format!("T: {}°C", temp as i32));
|
|
||||||
}
|
|
||||||
if let Some(wear) = drive.wear_percent {
|
|
||||||
drive_details.push(format!("W: {}%", wear as i32));
|
|
||||||
}
|
|
||||||
|
|
||||||
let drive_text = if !drive_details.is_empty() {
|
|
||||||
format!("● {} {}", drive.name, drive_details.join(" "))
|
|
||||||
} else {
|
|
||||||
format!("● {}", drive.name)
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut drive_spans = vec![
|
|
||||||
Span::styled(tree_symbol, Typography::tree()),
|
|
||||||
Span::raw(" "),
|
|
||||||
];
|
|
||||||
drive_spans.extend(StatusIcons::create_status_spans(drive.status.clone(), &drive_text));
|
|
||||||
lines.push(Line::from(drive_spans));
|
|
||||||
}
|
|
||||||
|
|
||||||
impl SystemWidget {
|
impl SystemWidget {
|
||||||
/// Render backup section for display
|
/// Render backup section for display
|
||||||
fn render_backup(&self) -> Vec<Line<'_>> {
|
fn render_backup(&self) -> Vec<Line<'_>> {
|
||||||
@@ -622,45 +592,205 @@ impl SystemWidget {
|
|||||||
lines
|
lines
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Format time ago from timestamp
|
/// Compress IPv4 addresses from same subnet
|
||||||
fn format_time_ago(&self, timestamp: u64) -> String {
|
/// Example: "192.168.30.1, 192.168.30.100" -> "192.168.30.1, 100"
|
||||||
let now = chrono::Utc::now().timestamp() as u64;
|
fn compress_ipv4_addresses(addresses: &[String]) -> String {
|
||||||
let seconds_ago = now.saturating_sub(timestamp);
|
if addresses.is_empty() {
|
||||||
|
return String::new();
|
||||||
let hours = seconds_ago / 3600;
|
|
||||||
let minutes = (seconds_ago % 3600) / 60;
|
|
||||||
|
|
||||||
if hours > 0 {
|
|
||||||
format!("{}h ago", hours)
|
|
||||||
} else if minutes > 0 {
|
|
||||||
format!("{}m ago", minutes)
|
|
||||||
} else {
|
|
||||||
"now".to_string()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if addresses.len() == 1 {
|
||||||
|
return addresses[0].clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut result = Vec::new();
|
||||||
|
let mut last_prefix = String::new();
|
||||||
|
|
||||||
|
for addr in addresses {
|
||||||
|
let parts: Vec<&str> = addr.split('.').collect();
|
||||||
|
if parts.len() == 4 {
|
||||||
|
let prefix = format!("{}.{}.{}", parts[0], parts[1], parts[2]);
|
||||||
|
|
||||||
|
if prefix == last_prefix {
|
||||||
|
// Same subnet, show only last octet
|
||||||
|
result.push(parts[3].to_string());
|
||||||
|
} else {
|
||||||
|
// Different subnet, show full IP
|
||||||
|
result.push(addr.clone());
|
||||||
|
last_prefix = prefix;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Invalid IP format, show as-is
|
||||||
|
result.push(addr.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result.join(", ")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Format time until from future timestamp
|
/// Render network section for display with physical/virtual grouping
|
||||||
fn format_time_until(&self, timestamp: u64) -> String {
|
fn render_network(&self) -> Vec<Line<'_>> {
|
||||||
let now = chrono::Utc::now().timestamp() as u64;
|
let mut lines = Vec::new();
|
||||||
if timestamp <= now {
|
|
||||||
return "overdue".to_string();
|
if self.network_interfaces.is_empty() {
|
||||||
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
let seconds_until = timestamp - now;
|
// Separate physical and virtual interfaces
|
||||||
let hours = seconds_until / 3600;
|
let physical: Vec<_> = self.network_interfaces.iter().filter(|i| i.is_physical).collect();
|
||||||
let minutes = (seconds_until % 3600) / 60;
|
let virtual_interfaces: Vec<_> = self.network_interfaces.iter().filter(|i| !i.is_physical).collect();
|
||||||
|
|
||||||
if hours > 0 {
|
// Find standalone virtual interfaces (those without a parent)
|
||||||
format!("in {}h", hours)
|
let mut standalone_virtual: Vec<_> = virtual_interfaces.iter()
|
||||||
} else if minutes > 0 {
|
.filter(|i| i.parent_interface.is_none())
|
||||||
format!("in {}m", minutes)
|
.collect();
|
||||||
} else {
|
|
||||||
"soon".to_string()
|
// Sort standalone virtual: VLANs first (by VLAN ID), then others alphabetically
|
||||||
|
standalone_virtual.sort_by(|a, b| {
|
||||||
|
match (a.vlan_id, b.vlan_id) {
|
||||||
|
(Some(vlan_a), Some(vlan_b)) => vlan_a.cmp(&vlan_b),
|
||||||
|
(Some(_), None) => std::cmp::Ordering::Less,
|
||||||
|
(None, Some(_)) => std::cmp::Ordering::Greater,
|
||||||
|
(None, None) => a.name.cmp(&b.name),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Render physical interfaces with their children
|
||||||
|
for (phy_idx, interface) in physical.iter().enumerate() {
|
||||||
|
let is_last_physical = phy_idx == physical.len() - 1 && standalone_virtual.is_empty();
|
||||||
|
|
||||||
|
// Physical interface header with status icon
|
||||||
|
let mut header_spans = vec![];
|
||||||
|
header_spans.extend(StatusIcons::create_status_spans(
|
||||||
|
interface.link_status.clone(),
|
||||||
|
&format!("{}:", interface.name)
|
||||||
|
));
|
||||||
|
lines.push(Line::from(header_spans));
|
||||||
|
|
||||||
|
// Find child interfaces for this physical interface
|
||||||
|
let mut children: Vec<_> = virtual_interfaces.iter()
|
||||||
|
.filter(|vi| {
|
||||||
|
if let Some(parent) = &vi.parent_interface {
|
||||||
|
parent == &interface.name
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
// Sort children: VLANs first (by VLAN ID), then others alphabetically
|
||||||
|
children.sort_by(|a, b| {
|
||||||
|
match (a.vlan_id, b.vlan_id) {
|
||||||
|
(Some(vlan_a), Some(vlan_b)) => vlan_a.cmp(&vlan_b),
|
||||||
|
(Some(_), None) => std::cmp::Ordering::Less,
|
||||||
|
(None, Some(_)) => std::cmp::Ordering::Greater,
|
||||||
|
(None, None) => a.name.cmp(&b.name),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Count total items under this physical interface (IPs + children)
|
||||||
|
let ip_count = interface.ipv4_addresses.len() + interface.ipv6_addresses.len();
|
||||||
|
let total_children = ip_count + children.len();
|
||||||
|
let mut child_index = 0;
|
||||||
|
|
||||||
|
// IPv4 addresses on the physical interface itself
|
||||||
|
for ipv4 in &interface.ipv4_addresses {
|
||||||
|
child_index += 1;
|
||||||
|
let is_last = child_index == total_children && is_last_physical;
|
||||||
|
let tree_symbol = if is_last { " └─ " } else { " ├─ " };
|
||||||
|
lines.push(Line::from(vec![
|
||||||
|
Span::styled(tree_symbol, Typography::tree()),
|
||||||
|
Span::styled(format!("ip: {}", ipv4), Typography::secondary()),
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
|
// IPv6 addresses on the physical interface itself
|
||||||
|
for ipv6 in &interface.ipv6_addresses {
|
||||||
|
child_index += 1;
|
||||||
|
let is_last = child_index == total_children && is_last_physical;
|
||||||
|
let tree_symbol = if is_last { " └─ " } else { " ├─ " };
|
||||||
|
lines.push(Line::from(vec![
|
||||||
|
Span::styled(tree_symbol, Typography::tree()),
|
||||||
|
Span::styled(format!("ip: {}", ipv6), Typography::secondary()),
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Child virtual interfaces (VLANs, etc.)
|
||||||
|
for child in children {
|
||||||
|
child_index += 1;
|
||||||
|
let is_last = child_index == total_children && is_last_physical;
|
||||||
|
let tree_symbol = if is_last { " └─ " } else { " ├─ " };
|
||||||
|
|
||||||
|
let ip_text = if !child.ipv4_addresses.is_empty() {
|
||||||
|
Self::compress_ipv4_addresses(&child.ipv4_addresses)
|
||||||
|
} else if !child.ipv6_addresses.is_empty() {
|
||||||
|
child.ipv6_addresses.join(", ")
|
||||||
|
} else {
|
||||||
|
String::new()
|
||||||
|
};
|
||||||
|
|
||||||
|
// Format: "name (vlan X): IP" or "name: IP"
|
||||||
|
let child_text = if let Some(vlan_id) = child.vlan_id {
|
||||||
|
if !ip_text.is_empty() {
|
||||||
|
format!("{} (vlan {}): {}", child.name, vlan_id, ip_text)
|
||||||
|
} else {
|
||||||
|
format!("{} (vlan {}):", child.name, vlan_id)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if !ip_text.is_empty() {
|
||||||
|
format!("{}: {}", child.name, ip_text)
|
||||||
|
} else {
|
||||||
|
format!("{}:", child.name)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
lines.push(Line::from(vec![
|
||||||
|
Span::styled(tree_symbol, Typography::tree()),
|
||||||
|
Span::styled(child_text, Typography::secondary()),
|
||||||
|
]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Render standalone virtual interfaces (those without a parent)
|
||||||
|
for (virt_idx, interface) in standalone_virtual.iter().enumerate() {
|
||||||
|
let is_last = virt_idx == standalone_virtual.len() - 1;
|
||||||
|
let tree_symbol = if is_last { " └─ " } else { " ├─ " };
|
||||||
|
|
||||||
|
// Virtual interface with IPs
|
||||||
|
let ip_text = if !interface.ipv4_addresses.is_empty() {
|
||||||
|
Self::compress_ipv4_addresses(&interface.ipv4_addresses)
|
||||||
|
} else if !interface.ipv6_addresses.is_empty() {
|
||||||
|
interface.ipv6_addresses.join(", ")
|
||||||
|
} else {
|
||||||
|
String::new()
|
||||||
|
};
|
||||||
|
|
||||||
|
// Format: "name (vlan X): IP" or "name: IP"
|
||||||
|
let interface_text = if let Some(vlan_id) = interface.vlan_id {
|
||||||
|
if !ip_text.is_empty() {
|
||||||
|
format!("{} (vlan {}): {}", interface.name, vlan_id, ip_text)
|
||||||
|
} else {
|
||||||
|
format!("{} (vlan {}):", interface.name, vlan_id)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if !ip_text.is_empty() {
|
||||||
|
format!("{}: {}", interface.name, ip_text)
|
||||||
|
} else {
|
||||||
|
format!("{}:", interface.name)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
lines.push(Line::from(vec![
|
||||||
|
Span::styled(tree_symbol, Typography::tree()),
|
||||||
|
Span::styled(interface_text, Typography::secondary()),
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
|
lines
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Render system widget
|
/// Render system widget
|
||||||
pub fn render(&mut self, frame: &mut Frame, area: Rect, hostname: &str, config: Option<&crate::config::DashboardConfig>) {
|
pub fn render(&mut self, frame: &mut Frame, area: Rect, hostname: &str, _config: Option<&crate::config::DashboardConfig>) {
|
||||||
let mut lines = Vec::new();
|
let mut lines = Vec::new();
|
||||||
|
|
||||||
// NixOS section
|
// NixOS section
|
||||||
@@ -677,30 +807,31 @@ impl SystemWidget {
|
|||||||
lines.push(Line::from(vec![
|
lines.push(Line::from(vec![
|
||||||
Span::styled(format!("Agent: {}", agent_version_text), Typography::secondary())
|
Span::styled(format!("Agent: {}", agent_version_text), Typography::secondary())
|
||||||
]));
|
]));
|
||||||
|
|
||||||
// Display detected connection IP
|
// ZMQ communication stats
|
||||||
if let Some(config) = config {
|
if let (Some(packets), Some(age)) = (self.zmq_packets_received, self.zmq_last_packet_age) {
|
||||||
if let Some(host_details) = config.hosts.get(hostname) {
|
let age_text = if age < 1.0 {
|
||||||
let detected_ip = host_details.get_connection_ip(hostname);
|
format!("{:.0}ms ago", age * 1000.0)
|
||||||
lines.push(Line::from(vec![
|
} else {
|
||||||
Span::styled(format!("IP: {}", detected_ip), Typography::secondary())
|
format!("{:.1}s ago", age)
|
||||||
]));
|
};
|
||||||
}
|
lines.push(Line::from(vec![
|
||||||
|
Span::styled(format!("ZMQ: {} pkts, last {}", packets, age_text), Typography::secondary())
|
||||||
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// CPU section
|
// CPU section
|
||||||
lines.push(Line::from(vec![
|
lines.push(Line::from(vec![
|
||||||
Span::styled("CPU:", Typography::widget_title())
|
Span::styled("CPU:", Typography::widget_title())
|
||||||
]));
|
]));
|
||||||
|
|
||||||
let load_text = self.format_cpu_load();
|
let load_text = self.format_cpu_load();
|
||||||
let cpu_spans = StatusIcons::create_status_spans(
|
let cpu_spans = StatusIcons::create_status_spans(
|
||||||
self.cpu_status.clone(),
|
self.cpu_status.clone(),
|
||||||
&format!("Load: {}", load_text)
|
&format!("Load: {}", load_text)
|
||||||
);
|
);
|
||||||
lines.push(Line::from(cpu_spans));
|
lines.push(Line::from(cpu_spans));
|
||||||
|
|
||||||
let freq_text = self.format_cpu_frequency();
|
let freq_text = self.format_cpu_frequency();
|
||||||
lines.push(Line::from(vec![
|
lines.push(Line::from(vec![
|
||||||
Span::styled(" └─ ", Typography::tree()),
|
Span::styled(" └─ ", Typography::tree()),
|
||||||
@@ -711,7 +842,7 @@ impl SystemWidget {
|
|||||||
lines.push(Line::from(vec![
|
lines.push(Line::from(vec![
|
||||||
Span::styled("RAM:", Typography::widget_title())
|
Span::styled("RAM:", Typography::widget_title())
|
||||||
]));
|
]));
|
||||||
|
|
||||||
let memory_text = self.format_memory_usage();
|
let memory_text = self.format_memory_usage();
|
||||||
let memory_spans = StatusIcons::create_status_spans(
|
let memory_spans = StatusIcons::create_status_spans(
|
||||||
self.memory_status.clone(),
|
self.memory_status.clone(),
|
||||||
@@ -723,16 +854,16 @@ impl SystemWidget {
|
|||||||
for (i, tmpfs) in self.tmpfs_mounts.iter().enumerate() {
|
for (i, tmpfs) in self.tmpfs_mounts.iter().enumerate() {
|
||||||
let is_last = i == self.tmpfs_mounts.len() - 1;
|
let is_last = i == self.tmpfs_mounts.len() - 1;
|
||||||
let tree_symbol = if is_last { " └─ " } else { " ├─ " };
|
let tree_symbol = if is_last { " └─ " } else { " ├─ " };
|
||||||
|
|
||||||
let usage_text = if tmpfs.total_gb > 0.0 {
|
let usage_text = if tmpfs.total_gb > 0.0 {
|
||||||
format!("{:.0}% {:.1}GB/{:.1}GB",
|
format!("{:.0}% {:.1}GB/{:.1}GB",
|
||||||
tmpfs.usage_percent,
|
tmpfs.usage_percent,
|
||||||
tmpfs.used_gb,
|
tmpfs.used_gb,
|
||||||
tmpfs.total_gb)
|
tmpfs.total_gb)
|
||||||
} else {
|
} else {
|
||||||
"— —/—".to_string()
|
"— —/—".to_string()
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut tmpfs_spans = vec![
|
let mut tmpfs_spans = vec![
|
||||||
Span::styled(tree_symbol, Typography::tree()),
|
Span::styled(tree_symbol, Typography::tree()),
|
||||||
];
|
];
|
||||||
@@ -743,6 +874,16 @@ impl SystemWidget {
|
|||||||
lines.push(Line::from(tmpfs_spans));
|
lines.push(Line::from(tmpfs_spans));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Network section
|
||||||
|
if !self.network_interfaces.is_empty() {
|
||||||
|
lines.push(Line::from(vec![
|
||||||
|
Span::styled("Network:", Typography::widget_title())
|
||||||
|
]));
|
||||||
|
|
||||||
|
let network_lines = self.render_network();
|
||||||
|
lines.extend(network_lines);
|
||||||
|
}
|
||||||
|
|
||||||
// Storage section
|
// Storage section
|
||||||
lines.push(Line::from(vec![
|
lines.push(Line::from(vec![
|
||||||
Span::styled("Storage:", Typography::widget_title())
|
Span::styled("Storage:", Typography::widget_title())
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cm-dashboard-shared"
|
name = "cm-dashboard-shared"
|
||||||
version = "0.1.158"
|
version = "0.1.199"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@@ -16,11 +16,30 @@ pub struct AgentData {
|
|||||||
/// System-level monitoring data
|
/// System-level monitoring data
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct SystemData {
|
pub struct SystemData {
|
||||||
|
pub network: NetworkData,
|
||||||
pub cpu: CpuData,
|
pub cpu: CpuData,
|
||||||
pub memory: MemoryData,
|
pub memory: MemoryData,
|
||||||
pub storage: StorageData,
|
pub storage: StorageData,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Network interface monitoring data
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct NetworkData {
|
||||||
|
pub interfaces: Vec<NetworkInterfaceData>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Individual network interface data
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct NetworkInterfaceData {
|
||||||
|
pub name: String,
|
||||||
|
pub ipv4_addresses: Vec<String>,
|
||||||
|
pub ipv6_addresses: Vec<String>,
|
||||||
|
pub is_physical: bool,
|
||||||
|
pub link_status: Status,
|
||||||
|
pub parent_interface: Option<String>,
|
||||||
|
pub vlan_id: Option<u16>,
|
||||||
|
}
|
||||||
|
|
||||||
/// CPU monitoring data
|
/// CPU monitoring data
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct CpuData {
|
pub struct CpuData {
|
||||||
@@ -130,6 +149,9 @@ pub struct SubServiceData {
|
|||||||
pub name: String,
|
pub name: String,
|
||||||
pub service_status: Status,
|
pub service_status: Status,
|
||||||
pub metrics: Vec<SubServiceMetric>,
|
pub metrics: Vec<SubServiceMetric>,
|
||||||
|
/// Type of sub-service: "nginx_site", "container", "image"
|
||||||
|
#[serde(default)]
|
||||||
|
pub service_type: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Individual metric for a sub-service
|
/// Individual metric for a sub-service
|
||||||
@@ -171,6 +193,9 @@ impl AgentData {
|
|||||||
build_version: None,
|
build_version: None,
|
||||||
timestamp: chrono::Utc::now().timestamp() as u64,
|
timestamp: chrono::Utc::now().timestamp() as u64,
|
||||||
system: SystemData {
|
system: SystemData {
|
||||||
|
network: NetworkData {
|
||||||
|
interfaces: Vec::new(),
|
||||||
|
},
|
||||||
cpu: CpuData {
|
cpu: CpuData {
|
||||||
load_1min: 0.0,
|
load_1min: 0.0,
|
||||||
load_5min: 0.0,
|
load_5min: 0.0,
|
||||||
|
|||||||
Reference in New Issue
Block a user