44 lines
1011 B
Go
44 lines
1011 B
Go
// Copyright 2025, IPng Networks GmbH, Pim van Pelt <pim@ipng.ch>
|
|
|
|
package main
|
|
|
|
import (
|
|
"flag"
|
|
"log"
|
|
|
|
"govpp-snmp-agentx/agentx"
|
|
"govpp-snmp-agentx/config"
|
|
"govpp-snmp-agentx/ifmib"
|
|
"govpp-snmp-agentx/vppstats"
|
|
)
|
|
|
|
func main() {
|
|
debug := flag.Bool("debug", false, "Enable debug logging")
|
|
vppcfg := flag.String("vppcfg", "", "VPP configuration YAML file to read interface descriptions from")
|
|
flag.Parse()
|
|
|
|
// Set global debug flag
|
|
config.Debug = *debug
|
|
|
|
// Create the interface MIB
|
|
interfaceMIB := ifmib.NewInterfaceMIB()
|
|
|
|
// Load VPP config if specified
|
|
if *vppcfg != "" {
|
|
if err := interfaceMIB.LoadVPPConfig(*vppcfg); err != nil {
|
|
log.Fatalf("Failed to load VPP config: %v", err)
|
|
}
|
|
}
|
|
|
|
// Start AgentX routine
|
|
if err := agentx.StartAgentXRoutine(interfaceMIB); err != nil {
|
|
log.Fatalf("Failed to start AgentX: %v", err)
|
|
}
|
|
|
|
// Start VPP stats routine with callback to update MIB
|
|
vppstats.StartStatsRoutine(interfaceMIB.UpdateStats)
|
|
|
|
// Keep the main routine running
|
|
select {}
|
|
}
|