wget http://osdn.dl.sourceforge.net/s ... nagios-3.0.5.tar.gzwget http://osdn.dl.sourceforge.net/s ... ugins-1.4.11.tar.gz
/usr/sbin/useradd -m nagiospasswd nagios
/usr/sbin/groupadd nagcmd/usr/sbin/usermod -a -G nagcmd nagios/usr/sbin/usermod -a -G nagcmd daemon# daemon为运行apache的帐号。
tar xzf nagios-3.0.5.tar.gzcd nagios-3.0.5./configure –with-command-group=nagcmd –with-gd-lib=/usr/local/libgd/lib/ –with-gd-inc=/usr/local/libgd/include/make all# 使用make install来安装主程序,CGI和HTML文件make install# 使用make install-init在/etc/rc.d/init.d安装启动脚本make install-init# 使用make install-cofig来安装示例配置文件,安装的路径是/usr/local/nagios/etc.make install-config# 使用make install-commandmode来配置目录权限make install-commandmode
----------------------------------------ScriptAlias /nagios/cgi-bin “/usr/local/nagios/sbin”<Directory “/usr/local/nagios/sbin”># SSLRequireSSLOptions ExecCGIAllowOverride NoneOrder allow,denyAllow from all# Order deny,allow# Deny from all# Allow from 127.0.0.1AuthName “Nagios Access”AuthType BasicAuthUserFile /usr/local/nagios/etc/htpasswd.usersRequire valid-user</Directory>Alias /nagios “/usr/local/nagios/share”<Directory “/usr/local/nagios/share”># SSLRequireSSLOptions NoneAllowOverride NoneOrder allow,denyAllow from all# Order deny,allow# Deny from all# Allow from 127.0.0.1AuthName “Nagios Access”AuthType BasicAuthUserFile /usr/local/nagios/etc/htpasswd.usersRequire valid-user</Directory>----------------------------------------
/usr/local/apache/bin/htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadminNew password: (输入密码)Re-type new password: (再输入一次密码)Adding password for user nagiosadmin
/usr/local/apache/bin/apachectl -k restart
vi /usr/local/nagios/etc/objects/contacts.cfg# 将里面的email地址改为自己的email地址。
tar xzf nagios-plugins-1.4.11.tar.gzcd nagios-plugins-1.4.11./configure –with-nagios-user=nagios –with-nagios-group=nagiosmakemake install
# 配置机器启动时自动启动Nagioschkconfig –add nagioschkconfig nagios on# 检查Nagios配置文件/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg# 启Nnagiosservice nagios start
vi /etc/selinux/config# 将下面行设为disabledSELINUX=disabled# 重启系统
http://localhost/nagios/输入用户名及密码登录。
tar xzvf nrpe-2.12.tar.gzcd nrpe-2.12./configure --enable-command-args(带参数传递)make all
make install-plugin
vi /usr/local/nagios/etc/objects/commands.cfg############################################################## 2008.11.18 add by Stone# NRPE COMMAND############################################################## ‘check_nrpe ‘ command definitiondefine command{command_name check_nrpecommand_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$}
useradd nagiostar xzvf nagios-plugins-1.4.13.tar.gzcd nagios-plugins-1.4.13
./configuremakemake installchown nagios.nagios /usr/local/nagios/chown -R nagios.nagios /usr/local/nagios/libexec/tar xzvf nrpe-2.12.tar.gzcd nrpe-2.12./configuremake all# 安装nrpe插件,本监控端可以不装make install-plugin# 安装nrpe守护进程make install-daemon# 安张nrpe配置文件make install-daemon-config# 修改nrpe配置文件,允许Nagios监控服务器(192.168.0.19)监控vi nrpe.cfg# 多台机器用逗号隔开allowed_hosts=127.0.0.1,192.168.0.19# 以独立守护进程启动nrpe,也可以使用xinetd启动nrpe,具体清查看nrpe官方文档。/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d# 开机自动启动nrpevi /etc/rc.d/rc.local# 加入下面行/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d# 检查nrpe是否安装正常[root@wiki etc]# /usr/local/nagios/libexec/check_nrpe -H localhostNRPE v2.12# 返回nrpe版本说明安装没问题。# 查看启动端口[root@wiki ~]# netstat -tunlpActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program nametcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN 27387/nrpe
iptables -I eth0 -p tcp -m tcp -dport 5666 -j ACCEPT
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Zcommand[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200
command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%
command[check_disk_root]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /
posted on 2011-09-29 16:08 大龙 阅读(450) 评论(0) 编辑 收藏 引用
Powered by: C++博客 Copyright © 大龙