centos5.8上nagios服務端安裝
[root@mode yum.repos.d]# useradd -s /sbin/nologin nagios[root@mode yum.repos.d]# mkdir /usr/local/nagios[root@mode yum.repos.d]# chown -R nagios.nagios /usr/local/nagios[root@mode yum.repos.d]# ll -d /usr/local/nagiosdrwxr-xr-x 2 nagios nagios 4096 Mar 17 06:14 /usr/local/nagios[root@mode yum.repos.d]# cd /home/oldboy/tools/[root@mode tools]# rzrz waiting to receive.
開始 zmodem 傳輸。 按 Ctrl+C 取消。
100% 1742 KB 1742 KB/s 00:00:01 0 Errors[root@mode tools]# tar zxf nagios-3.4.3.tar.gz[root@mode tools]# cd nagios[root@mode nagios]# ./configure --prefix=/usr/local/nagios[root@mode nagios]# make all[root@mode nagios]# make installroot@mode nagios]# make install-init[root@mode nagios]# make install-config[root@mode nagios]# make install-commandmode
安裝nagios web 設定檔及建立使用者
make install-webconf
因為nagios的設定檔指定了密碼檔案的存放路徑就是/usr/local/nagios/etc/htpasswd.users
添加監控警示的email 地址
[root@mode nagios]# sed -i 's#nagios@localhost#1204070172@qq.com#' /usr/local/nagios/etc/objects/contacts.cfgroot@mode nagios]# /etc/init.d/sendmail startStarting sendmail:[root@mode nagios]# /etc/init.d/sendmail statussendmail (pid 3203) is running...[root@mode nagios]# cat /etc/hosts# Do not remove the following line, or various programs# that require network functionality will fail.127.0.0.1 mode localhost.localdomain localhost::1 localhost6.localdomain6 localhost6[root@mode nagios]# hostnamemode[root@mode nagios]# chkconfig sendmail on[root@mode nagios]# chkconfig --list onerror reading information on service on: No such file or directory[root@mode nagios]# chkconfig --list sendmailsendmail 0:off 1:off 2:on 3:on 4:on 5:on 6:off[root@mode nagios]# netstat -lntActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address Statetcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTENtcp 0 0 0.0.0.0:841 0.0.0.0:* LISTENtcp 0 0 0.0.0.0:111 0.0.0.0:* LISTENtcp 0 0 0.0.0.0:55924 0.0.0.0:* LISTENtcp 0 0 0.0.0.0:789 0.0.0.0:* LISTENtcp 0 0 0.0.0.0:757 0.0.0.0:* LISTENtcp 0 0 0.0.0.0:22 0.0.0.0:* LISTENtcp 0 0 127.0.0.1:25 0.0.0.0:* LISTENtcp 0 0 :::22 :::* LISTEN
配置apache服務
/etc/init.d/httpd start
chkconfig httpd on
如果Apache是編譯安裝的,那麼它的使用者和使用者組預設是daemon需要
x修改httpd.conf
安裝nagios外掛程式:
[root@mode nagios-plugins-1.4.16]# ls /usr/local/nagios/libexec/|wc -l
61
添加nagios開機自啟動
chkconfig add nagios
驗證nagios 設定檔文法兩種:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
/etc/init.d/nagios checkconfig
啟動nagios:
/etc/init.d/nagios start
然後登陸:http://ip/nagios
安裝nrpe
[root@mode yum.repos.d]# useradd -s /sbin/nologin nagios[root@mode yum.repos.d]# mkdir /usr/local/nagios[root@mode yum.repos.d]# chown -R nagios.nagios /usr/local/nagios[root@mode yum.repos.d]#
[root@mode tools]# tar zxf nrpe-2.12.tar.gz
[root@mode tools]# cd nrpe-2.12
[root@mode nrpe-2.12]# ./configure
[root@mode nrpe-2.12]# make all
[root@mode nrpe-2.12]# make install-plugin
[root@mode nrpe-2.12]# make install-daemon
[root@mode nrpe-2.12]# make install-daemon-config
[root@mode nrpe-2.12]# ls /usr/local/nagios/libexec/|wc -l
62