/usr/sbin/useradd -m nagios /usr/sbin/useradd apache -M -s /sbin/nologin /usr/sbin/groupadd nagcmd /usr/sbin/usermod -a -G nagcmd nagios /usr/sbin/usermod -a -G nagcmd apache
1 2 3 4 5 6 7 8 9 10
tar zxvf nagios-3.2.2.tar.gz cd nagios-3.2.2 ./configure --with-command-group=nagcmd makeall make install make install-init make install-config make install-commandmode make install-webconf cd ..
vi /etc/httpd/conf/httpd.conf +231//查看是否为apache用户 vi /etc/httpd/conf/httpd.conf +265//在下面添加ServerName 127.0.0.1:80 service httpd start chkconfig httpd on ps -ef |grep httpd
安装Nagios插件
1 2 3 4 5 6 7 8 9 10 11 12 13
tar zxvf nagios-plugins-1.4.15.tar.gz cd nagios-plugins-1.4.15 ./configure --with-nagios-user=nagios --with-nagios-group=nagios --enable-perl-modules make make install tar zxvf net-snmp-5.4.2.1.tar.gz cd net-snmp-5.4.2.1 ./configure make make install cd .. service nagios start
安装 nrpe
1 2 3 4 5
tar zxvf nrpe-2.12.tar.gz cd nrpe-2.12 ./configure makeall make install-plugin
echo"export LC_ALL=C" >> /etc/profile source /etc/profile service iptables stop chkconfig iptables off usr/sbin/ntpdate pool.ntp.org uptime
#创建nagios需要的用户及组
1
/usr/sbin/adduser nagios –M
上传软件:
1 2 3 4 5 6 7 8
tar zxvf nagios-plugins-1.4.15.tar.gz cd nagios-plugins-1.4.15 ./configure --prefix=/usr/local/nagios --enable-perl-modules --enable-redhat-pthread-workaround make make install cd .. ls /usr/local/nagios/libexec/ |wc –l//查看安装的插件
安装 nrpe
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
tar zxvf nrpe-2.12.tar.gz cd nrpe-2.12 ./configure makeall make install-plugin make install-daemon make install-daemon-config cd .. #安装相关的插件 tar zxvf Nagios-Plugin-0.34.tar.gz cd Nagios-Plugin-0.34 perl Makefile.PL make make install cd ..
#配置nrpe
1 2 3
cd /usr/local/nagios/etc vi nrpe.cfg +79 allowed_hosts=127.0.0.1,10.0.10.86//添加可以监控该服务端的NagiosServer的IP