Added /health HTTP endpoint on port 8080 that returns:
- Agent status and version
- Uptime in seconds
- Pending metrics count
- Last error (if any)
Implementation:
- Uses lightweight tiny_http server in background thread
- Non-blocking health checks
- Returns JSON for easy integration with monitoring tools
- Ready for Kubernetes liveness/readiness probes
Example response:
{
"status": "healthy",
"version": "0.1.0",
"uptime_seconds": 3600,
"config_last_fetch": "2026-01-14T23:00:00Z",
"metrics_pending": 0,
"last_error": null
}
26 lines
635 B
TOML
26 lines
635 B
TOML
[package]
|
|
name = "towerops-agent"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
|
|
[dependencies]
|
|
snmp = "0.2"
|
|
ureq = { version = "2.10", features = ["json"] }
|
|
tokio = { version = "1", features = ["rt-multi-thread", "macros", "sync", "time"] }
|
|
serde = { version = "1.0", features = ["derive"] }
|
|
serde_json = "1.0"
|
|
rusqlite = { version = "0.32", features = ["bundled"] }
|
|
log = { version = "0.4", features = ["std"] }
|
|
clap = { version = "4.0", features = ["derive", "env"] }
|
|
prost = "0.13"
|
|
prost-types = "0.13"
|
|
tiny_http = "0.12"
|
|
|
|
[build-dependencies]
|
|
prost-build = "0.13"
|
|
|
|
[profile.release]
|
|
opt-level = "z"
|
|
lto = true
|
|
codegen-units = 1
|
|
strip = true
|