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
SELINUX=disabled
# 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 http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.4.tar.gz
# 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
Configuration
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.php.net
pear upgrade-all
+————————————————+
| INSTALL NAGIOS |
+————————————————+
# 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 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
# ./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
Troubleshooting:
Any errors be sure to install dependencies, many times I had problem with embedded-perl
All can easly be done using cpan cmd:
http://user:pass@1server:8080
# cpan
Configure CPAN
> o conf init
#> install Test:Simple Test::Long Test::WWW::Mechanize::CGI
In case CPAN is not working:
# wget http://search.cpan.org/CPAN/authors/id/M/MS/MSCHWERN/Test-Simple-0.96.tar.gz
# wget http://search.cpan.org/CPAN/authors/id/R/RG/RGARCIA/Test-LongString-0.14.tar.gz
# wget http://search.cpan.org/CPAN/authors/id/M/MR/MRAMBERG/Test-WWW-Mechanize-CGI-0.1.tar.gz
Path to Perl (only if needed)
For 32bits
export PERL5LIB=/usr/lib/perl5/5.10.0/i386-linux-thread-multi/CORE/libperl.so libperl.so
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
SETTING UP THE WEBSERVER
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
authorized_for_system_information=nagiosadmin
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 127.0.0.1
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 127.0.0.1
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:
http:///nagios/
If something goes wrong look into:
/var/logs/httpd/error_log
/usr/local/nagios/etc/htpasswd.users
/usr/local/nagios/etc/cgi.cfg
+————————–+
| INSTALL NAGIOS PLUGINS |
+————————–+
# wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz
# ./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 CENTREON WEB INTERFACE |
+——————————-+
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:
http://infonagiosdsv/phpMyAdmin
(———PAUSE————)
Install NDOUtils
# wget http://prdownloads.sourceforge.net/sourceforge/nagios/ndoutils-1.4b9.tar.gz
# tar -zxvf ndoutils-1.4b9.tar.gz
#./configure
#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
SendMail,
# yum -y -v install sendmail
Do a Email Test
# echo “TEST EMAIL” | sendmail -s “testing my first email” youtemail@domain.xxx
Upgrade PEAR
# pear upgrade pear
# pear channel-update pear.php.net
# 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
:wq!
Get Centreon (at this time latest is 2.1.3 06/11/2009)
# wget http://download.centreon.com/index.php?id=144
# bash install.sh -i -v
All defaults OK, but these:
Where is installed RRD perl modules [RRDs.pm] ?
/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/RRDs.pm
Where is PEAR [PEAR.php]
/usr/share/pear/PEAR.php
RRD?
/usr/local/rrdtool/bin/rrdtool
Where is NDO?
/usr/local/nagios/bin/ndomod.o
Start Configuration GUI:
http:///centreon
Recomendations:
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…”
histoy
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
ERROR:
Can’t locate Net/SNMP.pm in @INC
SOLUTION:
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 www.cpan.org
– 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
cd
perl Makefile.pl
make test
make install
+—————–+
|INSTALL DOKUWIKI |
+—————–+
Set apache configuration
# vim /etc/httpd/conf.d/dokuwiki.conf
#DOKUWIKI
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 http://www.splitbrain.org/_media/projects/dokuwiki/dokuwiki-2009-02-14b.tgz
# 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:
http:///wiki/install.php
Templates:
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: http://www.dokuwiki.org/template:usable
Will need another plguin to edit sidebar called DisplayWikiPage
# cd /usr/local/dokuwiki/www/lib/plugin
# wget http://cloud.github.com/downloads/tatewake/dokuwiki-plugin-displaywikipage/displaywikipage-stable.tar.gz
Plugins:
Index Menu
http://www.dokuwiki.org/plugin%3Aindexmenu2
Just download and copy it to ../lib/plugins
go to admin > plugins
More interesting plugins
http://www.linux.com/archive/articles/57410
+—————–+
|INSTALL NAGVIS |
+—————–+
Add grpahviz repo
# vim /etc/yum.repos.d/graphviz.repo
[graphviz-stable]
name=Graphviz – RHEL $releasever – $basearch
baseurl=http://www.graphviz.org/pub/graphviz/stable/redhat/el$releasever/$basearch/os/
enabled=1
gpgcheck=0
# yum -y install grpahviz
# yum –enablerepo=graphviz-snapshot update ‘graphviz*’
# wget https://sourceforge.net/projects/nagvis/files/NagVis%201.4%20%28stable%29/NagVis-1.4.4/nagvis-1.4.4.tar.gz/download
# tar -zxvf
# ./install.sh -i ndo2db -u apache -g apache
URL:
http://<SERVER>/nagvis/frontend/nagvis-js/
New installs the user/pass:
nagiosadmin/nagiosadmin
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
[backend_ndomy_1]

; instance name for tables in NDO-db
dbinstancename=”Central”
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:
http://<SERVER>/nagvis/frontend/nagvis-js/
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 *