categraf0.2.35启动snmp报错

Viewed 190

[root@localhost categraf]# ./categraf -test --inputs snmp
2023/04/11 15:55:54 I! tracing disabled
2023/04/11 15:55:54 main.go:128: I! runner.binarydir: /opt/categraf
2023/04/11 15:55:54 main.go:129: I! runner.hostname: localhost.localdomain
2023/04/11 15:55:54 main.go:130: I! runner.fd_limits: (soft=524288, hard=524288)
2023/04/11 15:55:54 main.go:131: I! runner.vm_limits: (soft=unlimited, hard=unlimited)
2023/04/11 15:55:54 provider.go:69: I! use input provider: [local]
2023/04/11 15:55:54 traces_agent.go:19: I! traces agent disabled!
2023/04/11 15:55:54 prometheus_agent.go:19: I! prometheus scraping disabled!
2023/04/11 15:55:54 ibex_agent.go:19: I! ibex agent disabled!
2023/04/11 15:55:54 agent.go:39: I! agent starting
2023/04/11 15:55:54 metrics_agent.go:190: E! failed to init input: local.snmp error: initializing table interface ins: translating: exec: "snmptranslate": executable file not found in $PATH
2023/04/11 15:55:54 agent.go:47: I! [*agent.MetricsAgent] started
2023/04/11 15:55:54 agent.go:50: I! agent started
##############以下为snmp配置#####################
interval = 60

[[instances]]
agents = ["udp://192.168.10.254:161"]

interval_times = 1
timeout = "5s"
version = 2
community = "public"

agent_host_tag = "ident"
retries = 1

[[instances.field]]
oid = "RFC1213-MIB::sysUpTime.0"
name = "uptime"

[[instances.field]]
oid = "RFC1213-MIB::sysName.0"
name = "source"
is_tag = true

[[instances.table]]
oid = "IF-MIB::ifTable"
name = "interface"
inherit_tags = ["source"]

[[instances.table.field]]
oid = "IF-MIB::ifDescr"
name = "ifDescr"
is_tag = true

3 Answers

安装了net-snmp吗?

多谢

依赖snmptranslate ,要安装下

interface ins: translating: exec: "snmptranslate": executable file not found in $PATH

我的报错是这个:
./categraf -test --inputs snmp
2023/04/13 13:22:46 I! tracing disabled
2023/04/13 13:22:46 main.go:128: I! runner.binarydir: /usr/local/categraf
2023/04/13 13:22:46 main.go:129: I! runner.hostname: zy-centos7-1-35
2023/04/13 13:22:46 main.go:130: I! runner.fd_limits: (soft=4096, hard=4096)
2023/04/13 13:22:46 main.go:131: I! runner.vm_limits: (soft=unlimited, hard=unlimited)
2023/04/13 13:22:46 provider.go:69: I! use input provider: [local]
2023/04/13 13:22:46 traces_agent.go:19: I! traces agent disabled!
2023/04/13 13:22:46 prometheus_agent.go:19: I! prometheus scraping disabled!
2023/04/13 13:22:46 ibex_agent.go:19: I! ibex agent disabled!
2023/04/13 13:22:46 agent.go:39: I! agent starting
2023/04/13 13:22:46 agent.go:47: I! [*agent.MetricsAgent] started
2023/04/13 13:22:46 agent.go:50: I! agent started
已经安装net-snmp
yum -y install net-snmp
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
base | 3.6 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
Package 1:net-snmp-5.7.2-49.el7_9.2.x86_64 already installed and latest version
Nothing to do
但是问题没解决

没看到报错啊

是在服务端安装categraf然后修改conf/input.snmp/snmp.toml里的参数就能监控到网络设备然后在监控大屏上显示吗?

是不是我理解错了,感觉步骤都按着来了,但是设备监控不到