Home > HowTo, Linux > Install Nagios on CentOS

Install Nagios on CentOS

September 2nd, 2011 Leave a comment Go to comments

Nagios 3 Quick Install on CentOS

This is short/fast HowTo Install Nagios 3 on CentOS/RedHat 5 64bits

::INSTALL NAGIOS::
rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

yum update
vim /etc/selinux/config
SELINUX=disabled
reboot

yum -v -y install libstdc++-devel gcc-c++ httpd gd gd-devel kernel-devel openssl-devel perl-DBD-MySQL mysql-server mysql-devel php php-mysql php-gd php-ldap php-xml perl-DBI perl-DBD-MySQL ruby cairo-devel libxml2-devel pango-devel pango libpng-devel freetype freetype-devel libart_lgpl-devel perl-Crypt-DES perl-Digest-SHA1 perl-Digest-HMAC net-snmp-utils perl-Socket6 perl-IO-Socket-INET6 net-snmp net-snmp-libs php-snmp dmidecode lm_sensors  perl-Net-SNMP net-snmp-perl fping graphviz cpp gcc gcc-c++ libstdc++ glib2-devel fping graphviz cpp gcc gcc-c++ libstdc++ glib2-devel php-pear postfix ndoutils php-mbstring php-posix

>>Set Pear Proxy
pear config-set http_proxy http://user:pass@server:port
pear channel-update pear.php.net
pear upgrade-all

groupadd nagios && adduser nagios -g nagios &&  passwd nagios
usermod -G nagios nagios && usermod -G apache,nagios apache

wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.3.tar.gz
tar -zxvf nagios-3.2.3.tar.gz && cd nagios-3.2.3
mkdir /usr/local/nagios
cd nagios-3.2.3

./configure --with-httpd-conf=/etc/httpd/conf.d/ --with-init-dir=/etc/init.d/ --enable-embedded-perl --prefix=/usr/local/nagios --with-cgiurl=/nagios/cgi-bin --with-htmurl=/nagios/ --with-nagios-user=nagios --with-nagios-group=nagios --with-command-group=nagios --enable-nanosleep --enable-event-broker --with-perlcache

make all && make install && make install-init && make install-commandmode && make install-config && make install-webconf

>>NOTE:    I noticed that it only worked once i fix a slash that was missing in “share/” so
vim /etc/httpd/conf.d/nagios.conf
Alias /nagios/ “/usr/local/nagios/share/”
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
service httpd restart && service nagios restart
chkconfig –level 35 httpd on && chkconfig –add nagios && chkconfig –level 35 nagios on

>>Finally The installation is done, You can now Open Nagios Web Interface
>>http://<SERVER>/nagios/

::INSTALL NAGIOS PLUGINS::
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz
tar -zxvf nagios-plugins-1.4.15.tar.gz && cd nagios-plugins-1.4.15
./configure –with-openssl=/usr/bin/openssl –enable-perl-modules –prefix=/usr/local/nagios –with-nagios-user=nagios
make all && make install

::INSTALL CENTREON WEB INTERFACE::
>>Optional, to have MySQL web admin interface
yum -y -v install phpmyadmin

service mysqld restart
mysqladmin -u root password “NEWPASSWORD”

service mysqld restart
chkconfig –add mysqld && chkconfig -level 3 mysqld on

>>Test Sending an e-mail
echo “TEST EMAIL” | sendmail -s “testing my first email” youtemail@domain.xxx

::INSTALL NDO::
wget http://prdownloads.sourceforge.net/sourceforge/nagios/ndoutils-1.4b9.tar.gz
tar -zxvf ndoutils-1.4b9.tar.gz && cd ndoutils-1.4b9/
./configure
make all && make install

>> Upgrade PEAR
pear install -o -f –alldeps DB_DataObject DB_DataObject_FormBuilder MDB2 Numbers_Roman Numbers_Words HTML_Common HTML_QuickForm2 HTML_QuickForm_advmultiselect HTML_Table Auth_SASL HTTP Image_Canvas Image_Color Image_Graph Image_GraphViz Net_Traceroute Net_Ping Validate XML_RPC SOAP Log
pear upgrade pear && pear channel-update pear.php.net
>> Fix Sudo (comment line Defualt requiretty)
visudo
#Default requiretty

::INSTALL CENTREON::
wget http://download.centreon.com/centreon/centreon-2.1.10.tar.gz
tar -zxvf centreon-2.1.10.tar.gz && cd centreon-2.1.10/
bash install.sh -i -v
>>Answer all questions yes,and I usually have to find few files like:
/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/RRDs.pm
/usr/local/nagios/bin/ndomod.o
/usr/share/pear/PEAR.php

>>Then just open the browser
http://<server>/centreon/install/setup.php
On the step 6. Database Configuration
Database Location: 127.0.0.1

http://<server>/centreon/

Categories: HowTo, Linux Tags: , , , , , , , , ,
  1. polare
    September 5th, 2011 at 17:05 | #1

    Hi Felipe
    your guides are always useful

    I will give some help? I can not solve the problem:

    http://forum.centreon.com/showthread.php/11819-style.css-no-display

    you have any suggestions please?

    Thanks

  2. polare
    September 6th, 2011 at 08:04 | #3

    which ones? there are no errors in the logs

  3. polare
    September 6th, 2011 at 08:38 | #4
  4. October 17th, 2011 at 21:28 | #5

    Hi Felipe,
    what do you think about FAN ?
    http://fannagioscd.sourceforge.net/wordpress/demo/

  1. September 8th, 2011 at 15:37 | #1

VAMOVE *

*