Initial Proxmox dashboard with host and guest metrics
This commit is contained in:
14
ups_test.go
Normal file
14
ups_test.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestUPSParsing(t *testing.T) {
|
||||
values := parseColonValues("battery.charge: 98.5\nups.status: OL\nbattery.runtime: 1200\n")
|
||||
metrics := upsFromValues("NUT", "ups", values)
|
||||
if metrics.ChargePercent == nil || *metrics.ChargePercent != 98.5 {
|
||||
t.Fatalf("неожиданный заряд: %v", metrics.ChargePercent)
|
||||
}
|
||||
if metrics.StatusLabel != "Питание от сети" {
|
||||
t.Fatalf("неожиданный статус: %s", metrics.StatusLabel)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user