snmp配置如下
[[instances]]
agents = ["udp://10.0.32.1:161"]
timeout = "5s"
#version = 2
#community = "public"
version = 3
sec_level = "authPriv"
sec_name = "snmpadmin"
auth_protocol = "SHA"
auth_password = "*********"
priv_protocol = "AES"
priv_password = "*********"
agent_host_tag = "switch_core_10.0.32.1"
retries = 1
[[instances.field]]
oid = "SNMPv2-SMI::mib-2.3.1.1.3.70.1.10.0.208.254"
name = "IpAddress"
通过命令行snmpwalk 是可以获取到数据的
categraf测试数据如下
[root@n9e categraf]# ./categraf -test --inputs snmp
2023/04/25 09:37:48 I! tracing disabled
2023/04/25 09:37:48 main.go:128: I! runner.binarydir: /opt/categraf
2023/04/25 09:37:48 main.go:129: I! runner.hostname: n9e.novalocal
2023/04/25 09:37:48 main.go:130: I! runner.fd_limits: (soft=4096, hard=4096)
2023/04/25 09:37:48 main.go:131: I! runner.vm_limits: (soft=unlimited, hard=unlimited)
2023/04/25 09:37:48 provider.go:69: I! use input provider: [local]
2023/04/25 09:37:48 traces_agent.go:19: I! traces agent disabled!
2023/04/25 09:37:48 prometheus_agent.go:19: I! prometheus scraping disabled!
2023/04/25 09:37:48 agent.go:39: I! agent starting
2023/04/25 09:37:48 metrics_agent.go:209: I! input: local.snmp started
2023/04/25 09:37:48 agent.go:47: I! [*agent.MetricsAgent] started
2023/04/25 09:37:48 agent.go:47: I! [*agent.IbexAgent] started
2023/04/25 09:37:48 agent.go:50: I! agent started
2023/04/25 09:37:48 heartbeat.go:19: I! ibex agent start rolling request Server.Report.
09:37:48 snmp_IpAddress agent_hostname=n9e-10.0.6.2 switch_core_10.0.32.1=10.0.32.1 10.0.208.254
2023/04/25 09:37:49 cli.go:84: I! choose server: 127.0.0.1:20090, duration: 1ms
09:38:48 snmp_IpAddress agent_hostname=n9e-10.0.6.2 switch_core_10.0.32.1=10.0.32.1 10.0.208.254
09:39:48 snmp_IpAddress agent_hostname=n9e-10.0.6.2 switch_core_10.0.32.1=10.0.32.1 10.0.208.254
09:40:48 snmp_IpAddress agent_hostname=n9e-10.0.6.2 switch_core_10.0.32.1=10.0.32.1 10.0.208.254
夜莺监控显示