Implement nginx site latency monitoring and improve disk usage display

Agent improvements:
- Add reqwest dependency for HTTP latency testing
- Implement measure_site_latency() function for nginx sites
- Add latency_ms field to ServiceData structure
- Measure response times for nginx sites using HEAD requests
- Handle connection failures gracefully with 5-second timeout
- Use HTTPS for external sites, HTTP for localhost

Dashboard improvements:
- Add latency_ms field to ServiceInfo structure
- Display latency for nginx sites: "docker.cmtec.se 134ms"
- Only show latency for nginx sub-services, not other services
- Change disk usage "0" to "<1MB" for better readability

The Services widget now shows:
- Nginx sites with response times when measurable
- Cleaner disk usage formatting for small values
- Improved user experience with meaningful latency data
This commit is contained in:
2025-10-14 19:38:36 +02:00
parent c6e8749ddd
commit fd8aa0678e
4 changed files with 61 additions and 4 deletions

View File

@@ -22,3 +22,4 @@ futures = "0.3"
rand = "0.8"
gethostname = "0.4"
lettre = { version = "0.11", default-features = false, features = ["smtp-transport", "builder"] }
reqwest = { version = "0.11", features = ["json"] }