前面已经讲了Nagios监控设备的基本配置,这里主要记录了怎么监控用Nagios获取华为微波设备RTN380(H)的一些参数,如RSSI,容量,Modulation。
Nagios要想知道这些参数,要靠SNMP去查,所以必须知道要监控项目的OID。
一、新建服务。命令和服务模板是前面已经定义好的,下面也会列出来。这里服务与监控设备关联是靠hostgroup。
define service {
use ax-service
hostgroup_name rtn380
service_description RSSI
check_command ax-check_snmp!-C kjsd934js -P 1 -l RSSI -u ddbm -w $_HOSTRSSI_WARN_LEVEL$: -c $_HOSTRSSI_CRIT_LEVEL$: -o 1.3.6.1.4.1.2011.2.25.4.40.4.10.30.1.9.1.255
}
define service {
use ax-service
hostgroup_name rtn380
service_description Modulation
check_command ax-check_snmp!-C kjsd934js -P 1 -l Modulation -c $_HOSTMOD_LOW:$_HOSTMOD_HIGH -o 1.3.6.1.4.1.2011.2.25.4.40.3.10.50.1.1.1.255.1
# 1: QPSK 2: 16QAM 3: 32QAM 4: 64QAM 5: 128QAM 6: 256QAM 7: 512QAM
# 8: 1024QAM 9: QPSKSTRONG 10: 16QAMSTRONG 11: 512QAMLIGHT
# 12: 1024QAMLIGHT 13: 2048QAM
}
define service {
use ax-service
hostgroup_name rtn380
service_description Transmit Capacity
check_command ax-check_snmp!-C kjsd934js -P 1 -l TX-capacity -c $_HOSTCAP_WARN:$_HOSTCAP_CRIT -o 1.3.6.1.4.1.2011.2.25.4.40.3.10.50.1.5.1.255.1
}
ax-service 和 ax-check_snmp命令,名字随便起。
define service {
name ax-service
active_checks_enabled 1
passive_checks_enabled 1
parallelize_check 1
obsess_over_service 1
check_freshness 0
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 1
process_perf_data 0
retain_status_information 1
retain_nonstatus_information 1
is_volatile 0
check_period 24x7
max_check_attempts 3
check_interval 5
retry_interval 1
contact_groups neteng
notification_options w,u,c,r,f,s
notification_interval 60
notification_period 24x7
register 0
}
define command {
command_name ax-check_snmp
command_line $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name ax-check-host-alive
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 1000.0,10% -c 5000.0,100% -p 10
}
2、定义主机组和主机
define host {
name ax-host
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 1
process_perf_data 0
retain_status_information 1
retain_nonstatus_information 1
check_command ax-check-host-alive
check_interval 1
retry_interval 1
max_check_attempts 3
check_period 24x7
notification_period 24x7
notification_options d,u,r,s,f
notification_interval 120
first_notification_delay 0
contact_groups neteng
register 0
}
define host {
name ax-radio
use ax-host
register 0
}
define hostgroup {
hostgroup_name rtn380
alias Huawei RTN380s
}
define host {
use ax-radio
host_name Radio-link1
address 10.100.0.2
parents XXXX
hostgroups radios,rtn380
_RSSI_WARN_LEVEL -500
_RSSI_CRIT_LEVEL -600
_MOD_LOW 1
_MOD_HIGH 4
_CAP_WARN 1075
_CAP_CRIT 1075
icon_image signal.png
statusmap_image signal.png
}
define host {
use ax-radio
host_name Radio-link2
address 10.100.0.6
parents XXXX
hostgroups radios,rtn380
_RSSI_WARN_LEVEL -500
_RSSI_CRIT_LEVEL -600
_MOD_LOW 1
_MOD_HIGH 4
_CAP_WARN 1075
_CAP_CRIT 1075
icon_image signal.png
statusmap_image signal.png
}
这里几个参数, host_name 和 address 不用说了要写准确, _RSSI_WARN_LEVEL -500 指RSSI低于-500dbm开始告警, _RSSI_CRIT_LEVEL -600 指RSSI第一-600则发出critical告警。同样_MOD和_CAP是Modulation和容量的告警参数设置。
更新完配置文件,重启nagios,过一会就可以看到下面类似的监控界面了。
屏幕快照 2018-12-02 02.57.41.png