consistent flag names & inclusive limits
This commit is contained in:
@@ -12,11 +12,11 @@ import (
|
|||||||
var (
|
var (
|
||||||
Waybar = flag.Bool("waybar", false, "output waybar json format")
|
Waybar = flag.Bool("waybar", false, "output waybar json format")
|
||||||
PingCount = flag.Int("count", 3, "how many pings to average")
|
PingCount = flag.Int("count", 3, "how many pings to average")
|
||||||
PingInterval = flag.Int("interval", 5, "ping interval")
|
PingInterval = flag.Int("i", 5, "ping interval")
|
||||||
PingWarningLimit = flag.Int("warning", 50, "ping warn limit")
|
PingWarningLimit = flag.Int("warn", 50, "ping warning limit")
|
||||||
PingCritLimit = flag.Int("crit", 100, "ping crit limit")
|
PingCritLimit = flag.Int("crit", 100, "ping critical limit")
|
||||||
PacketLossWarnLimit = flag.Int("pwarn", 10, "package loss warn limit")
|
PacketLossWarnLimit = flag.Int("pwarn", 10, "package-loss warning limit")
|
||||||
PacketLossCritLimit = flag.Int("pcrit", 25, "package loss crit limit")
|
PacketLossCritLimit = flag.Int("pcrit", 25, "package-loss critical limit")
|
||||||
Host = flag.String("host", "google.com", "host to ping")
|
Host = flag.String("host", "google.com", "host to ping")
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -66,9 +66,9 @@ func formatLineWaybar(stats *probing.Statistics) {
|
|||||||
res.Class = "good"
|
res.Class = "good"
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case int(math.Round(stats.PacketLoss)) > *PacketLossWarnLimit || int(stats.AvgRtt.Milliseconds()) > *PingWarningLimit:
|
case int(math.Round(stats.PacketLoss)) >= *PacketLossWarnLimit || int(stats.AvgRtt.Milliseconds()) >= *PingWarningLimit:
|
||||||
res.Class = "warning"
|
res.Class = "warning"
|
||||||
case int(math.Round(stats.PacketLoss)) > *PacketLossCritLimit || int(stats.AvgRtt.Milliseconds()) > *PingCritLimit:
|
case int(math.Round(stats.PacketLoss)) >= *PacketLossCritLimit || int(stats.AvgRtt.Milliseconds()) >= *PingCritLimit:
|
||||||
res.Class = "critical"
|
res.Class = "critical"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user