Install nagios monitoring in yum under centos6.5
I. Nagios Server Installation
1. yum install-y httpd php mysql-devel
2. Install the nagios program on the server
Wgethttp: // response
Http://down1.chinaunix.net/distfiles/nagios-plugins-1.4.14.tar.gz
/Usr/sbin/useraddnagios
Tar zxvfnagios-3.2.1.tar.gz
Cdnagios-3.2.1
./Configure -- prefix =/usr/local/nagios -- with-command-group = nagios
Make all
Make install; makeinstall-init; make install-config; make install-commandmode; make install-webconf
Makeinstall // to install the main program, CGI and HTML files
Makeinstall-init // install the startup script in/etc/rc. d/init. d.
Makeinstall-config // to install the sample configuration file. The installation path is/usr/local/nagios/etc.
Makeinstall-commandmode // to configure Directory Permissions
Makeinstall-webconf // configure integration between nagios and apache
3. Install the Nagios-plugins plug-in for monitoring
Tar zxvfnagios-plugins-1.4.14.tar.gz
Cdnagios-plugins-1.4.14
./Configure -- prefix =/usr/local/nagios -- with-nagios-user = nagios -- with-nagios-group = nagios
Make & make install
4. The server installs nrpe and communicates with the client.
Tar-xzf nrpe-2.14.tar.gz
Cd nrpe-2.14
./Configure -- enable-ssl -- with-ssl-lib
Make all
Make install-plugin & make install-daemon-config
Chown-R nagios. nagios/usr/local/nagios
5. nagios access control settings
Htpasswd-c/usr/local/nagios/etc/htpasswd. users nagiosadmin
Enter the password twice. This password will be used when you log on to the page.
6. Restart nagios and httpd services
Before restart
/Usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios. cfg check whether it is correct
Restart nagios,/etc/init. d/nagios restart;/etc/init. d/httpd restart;
7. Access user name for Nagios test: nagiosadmin
Http: // localhost/nagios/For example:
Click "Hosts" on the left to view the monitoring of the default localhost on the right. "UP" indicates that the host is currently running normally:
Click Services on the left to view the status of each service monitored by localhost on the right. Green OK indicates that the service is normal:
Cancel the speaker,
Click the "Enable configurations forthis service" icon.
Click commit
Error: cocould not opencommand file '/usr/local/nagios/var/rw/nagiosnand' for update! Error message: no permission,
Authorize this file chmod 777/usr/local/nagios/var/rw/nagiosNaNd
Error:
Http warning: HTTP/1.1 403 Forbidden-5159 bytes in 0.002 second response time (WARNING: HTTP/1.1 is not authorized to access this website-0.002 seconds response time 5159 bytes)
Create and authorize the newly created webpage index.html
Chmod o + w/var/www/html/index.html
Ii. Install the Nagios monitoring Client
1. Install nagios-plugins
Useradd-s/sbin/nologin nagios
Tar-xzf nagios-plugins-1.4.14.tar.gz
Cd nagios-plugins-1.4.14
./Configure -- prefix =/usr/local/nagios
& Make install
2. Install nrpe on the client
Tar -xzfnrpe-2.14.tar.gz & cd nrpe-2.14 &&
./Configure -- enable-ssl -- with-ssl-lib &&
Make all
Makeinstall-plugin & make install-daemon & makeinstall-daemon-config
Chown-R nagios: nagios/usr/local/nagios/
Run the following command to start the nrpe client:
/Usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe. cfg-d
3. Client nrpe settings
Vi/usr/local/nagios/etc/nrpe. cfg
Add the nagios Server IP address to the allowed_hosts = 127.0.0.1 Field
Allowed_hosts = 127.0.0.1, 192.168.1.151 or allowed_hosts = 127.0.0.1, 192.168.1.0/24