feat(18-05): wire SNMPCollector into Scheduler and main.go
- Add RegisterCollector method to Scheduler for external collector registration - Initialize ProfileCache with 5-min refresh in main.go - Initialize CounterCache using existing Redis client - Create and register SNMPCollector as "snmp" in scheduler - Start DiscoveryResponder for NATS SNMP device auto-detection - Existing RouterOS polling path completely unaffected Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -87,12 +87,19 @@ func NewScheduler(
|
||||
activeDevices: make(map[string]*deviceState),
|
||||
}
|
||||
|
||||
// Register built-in collectors. Future device types (SNMP) register here.
|
||||
// Register built-in collectors.
|
||||
s.collectors["routeros"] = NewRouterOSCollector(locker, credentialCache, connTimeout, cmdTimeout, lockTTL)
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// RegisterCollector adds a named Collector to the scheduler's dispatch map.
|
||||
// This allows external packages (e.g., SNMP) to register collectors without
|
||||
// modifying NewScheduler's parameter list.
|
||||
func (s *Scheduler) RegisterCollector(name string, c Collector) {
|
||||
s.collectors[name] = c
|
||||
}
|
||||
|
||||
// Run is the main scheduler loop. It:
|
||||
// 1. Fetches devices from the database.
|
||||
// 2. Starts goroutines for newly-discovered devices.
|
||||
|
||||
Reference in New Issue
Block a user