feat: collect and report 1-min load average

This commit is contained in:
2026-06-18 14:41:04 +01:00
parent 6756d19d93
commit b8ee27eec3
10 changed files with 139 additions and 4 deletions

View File

@@ -38,6 +38,7 @@ func (s *HTTPSender) Send(ctx context.Context, snap aggregate.Snapshot) error {
MemAvg: snap.MemAvg,
DiskAvg: snap.DiskAvg,
Uptime: snap.Uptime,
Load: snap.Load,
HostID: s.hostID,
Environment: s.env,
DBDriver: snap.DBDriver,

View File

@@ -22,11 +22,12 @@ func (s *LoggingSender) Send(ctx context.Context, snap aggregate.Snapshot) error
return ctx.Err()
default:
log.Printf(
"SEND cpu=%.2f%% mem=%.2f%% disk=%.2f%% uptime=%ds",
"SEND cpu=%.2f%% mem=%.2f%% disk=%.2f%% uptime=%ds load=%.2f",
snap.CPUAvg,
snap.MemAvg,
snap.DiskAvg,
snap.Uptime,
snap.Load,
)
return nil
}

View File

@@ -10,11 +10,12 @@ type SnapshotPayload struct {
MemAvg float64 `json:"mem_avg"`
DiskAvg float64 `json:"disk_avg"`
Uptime uint64 `json:"uptime"`
Load float64 `json:"load"`
HostID string `json:"host_id,omitempty"`
Environment string `json:"environment,omitempty"`
// Optional only present when DB monitoring is enabled.
// Optional. only present when DB monitoring is enabled.
// DBDriver is a numeric identifier: 1=mysql/mariadb 2=postgres 3=redis 4=mongodb 5=sqlite
DBDriver *uint8 `json:"db_driver,omitempty"`
DBConnPct *float64 `json:"db_conn_pct,omitempty"`