Move flags to their own modules
This commit is contained in:
7
main.go
7
main.go
@ -15,9 +15,6 @@ 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")
|
||||
ifIndexOffset := flag.Int("vpp-ifindex-offset", 1000, "Offset to add to VPP interface indices for SNMP")
|
||||
debug := flag.Bool("debug", false, "Enable debug logging")
|
||||
flag.Parse()
|
||||
|
||||
@ -41,7 +38,7 @@ func main() {
|
||||
client.ReconnectInterval = 1 * time.Second
|
||||
|
||||
// Create the interface MIB
|
||||
interfaceMIB := ifmib.NewInterfaceMIB(*ifIndexOffset)
|
||||
interfaceMIB := ifmib.NewInterfaceMIB()
|
||||
|
||||
// Register the interface MIB with the AgentX client
|
||||
if err := interfaceMIB.RegisterWithClient(client); err != nil {
|
||||
@ -49,7 +46,7 @@ func main() {
|
||||
}
|
||||
|
||||
// Start VPP stats routine with callback to update MIB
|
||||
vppstats.StartStatsRoutine(*vppStatsAddr, time.Duration(*period*1000)*time.Millisecond, interfaceMIB.UpdateStats)
|
||||
vppstats.StartStatsRoutine(interfaceMIB.UpdateStats)
|
||||
|
||||
for {
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
Reference in New Issue
Block a user