我在Icinga 1.13中有一个设备显示为UNKNOWN的陷阱,因为MIB期望一个整数,但陷阱发送:
无法连接到SIP注册器无法与SIP注册器build立连接12848-49-55,45:52:45.50,044:4956585254584953464844485848 203活动的警报表错误types(应该是INTEGER):2
我不能修改设备上的MIB,所以我想我应该让Icinga把任何陷阱视为关键,不pipe它是否符合MIB。 我怎样才能做到这一点?
TL; DR:更新您的脚本以将$return_code设置为2。
感谢您的澄清。 你提到你正在使用ncsa和send_ncsa组合。
/usr/bin/printf "%s\t%s\t%s\t%s\n" "$1" "$2" "$return_code" "$4" | \ /usr/sbin/send_nsca -H XXX.XXX.219.31 -c /etc/nagios/send_nsca.cfg
Icinga 1和Nagios可以在Icinga服务器端使用ncsa (被动)接受检查结果。 这意味着,NCSA只是侦听某个TCP套接字,通过套接字接收结果并将接收到的数据推送给Icinga(Nagios)。
你的机器上的send_ncsa脚本然后接受将被馈入Nagios / Icinga的参数(AFAIK参数是host_name,service_name,service_result,service_message)。
你想在你的脚本中改变的部分是$return_code设置 – 它遵循标准的Icinga / Nagios行为 – 其中0是OK,1是WARNING,2是CRITICAL,3是UNKNOWN。
因此,为了将CRITICAL作为检查结果发送给Icinga,请更新脚本以将$return_code设置为2。
#!/bin/sh # Arguments: # $1 = host_name (Short name of host that the service is # associated with) # $2 = svc_description (Description of the service) # $3 = state_string (A string representing the status of # the given service - "OK", "WARNING", "CRITICAL" # or "UNKNOWN") # $4 = plugin_output (A text string that should be used # as the plugin output for the service checks) # $5 = Performance data # $6 = Service Check Commands # LOGFILE=/var/log/icinga/submit_check_result.log # Convert the state string to the corresponding return code return_code=2 case "$3" in OK) return_code=0 ;; WARNING) return_code=1 ;; CRITICAL) return_code=2 ;; UNKNOWN) return_code=2 ;; esac # pipe the service check info into the send_nsca program, which # in turn transmits the data to the nsca daemon on the central # monitoring server # submit to Cleveland Icinga Master /usr/bin/printf "%s\t%s\t%s\t%s\n" "$1" "$2" "$return_code" "$4" | /usr/sbin/send_nsca -H 111.222.333.44 -c /etc/nagios/send_nsca.cfg &