![](/img/trans.png)
[英]What is the meaning of SNMP's IF-MIB::ifIndex in IF-MIB::ifTable?
[英]What is the cause of “collectd - snmp.conf”: syntax error, unexpected EOL. Starting when new MIB is used
有許多類似於我的問題,但我無法找到適合我的解決方案。
我目前正在使用收集版本5.8的CentOS 7機器。
由於配置文件中的錯誤,collectd.service將無法啟動。 該配置文件位於/etc/collectd.d/snmp.conf
並從正確調用collectd.conf
文件。 我的錯誤如下:
Mar 30 01:16:24 localhost.localdomain collectd[18779]: Parse error in file `/etc/collectd.d/snmp.conf', line 19 near `<newline>': syntax error, unexpected EOL
Mar 30 01:16:24 localhost.localdomain collectd[18779]: yyparse returned error #1
Mar 30 01:16:24 localhost.localdomain collectd[18779]: configfile: Cannot read file `/etc/collectd.d/snmp.conf'.
Mar 30 01:16:24 localhost.localdomain collectd[18779]: Unable to read config file /etc/collectd.conf.
Mar 30 01:16:24 localhost.localdomain collectd[18779]: Error: Reading the config file failed!
Mar 30 01:16:24 localhost.localdomain collectd[18779]: Read the logs for details.
Mar 30 01:16:24 localhost.localdomain systemd[1]: collectd.service: main process exited, code=exited, status=1/FAILURE
Mar 30 01:16:24 localhost.localdomain systemd[1]: Failed to start Collectd statistics daemon.
我的代碼中找不到任何與眾不同的東西,也許你們可以找到問題所在。
我發生錯誤的snmp.conf文件如下:
<Plugin snmp
<Data "if_octets">
Type "if_octets"
Table true
Instance "IF-MIB::ifDescr"
Values "IF-MIB::ifOutOctets" "IF-MIB::ifInOctets"
</Data>
<Data "if_speed">
Type "bitrate"
Table true
Instance "IF-MIB::ifDescr"
Values "IF-MIB::ifSpeed"
</Data>
<Data "temperature">
Type "temperature"
Table false
Instance "device"
Scale 0.1
Values "MIKROTIK-MIB::mtxrHlTemperature.0"
</Data>
<Data "processorTemperature">
Type "temperature"
Table false
Instance "processor"
Scale 0.1
Values "MIKROTIK-MIB::mtxrHlProcessorTemperature.0"
</Data>
<Data "fanspeed">
Type "fanspeed"
Table false
Type "fanspeed"
Table false
Instance "fan_speed"
Values "MIKROTIK-MIB::mtxrHlFanSpeed1.0"
</Data>
<Host "best_server_ever">
Address 127.0.0.1
Version 2
Community "public"
Collect "if_speed" "temperature" "processorTemperature" "fanspeed"
Interval 120
Timeout 10
Retries 1
</Host>
<Host "smallest_server_ever">
Address 127.0.0.1
Version 2
Community "public"
Collect "if-speed" "temperature" "processorTemperature" "fanspeed"
Interval 120
Timeout 10
Retries 1
</Host>
</Plugin>
錯誤發生在第19行,這是我使用備用MIB的行,MIB位於/usr/share/snmp/mibs/
,我之前使用過它。
Selinux目前處於許可模式,因此這不是導致問題的原因。 此外,MIB的文件權限與每個其他MIB的文件權限相同。
好吧,忘了在snmp配置文件頂部關閉大於號的符號。 到目前為止,這不是我最聰明的舉動......
請注意每個人都會收到此錯誤: 幾乎總是在發生此錯誤時,這是一個簡單的拼寫錯誤/語法錯誤,並不總是出現在上述行中。 大多數情況下,它出現在上述文件的前一行中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.