Installing Nagios 3.5.1 On CentOS 6.3 x86_64 System


1) Install the pre-requisites for the Nagios Installation.
[root@server ~]# yum install gcc gd gd-devel glibc glibc-common httpd php perl openssl openssl-devel net-snmp mysql mysql-server mysql-devel -y

2) Create a user named nagios and assign any password for it.
[root@server ~]# useradd -m nagios
[root@server ~]# passwd nagios

3) Create a new nagioscmd group for allowing external commands to be submitted through the web interface. Add both the nagios user and the apache user to the group.
[root@server ~]# groupadd nagioscmd
[root@server ~]# usermod -a -G nagioscmd nagios
[root@server ~]# usermod -a -G nagioscmd apache
 

4) Download and extract the Nagios Package
http://sourceforge.net/projects/nagios/files/nagios-3.x/nagios-3.5.1/nagios-3.5.1.tar.gz/download
[root@server ~]# tar -xvzf nagios-3.4.1.tar.gz
[root@server ~]# cd nagios

5) Compile and install the nagios
[root@server nagios]# ./configure --with-command-group=nagioscmd --enable-nanosleep
[root@server nagios]# make all
[root@server nagios]# make install
[root@server nagios]# make install-init
[root@server nagios]# make install-config
[root@server nagios]# make install-commandmode

6) Configure the web interface
[root@server nagios]# make install-webconf
[root@server nagios]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

7) Download, Compile and install the nagios plugins

https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz
[root@server Desktop]# tar -xvzf nagios-plugins-1.5.tar.gz
[root@server Desktop]# cd nagios-plugins-1.5
[root@server nagios-plugins-1.5]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
[root@server nagios-plugins-1.5]# make
[root@server nagios-plugins-1.5]# make install


8) Check the nagios configuration file for any errors
[root@server nagios-plugins-1.5]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg


9) Start the nagios service
[root@server nagios-plugins-1.5]# chkconfig --add nagios
[root@server nagios-plugins-1.5]# service nagios start
[root@server nagios-plugins-1.5]# chkconfig nagios on

[root@server nagios-plugins-1.5]# chkconfig httpd on
[root@server nagios-plugins-1.5]# service httpd restart

10) Incase SELinux is in enforcing mode then change the SELinux context to accept nagios configuration, otherwise this step is not necessary 
[root@server nagios-plugins-1.5]# chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
[root@server nagios-plugins-1.5]# chcon -R -t httpd_sys_content_t /usr/local/nagios/share/

[root@server nagios-plugins-1.5]# service httpd restart
[root@server nagios-plugins-1.5]# service nagios restart

Post a Comment

Mới hơn Cũ hơn