Howto install Nagios Centreon on CentOS 5.5 64bits
updated/fast version

Install Nagios on CentOS

| INSTALL OS                 |
1.Install CentOS
Select only Server option, witch has already lots of packets also too many
Updates system
# yum -y update rpm
# yum -y -y -v update
(if using proxy check this link)
2.Remove Useless (GUI,Squid,etc…):
# yum -y remove gdm
# yum -y -v remove squid
3. Set to startup in level 3 (cmd line only):
# vim etcinittab
4.Disable (know what u need and dont need) startup of useless services:
# chkconfig –level 3 bluetooth off
# chkconfig –list |grep 3:on
5.Disable SELinux (a not simple security system):
# vim /etc/selinux/config
# reboot
(if u want simple and good security use AppArmor and Fail2Ban)
Install Pre-requisites:
# yum -y install libstdc++-devel gcc-c++
# yum -y install httpd
# yum -y install gd gd-devel
(NOT NEEDED) # yum groupinstall “Development Tools”
# yum -y install kernel-devel
Install SSL and MySQL
# yum -y install openssl-devel perl-DBD-MySQL mysql-server mysql-devel
Installing PHP
# yum -y -v install php php-mysql php-gd php-ldap php-xml
Installing DBI modules
# yum -y install perl-DBI perl-DBD-MySQL
Installing RRDTools (ruby,pango,etc…)
# yum -y install ruby cairo-devel libxml2-devel pango-devel pango libpng-devel freetype freetype-devel libart_lgpl-devel
(Jul-2010, ver 1.4.4)
# wget
# tar -zxvf rrdtool-1.4.4.tar.gz
# cd rrdtool-1.4.4
# ./configure –prefix=/usr/local/rrdtool
# make all
# make install
Installing SNMP
# yum -y install perl-Crypt-DES perl-Digest-SHA1 perl-Digest-HMAC net-snmp-utils
# yum -y install perl-Socket6 perl-IO-Socket-INET6 net-snmp net-snmp-libs php-snmp dmidecode lm_sensors perl-Net-SNMP net-snmp-perl
Other APPs
# yum -y install fping graphviz cpp gcc gcc-c++ libstdc++ glib2-devel
Installation and PEAR configuration
# yum install php-pear
Only if you do use a proxy:
# pear config-set http_proxy http://user:pass@domain:port ..
To confirm
# pear config-show
Update Pear package before install
# pear channel-update
pear upgrade-all
# groupadd nagios
# adduser nagios -g nagios
# passwd nagios
Check if Nagios User is created
# grep nagios /etc/passwd
Add Webserver user (apache) and Nagios user (nagios)
# usermod -G nagios nagios
# usermod -G apache,nagios apache
Check if the users are the members of the group by
# grep nagios /etc/group
# mkdir /usr/local/nagios
# wget
# tar -zxvf nagios-3.2.3.tar.gz && 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
*** Important: Copy and Paste will fail on double-dashes so manually fix it.pwd
Help, also to check all parameters and what they do
./configure –help
Test install:
# make test
Any errors be sure to install dependencies, many times I had problem with embedded-perl
All can easly be done using cpan cmd:
# cpan
Configure CPAN
> o conf init
#> install Test:Simple Test::Long Test::WWW::Mechanize::CGI
In case CPAN is not working:
# wget
# wget
# wget
Path to Perl (only if needed)
For 32bits
export PERL5LIB=/usr/lib/perl5/5.10.0/i386-linux-thread-multi/CORE/
Finally Install Nagios
# make all && make install && make install-init && make install-commandmode & make install-config
# make install-webconf
# ls -l /usr/local/nagios
You should see six different subdirectories.
drwxrwxr-x 2 nagios nagios DIRs: bin / etc / libexec / sbin / share / var
Set the password for the Web Access
# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
You may need to Edit cgi.cfg to allow nagiosadmin user
# vim /usr/local/nagios/etc/cgi.cfg
httpd.conf (Even knowing that make install-webconf copies a file to /etc/httpd/conf.d/nagios.conf
I noticed that it only worked once i fix a slash that was missing in share/
Alias /nagios/ “/usr/local/nagios/share/”
I also prefered to have it all inside the httpd.conf file, my is like this:
ScriptAlias /nagios/cgi-bin “/usr/local/nagios/sbin”
# SSLRequireSSL
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from
AuthName “Nagios Access”
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
Alias /nagios/ “/usr/local/nagios/share/”
# SSLRequireSSL
Options None
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from
AuthName “Nagios Access”
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
Finally Restart Apache and Nagios
# service httpd restart
# service nagios restart
Add both to auto start
# chkconfig –add httpd
# chkconfig –level 35 httpd on
# chkconfig –add nagios
# chkconfig –level 35 nagios on
Try it on your browser:
If something goes wrong look into:
# wget
# ./configure –with-openssl=/usr/bin/openssl –enable-perl-modules –prefix=/usr/local/nagios –with-nagios-user=nagios
# make all
# make install
Check if the plugins are here
# ls -l /usr/local/nagios/libexec
Give nagios:nagios and execute permission
# chown nagios:nagios -R /usr/local/nagios/libexec
# chmod +x -R /usr/local/nagios/libexec
Install MySQL & PHP5
# yum -y -v install mysql-server
# yum -y -v install php-date
# yum -y -v install php-gd php-mysql php-snmp php-ldap php5-xmlrpc
(NOT WORKING)# yum -y -v install php-mail php-mail-mime php-net-smtp php-net-socket
# yum -y -v install
Start mysql in safe mode and set password
#service mysqld_safe –skip-grant-tables
Set password
# mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD(“password”) where User=’root’;
mysql> flush privileges;
mysql> quit
# service mysqld restart
# chkconfig –add mysqld
# chkconfig –level 3 mysqld on
(Optional) – PhpMySQLAdmin for easy administration of MySQL:
# yum -y -v install phpmyadmin
To access go to:
Install NDOUtils
# wget
# tar -zxvf ndoutils-1.4b9.tar.gz
#make all
#make install
(do not run the script to creat a DB, Centreon will do it)
Install EMAIL:
PostFix OR
# yum -y -v install postfix
# yum -y -v install sendmail
Do a Email Test
# echo “TEST EMAIL” | sendmail -s “testing my first email”
Upgrade PEAR
# pear upgrade pear
# pear channel-update
# pear install -o -f –alldeps DB_DataObject DB_DataObject_FormBuilder MDB2 Numbers_Roman
# pear install -o -f –alldeps Numbers_Words HTML_Common HTML_QuickForm2 HTML_QuickForm_advmultiselect HTML_Table Auth_SASL
# pear install -o -f –alldeps HTTP Image_Canvas Image_Color Image_Graph Image_GraphViz Net_Traceroute Net_Ping Validate XML_RPC
# pear install -o -f –alldeps SOAP
Php Requirements
# yum install php-mbstring php-posix
Fix Sudo (comment line Defualt requiretty)
# vim /etc/sudoers
#Default requiretty
Get Centreon (at this time latest is 2.1.3 06/11/2009)
# wget
# bash -i -v
All defaults OK, but these:
Where is installed RRD perl modules [] ?
Where is PEAR [PEAR.php]
Where is NDO?
Start Configuration GUI:
If some dependicies is not met just install it and restart httpd
Use the ndo Database with name: nagios
You may need to start NDOUtils
# /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
Auto START/STOP NDO daemon.
# vim /etc/init.d/nagios
find line bellow start and add:
“if [ $? -eq 0 ]; then…”
/usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
“su – $NagiosUser -c “touch $NagiosVarDir/nagios.log $NagiosRetentionFile…”
find line bellow stop and add:
“killproc_nagios nagios…”
Be sure to configure your local SNMP community so the
predefined checks will work
# vim /etc/snmp/snmpd.conf
# service snmpd restart
# chkconfig –add snmpd
# chkconfig –level 3 snmpd on
I also noticed an error when running the centreon plugins
Can’t locate Net/ in @INC
1) By CPAN (best)
on command line, as root :
[your_host]# perl -MCPAN -e shell
cpan shell — CPAN exploration and modules installation (v1.76)
ReadLine support enabled
cpan> install Net::SNMP
If it’s the first time you run CPAN, it will probably ask you some (simple) questions.
CPAN will also ask you to satisfy some dependencies (Crypt::DES, Digest::MD5, etc..).
2) “By hand”
Get the folowings modules (tar.gz format) on
– Crypt::DES
– Digest::MD5
– Digest::SHA1
– Digest::HMAC
– Net::SNMP
for each one (you must install Net::SNMP at the end) :
tar zxf .tar.gz
make test
make install
Set apache configuration
# vim /etc/httpd/conf.d/dokuwiki.conf
Alias /wiki “/usr/local/dokuwiki/www”
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
# mkdir /usr/local/dokuwiki
# cd /usr/local/dokuwiki
# wget
# tar -zxvf dokuwiki-2009-02-14b.tgz
# mv dokuwiki-2009-02-14b wwww
# chown apache:root -R /usr/local/dokuwiki/www
# service httpd restart
Browse to:
Installing templates is simple, just extract the downloaded template archive (
usually a .zip or .tgz file) in the ../lib/tpl/ ),and set the permissions correctly.
Then select the template in the Admin > Config Manager by adjusting the template option.
I recommend a really good template for procedures/documents in my opinion perfect for
nagios called USABLE, check it out at:
Will need another plguin to edit sidebar called DisplayWikiPage
# cd /usr/local/dokuwiki/www/lib/plugin
# wget
Index Menu
Just download and copy it to ../lib/plugins
go to admin > plugins
More interesting plugins
Add grpahviz repo
# vim /etc/yum.repos.d/graphviz.repo
name=Graphviz – RHEL $releasever – $basearch
# yum -y install grpahviz
# yum –enablerepo=graphviz-snapshot update ‘graphviz*’
# wget
# tar -zxvf
# ./ -i ndo2db -u apache -g apache
New installs the user/pass:
Set the user/name/db where the NDO DB is at inside also dbinstancename (uncomment it):
# vim /usr/local/nagios/share/nagvis/etc/nagvis.ini.php

; instance name for tables in NDO-db
If you dont know your dbinstancename take a look in ndomod.cfg, should
be the same name as its set there
# service httpd restart
Then just open your browser in EDIT mode go to:
Then just open your browser in USER mode go to:

Tags: , , , , ,

2 thoughts on “install nagios on centos 5.5

  1. What is service mysqld_safe –skip-grant-tables?
    I get error mysqld_safe: unrecognized service

Leave a Reply

Your email address will not be published. Required fields are marked *