Centos6.7 Nagios installation configuration

Nagios is an open source free network monitoring tool that can monitor Windows, Linux and Unix hosts, switches, routers and other network settings, printers, and so on. When an exception is in the system or the service status mail or SMS alert for the first time to inform site operation and maintenance personnel, the status returns to normal after email or SMS notifications. Nagios runs on Linux/UNIX platforms, along with an optional browser based WEB interface to facilitate administrator to view network status, system problems, and journals.
1. installation environment. Nagios needs the support of Apache and PHP, so to install Apache and PHP, in the Apache PHP module is loaded, and tests are correct. As shown below, this is a test script. There is also need to install the GD-devel-2.0.35-11.el6.x86_64 (yum install)
[root@lys htdocs]# cat index.php
2. the package, Nagios-4.0.8.tar.gz,Nagios-Plugins-2.1.1.tar.gz.
3. in order to follow does not affect the open page in browser test, we empty the iptables rules and temporarily turn off SElinux.
[Root@Lys ~]# empty the iptables rules
[root@lys ~]# setenforce 0
4. new Nagios users and groups
[root@lys ~]# useradd nagios
[root@lys ~]# usermod -M -s /sbin/nologin
[root@lys ~]# groupadd nagios
[root@lys ~]# usermod -G nagios nagios
5. I have downloaded the package, so it is directly extracted
[root@lys ~]# tar xf nagios-4.0.8.tar.gz
[root@lys nagios]# cd nagios-4.0.8
[root@lys nagios-4.0.8]#
6. initialized and set up compilation environment. (Pay special attention to your own installation path)
[root@lys nagios-4.0.8]#./configure –prefix=/mnt/cellar/nagios/ –with-nagios-user=nagios –with-nagios-group=nagios
[root@lys nagios-4.0.8]# make all
[Root@Lys Nagios-4.0.8]# make install//install binary files
[Root@Lys Nagios-4.0.8]# make install-init//initialization script
[Root@Lys Nagios-4.0.8]# make install-config//instance configuration file
[Root@Lys Nagios-4.0.8]#make install-commandmode//set the directory permissions
Complete the compile switches to the/mnt/cellar/Nagios/directory after installation, you can see the following directory and installed no problem.
[root@lys nagios-4.0.8]# cd /mnt/cellar/nagios/
[root@lys nagios]# ll
total 28
drwxrwxr-x 2 nagios nagios 4096 Nov 18 16:38 bin
drwxrwxr-x 3 nagios nagios 4096 Nov 18 16:57 etc
drwxr-xr-x 2 root root 4096 Nov 18 15:12 include
drwxrwxr-x 3 nagios nagios 4096 Nov 18 15:12 libexec
drwxrwxr-x 2 nagios nagios 4096 Nov 18 16:38 sbin
drwxrwxr-x 11 nagios nagios 4096 Nov 18 16:38 share
drwxrwxr-x 5 nagios nagios 4096 Nov 18 21:15 var
7. install the Nagios Web configuration file
[Root@Lys Nagios-4.0.8]# make install-webconf//Nagios Web profile
8. using Apache to create a basic WEB authentication methods. Creating a new admin user to manage Nagios Web interface, and the Admin user with a password.
[root@lys ~]# htpasswd -c /mnt/cellar/nagios/etc/htpasswd.users admin
[root@lys ~]# cat /mnt/cellar/nagios/etc/htpasswd.users
Only authenticated users admin can only be accessed through the WEB/mnt/cellar/Nagios/share and/mnt/cellar/Nagios/sbin the following content.
9.Nagios is powerful because it‘s a plug-in, so the following began to install Nagios-Plugins-2.1.1.tar.gz
[root@lys ~]# tar xf nagios-plugins-2.1.1.tar.gz
[root@lys ~]#cd nagios-plugins-2.1.1
[root@lys nagios-plugins-2.1.1]#./configure –prefix=/mnt/cellar/nagios/ –with-nagios-user=nagios –with-nagios-group=nagios
[root@lys nagios-4.0.8]# make &&make install
10. after the installation is ready, check correctness of configuration files.
[Root@Lys ~]#/mnt/cellar/Nagios/bin//mnt/cellar/Nagios/etc/Nagios.cfg//if there is no error, it indicates that the configuration file without problems.
11. make Nagios powerboot
[root@lys ~]# chkconfig –add nagios
[root@lys ~]# chkconfig nagios on
12. start Nagios
[root@lys ~]# service nagios start
[root@lys ~]# service nagios status
nagios (pid 2769) is running…
13.Nagios open after starting the browser shown
After you enter your user name and password:
When I was here before, Nagios page has an error:
Treatment methods:
1.[root@lys ~]# cd /mnt/cellar/nagios/etc/
2.[root@lys etc]# grep “use_authentication” *.cfg
3.[root@lys etc]#vi cgi.cfg
Use_authentication=1 # 1 modified as 0, and save
4. restart the Nagios service.