add -period flag

This commit is contained in:
Pim van Pelt
2025-06-09 17:20:58 +02:00
parent 6d6856d206
commit d4769d6cdb
2 changed files with 10 additions and 8 deletions

View File

@ -13,6 +13,8 @@ import (
func main() {
addr := flag.String("agentx-addr", "localhost:705", "Address to connect to (hostname:port or Unix socket path)")
vppStatsAddr := flag.String("vpp-stats-addr", "/var/run/vpp/stats.sock", "VPP stats socket path")
period := flag.Float64("period", 10.0, "Interval in seconds for querying VPP interface stats")
flag.Parse()
var network, address string
@ -32,7 +34,7 @@ func main() {
client.ReconnectInterval = 1 * time.Second
// Start VPP stats routine
vppstats.StartStatsRoutine()
vppstats.StartStatsRoutine(*vppStatsAddr, time.Duration(*period*1000)*time.Millisecond)
for {
time.Sleep(100 * time.Millisecond)