windows上categraf-v0.3.18-windows-amd64启动snmp报错

Viewed 90

windows上已经安装了net-snmp-5.4.2.1-1.win32, 但是categraf-v0.3.18-windows-amd64启动snmp报错:看着报错是和path配置有关系,但不知道具体是啥原因?

D:\Program Files\Prometheus\categraf-v0.3.18-windows-amd64>categraf.exe --test --interval 1 --inputs snmp
2023/12/12 15:39:13 I! tracing disabled
2023/12/12 15:39:13 main.go:128: I! runner.binarydir: D:\Program Files\Prometheus\categraf-v0.3.18-windows-amd64
2023/12/12 15:39:13 main.go:129: I! runner.hostname: DESKTOP-863HT3S
2023/12/12 15:39:13 main.go:130: I! runner.fd_limits: N/A
2023/12/12 15:39:13 main.go:131: I! runner.vm_limits: N/A
2023/12/12 15:39:13 provider_manager.go:61: I! use input provider: [local]
2023/12/12 15:39:13 traces_agent.go:19: I! traces agent disabled!
2023/12/12 15:39:13 prometheus_agent.go:19: I! prometheus scraping disabled!
2023/12/12 15:39:13 ibex_agent.go:19: I! ibex agent disabled!
2023/12/12 15:39:13 agent.go:39: I! agent starting
2023/12/12 15:39:13 metrics_agent.go:221: E! failed to load configuration of plugin: local.snmp error: toml: line 108 (last key "instances.path"): invalid escape in string '\S'
2023/12/12 15:39:13 agent.go:47: I! [*agent.MetricsAgent] started
2023/12/12 15:39:13 agent.go:50: I! agent started

##############以下为snmp配置#####################
[[instances]]
agents = ["udp://192.168.154.128:161"]
timeout = "5s"
version = 2

path = ["/usr/share/snmp/mibs"]

path = ["D:\Snmp\net-snmp\share\snmp\mibs"]
community = "public"
agent_host_tag = "switch"
retries = 1

[[instances.field]]
oid = ".1.3.6.1.2.1.1.3.0"
name = "uptime"

[[instances.field]]
oid = ".1.3.6.1.2.1.1.5.0"
name = "source"
is_tag = true

[[instances.table]]
oid = "IF-MIB::ifTable"
name = "interface"
inherit_tags = ["source"]
index_as_tag = true
include_filter = ["ifIndex:2","ifIndex:4"]

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

windows的mibs路径怎么配置?或者categraf高版本不用path参数?

1 Answers

\ 通常代表转义符 在加一个\试试, D:\Snmp\net-snmp\share\snmp\mibs