原文见:http://sharadchhetri.com/2013/05/19/installing-nagios-3-5-0-in-centos-6-4-using-yum/
#安装:rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpmyum install nagios nagios-devel nagios-plugins* gd gd-devel httpd php gcc glibc glibc-common openssl#设置密码, 默认用户名和密码都是nagiosadminhtpasswd -c /etc/nagios/passwd nagiosadmin #回车然后输入密码#检查以下配置是否一样:vi /etc/nagios/cgi.cfg============================= # AUTHENTICATION USAGE use_authentication=1 # SYSTEM/PROCESS INFORMATION ACCESS authorized_for_system_information=nagiosadmin # CONFIGURATION INFORMATION ACCESS authorized_for_configuration_information=nagiosadmin # SYSTEM/PROCESS COMMAND ACCESS authorized_for_system_commands=nagiosadmin # GLOBAL HOST/SERVICE VIEW ACCESS authorized_for_all_services=nagiosadmin authorized_for_all_hosts=nagiosadmin # GLOBAL HOST/SERVICE COMMAND ACCESS authorized_for_all_service_commands=nagiosadmin authorized_for_all_host_commands=nagiosadmin#========================================#设置开机自启动:chkconfig --level 3 nagios onchkconfig --level 3 httpd on#启动:/etc/init.d/httpd start/etc/init.d/nagios start#注意SELINUX和IPTABLE 以及你的80端口是否被占用
安装完成,http://ip/nagios 就能看到效果
下面配置要管理的节点:
#新建这个文件,里面添加要监控的机器 #vi /etc/nagios/conf.d/hosts.cfg#===================define host{use linux-serverhost_name mysql-node01alias mysql-node01address 192.168.1.110 #这个IP是我mysql机器所的IP}#=================
===
#添加被监控机器需要被监控那些项目 #vi /etc/nagios/conf.d/services.cfg#===========================define service{use generic-servicehost_name mysql-node01service_description PINGcheck_command check_ping!100.0,20%!500.0,60%}define service{use generic-servicehost_name mysql-node01service_description Current Loadcheck_command check_nrpe!check_load}define service{use generic-servicehost_name mysql-node01service_description Total Processescheck_command check_nrpe!check_users}#===========================#这里对mysql那台机器进行了3项监控: ping load totalProcesses#其中ping没用到nrpe
==============
#在末尾为nrpe添加命令 #vi /etc/nagios/objects/commands.cfg#===========================define command{command_name check_nrpecommand_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$}#==========================================
#各种重启/etc/init.d/nagios restart/etc/init.d/nrpe restart/etc/init.d/httpd restart注意iptables,服务端和客户端均需要5666端口能被互相访问
参考此文配置客户端:
配置完后,刷新nagios页面,就能看到mysql-node01了
附上一篇别人的:http://www.crsay.com/network/nagios-configure-is-simple.html
比较完整,有pnp的配置