nginx服务器中配置nagios监控软件时,经常用到的一个文件commands.cfg nagios commands.cfg nagios监控Linux/windows的常用配置,以snmp、nrpe实现。
代码:
复制代码代码示例:
# 'process-host-perfdata' command definition
(责任编辑:IT)define command{ command_name process-host-perfdata #command_line /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /usr/local/nagios/var/host-perfdata.out command_line /usr/local/pnp4nagios/libexec/process_perfdata.pl -d HOSTPERFDATA #command_line /usr/local/pnp4nagios/libexec/process_perfdata.pl --bulk=/usr/local/pnp4nagios/var/host-perfdata } # 'process-service-perfdata' command definition define command{ command_name process-service-perfdata #command_line /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$ SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /usr/local/nagios/var/service-perfdata.out command_line /usr/local/pnp4nagios/libexec/process_perfdata.pl #command_line /usr/local/pnp4nagios/libexec/process_perfdata.pl --bulk=/usr/local/pnp4nagios/var/service-perfdata } ###nrpe #'check_nrpe ' command definition define command{ command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ } ###linux commond # 'check_snmp_load' command definition define command{ command_name check_snmp_load #command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ -C jd $ARG1$ $ARG2$ command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ -C jd -w $ARG1$ -c $ARG2$ -T netsl -f } # 'check_snmp_proc" command definition define command{ command_name check_snmp_proc command_line /usr/local/nagios/libexec/check_snmp_process.pl -H $HOSTADDRESS$ -C jd $ARG1$ $ARG2$ -f } # 'check_snmp_cpu' command definition,check cpu usage define command { command_name check_snmp_cpu command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ -C jd -w $ARG1$ -c $ARG2$ -T netsc -f } # 'check_snmp_memory' command definition define command{ command_name check_snmp_memory command_line $USER1$/check_snmp_mem.pl -H $HOSTADDRESS$ -C jd -w $ARG1$ -c $ARG2$ -f } # 'check_snmp_netio' command definition define command{ command_name check_snmp_trafic command_line $USER1$/check_traffic.sh -V 2c -C jd -H $HOSTADDRESS$ -I 0 -w $ARG1$ -c $ARG2$ -M -b } # 'check_snmp_disk_linux' command definition define command{ command_name check_snmp_disk_linux command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ -C jd -m "^/" -w 80% -c 90% -f } # 'check_snmp_disk_win' command definition define command{ command_name check_snmp_disk_win command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ -C jd -m "^C:" -w 80% -c 90% -f } # 'check_snmp_mem' command definition define command{ command_name check_snmp_mem command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ -C jd -m "memory|Memory" -w 80% -c 90% -f } # 'snmp_cpustats' command definition define command{ command_name snmp_cpustats command_line /usr/local/nagios/libexec/check_snmp -H $HOSTADDRESS$ -C jd -o .1.3.6.1.4.1.2021.11.9.0 -w $ARG1$ -c $ARG2$ -l "user CPU time:" -u "%" -o .1.3.6.1.4.1.2021.11.10.0 -w $ARG3$ -c $ARG4$ -l "system CPU time:" -u "%" -o .1.3.6.1.4.1.2021.11.11.0 -w $ARG5$ -c $ARG6$ -l "idle CPU time:" -u "%" } ###windows command # 'check_snmp_win_cpu' define command{ command_name check_snmp_win_cpu command_line $USER1$/check_snmp_cpu.sh -H $HOSTADDRESS$ -C jd -w $ARG1$ -c $ARG2$ } # 'check_snmp_win_service' define command{ command_name check_snmp_win_service command_line $USER1$/check_snmp_win.pl -H $HOSTADDRESS$ -C jd -n $ARG1$ -N $ARG2$ } # 'check_snmp_win_disk_c' define command{ command_name check_snmp_win_disk_c command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ -C jd -m ^C: -w $ARG1$ -c $ARG2$ -f } # 'check_snmp_win_mem' define command{ command_name check_snmp_win_mem command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ -C jd -m Memory -w $ARG1$ -c $ARG2$ -f } # 'check_snmp_win_net' #define command{ # command_name check_snmp_win_net # command_line $USER1$/check_traffic.sh -V 2c -H $HOSTADDRESS$ -C jd -I 0 -w $ARG1$ -c $ARG2$ -M -b #} ###os command define command{ command_name check_snmp_os_info command_line $USER1$/check_snmp -H $HOSTADDRESS$ -C jd -o sysDescr.0 } |