Friday, December 5, 2014

nagios installation on centos 7

Leave a Comment
In this articles, how to nagios installation on centos 7, The Nagios to monitoring for your system such as: CPU load, disk usage,etc. it's open soure and design for linux operating system.

After nagios installation end up

  • Nagios and plugins is installed in /usr/local/nagios
  • Nagios to monitor of your system ( CPU load, disk usage, etc.)
  • Nagios web interface at http://localhost/nagios/

Nagios installation the prerequisites 

You are sure installed the packages below before install nagios
  • Apache
  • PHP
  • GCC compiler
  • GD development libraries

 Nagios installation

you can check the packages Apache, PHP, GCC compiler and GD development libraries installed in your system use command line below:
rpm -qa
 [root@localhost ~]# rpm -qa gcc glibc glibc-common httpd php gd gd-devel
glibc-2.17-55.el7.x86_64
glibc-common-2.17-55.el7.x86_64
gcc-4.8.2-16.el7.x86_64
httpd-2.4.6-17.el7.centos.1.x86_64
php-5.4.16-21.el7.x86_64
 OR
yum list installed
[root@localhost ~]# yum list installed
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.vhost.vn
 * extras: mirror.vietoss.com
 * updates: mirror.vietoss.com
Installed Packages
ModemManager-glib.x86_64         1.1.0-6.git20130913.el7              @anaconda
NetworkManager.x86_64            1:0.9.9.1-13.git20140326.4dba720.el7 @anaconda
NetworkManager-glib.x86_64       1:0.9.9.1-13.git20140326.4dba720.el7 @anaconda
NetworkManager-tui.x86_64        1:0.9.9.1-13.git20140326.4dba720.el7 @anaconda
acl.x86_64                       2.2.51-12.el7                        @anaconda
aic94xx-firmware.noarch          30-6.el7                             @anaconda
alsa-firmware.noarch             1.0.27-2.el7                         @anaconda
alsa-lib.x86_64                  1.0.27.2-3.el7                       @anaconda
alsa-tools-firmware.x86_64       1.0.27-4.el7                         @anaconda
apr.x86_64                       1.4.8-3.el7                          @anaconda
you can install the packages use command line below ( as root):
yum  install -y httpd php
yum  install -y gcc glibc glibc-common
yum install -y gd gd-devel

Create Account for nagios

useradd -m nagios
passwd nagios
Create group for nagios and nagios user, apache user to group
groupadd nagiosgroup
usermod -a -G nagiosgroup nagios
usermod -a -G nagiosgroup apache
Download nagios and the plugins
mkdir ~/downloads
cd ~/downloads
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.8.tar.gz
wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
Compile and install Nagios
cd ~/downloads
tar zxvf nagios-4.0.8.tar.gz
cd nagios-4.0.8
./configure --with-command-group=nagiosgroup
make all
make install
make install-init
make install-config
make install-commandmode

Configure nagios 

Sample configuration file are installed in /usr/local/nagios/etc/ directory
Configure the web interface
make install-webconf
Create a nagiosadmin account for logging into the web interface
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Restart Apapche
service httpd restart
Compile and install the nagios Plugins
cd ~/downloads
tar zxvf nagios-plugins-2.0.3.tar.gz
cd nagios-plugins-2.0.3
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install

Start Nagios

Enable nagios automatically start when the system boot
chkconfig --add nagios
chkconfig nagios on
Verify the sample Nagios configuration file
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Start nagios
service nagios start
You done! you have nagios installation in centos 7

Modify SELinux 

Default SELinux in Enforcing mode. This is result in "Internal Server Erros" message when you access the Nagios CGIs.
check SELinux is in mode.
getenforce
Set SELinux into Permissive mode use command line
setenforce 0
To make this change permanent you edit in /etc/selinux/config file and reboot

Login to the web interface
http://localhost/nagios/
Or ip address of nagios
http://192.168.1.132/nagios/ 
nagios installation

I hope will this help you!
Copyright by: www.linuxoperatingsystem.info http://goo.gl/kMscJ4

0 comments:

Post a Comment