标签:
安装
apt-get update
apt-get install nagios* perl
apt-get install --no-install-recommends pnp4nagios
apt-get install apache2 apache2-utils php5 php-pear
修改npcd设置
# vim /etc/default/npcd
Run="yes"
# service npcd start
# ‘process-host-perfdata‘ command definition 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" >> /var/lib/nagios3/host-perfdata.out command_line /usr/bin/perl /usr/lib/pnp4nagios/libexec/process_perfdata.pl } # ‘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" >> /var/lib/nagios3/service-perfdata.out command_line /usr/bin/perl /usr/lib/pnp4nagios/libexec/process_perfdata.pl }
删除install.php
# cd /usr/share/pnp4nagios/html
# mv install.php install.php.bak
define host { name host-pnp action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$‘class=‘tips‘rel=‘/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=_HOST_ register 0 process_perf_data 1 } define service { name srv-pnp action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$‘class=‘tips‘rel=‘/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVICEDESC$ register 0 process_perf_data 1 }
define command{ command_name check_mem command_line $USER1$/check_mem.sh -w $ARG1$ -c $ARG2$ }
define service{ use local-service,srv-pnp host_name localhost service_description check_mem check_command check_mem!80!90 }
com2sec notConfigUser 127.0.0.1 public com2sec notConfigUser localhost-IP public group notConfigGroup v1 notConfigUser group notConfigGroup v2c notConfigUser view systemview included .1.3.6.1.2.1.1 view systemview included .1.3.6.1.2.1.2 view systemview included .1.3.6.1.2.1.25.1.1 view all included .1 access notConfigGroup "" any noauth exact all none none
重启snmpd服务
下载check_traffic.sh到插件目录
cd /usr/lib/nagios/plugins/
测试执行
./check_traffic.sh -V 2c -C public -H your_ip -I 2 -w 1200,1500 -c 1700,1800 -K -B
# vi /etc/nagios3/conf.d/custom_commond.cfg 追加
define command{ command_name check_traffic command_line $USER1$/check_traffic.sh -V 2c -C public -H $HOSTADDRESS$ -I $ARG1$ -w $ARG2$ -c $ARG3$ -M -b }
当服务停止时重新监控失败,运行以下2行命令
# dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw
# dpkg-statoverride --update --add nagios www-data 751 /var/lib/nagios3
AuthUser=NagiosAdmin AuthPass=PassWord FromLineOverride=YES mailhub=smtp.gmail.com:587 UseSTARTTLS=YES
service sendmail stop
chkconfig sendmail off
cd /usr/sbin
mv sendmail sendmail.bak
ln -s /usr/sbin/ssmtp /usr/sbin/sendmail
测试发邮件即可
define command{ command_name custom_check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ }
标签:
原文地址:http://www.cnblogs.com/Mrhuangrui/p/4638083.html