Install nagios on centos5.8
[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.
Start zmodem transmission. Press Ctrl + C to cancel.
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
Install the nagios web configuration file and create a user
Make install-webconf
Because the nagios configuration file specifies the password file storage path:/usr/local/nagios/etc/htpasswd. users
Add Monitoring Alarm email address
[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
Configure apache service
/Etc/init. d/httpd start
Chkconfig httpd on
If Apache is compiled and installed, its users and user groups are required by daemon by default.
X modify httpd. conf
Install the nagios Plugin:
[Root @ mode nagios-plugins-1.4.16] # ls/usr/local/nagios/libexec/| wc-l
61
Add nagios auto-start
Chkconfig add nagios
Two types of nagios Configuration File Syntax are verified:
/Usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios. cfg
/Etc/init. d/nagios checkconfig
Start nagios:
/Etc/init. d/nagios start
Then log on to: http: // ip/nagios
Install 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