Add SNMP v2c probing and results endpoint.

Probe sysName/sysDescr/sysObjectID for alive hosts, persist SNMP outcomes, and expose scan SNMP data via REST.

Made-with: Cursor
This commit is contained in:
Andrey Lutsenko
2026-04-09 21:56:31 +10:00
parent e9452dcc0a
commit cca4477792
10 changed files with 234 additions and 3 deletions
+12
View File
@@ -7,6 +7,8 @@ type Config struct {
DBDSN string
StoreBackend string
RunMigrations bool
SNMPEnabled bool
SNMPCommunity string
}
func FromEnv() Config {
@@ -29,11 +31,21 @@ func FromEnv() Config {
if os.Getenv("RUN_MIGRATIONS") == "false" {
runMigrations = false
}
snmpEnabled := true
if os.Getenv("SNMP_ENABLED") == "false" {
snmpEnabled = false
}
snmpCommunity := os.Getenv("SNMP_COMMUNITY")
if snmpCommunity == "" {
snmpCommunity = "public"
}
return Config{
HTTPAddr: addr,
DBDSN: dbDSN,
StoreBackend: storeBackend,
RunMigrations: runMigrations,
SNMPEnabled: snmpEnabled,
SNMPCommunity: snmpCommunity,
}
}