*****************************************************
HOW TO INSTALL NAGIOS 3.2.0 CENTREON 2 on CENTOS 5.4
*****************************************************
Author: Felipe Ferreira / www.felipeferreira.net
Date: 17/11/2009
The perfect Network System Monitoring Solution is a comination of powerfull tools like Nagios/Centreon/NagVis/Dokuwiki.
This howto will teach step by step how to install each one of them, and also customize it correctly.
reference to previous Howto nagios/centreon installations:
+————–————–——+
| 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 Fedora 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 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 PERL modules
(NOT WORKING) # yum -y install perl-Config-IniFiles
Installing RRDTools
(NOT WORKING) # yum -y install rrdtool perl-rrdtool
This requires the repository dag.repo (check APPENDIX number 2)
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
Using a proxy with pear
# pear config-set http_proxy http://
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.0.tar.gz
# ./configure –-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
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:
# cpan
#> install Test:Simple Test::Long Test::WWW::Mechanize::CGI
Path to Perl (only if needed)
export PERL5LIB=/usr/lib/perl5/5.10.0/i386-linux-thread-multi/CORE/libperl.so libperl.so
Install Nagios
# make all
# make install
# make install-init
# make install-commandmode
# make install-config
# make install-webconf (this will copy nagios.conf)
# ls -l /usr/local/nagios
You should see five different subdirectories.
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://
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.14.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
# chomod +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
(NOT WORKING)# yum -y -v install php-mail php-mail-mime php-net-smtp php-net-socket
# yum -y -v install php5-xmlrpc
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
PhpMySQLAdmin(Optional) 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=123
# bash install.sh
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
Where is NDO?
/usr/local/nagios/bin/ndomod.o
Start Configuration GUI:
http://
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
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://
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
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://
Then just open your browser in USER mode go to:
http://
Excelente informacion. Saludos desde argentina
I don’t understand the DB relationship between NDO and Nagios configs.
Could you please post the contents of the following files?
1. /usr/local/nagios/share/nagvis/etc/nagvis.ini.php
2. /usr/local/nagios/etc/ndo2db.cfg
3. /usr/local/nagios/etc/ndomod.cfg
Also, I don’t have a “NDO” or “nagios” database. Centreon installed 3 databases:
1. centreon
2. centstatus
3. centstorage
Additionally, there is no mysql database for Nagios. Just Centreon.
-Sean
Sean,
The new centreon 2.1.x changed the DB name from Nagios to CentStatus… So you do have it.
What is exactly your problem? If you are not using Distributed Configuration then NDO is quite simple.
As far as how NagVis is configure here is my nagvis.ini.php só é importante:
[backend_ndomy_1]
dbhost=”localhost”
dbport=3306
dbname=”nagios”
dbuser=”centreon”
dbpass=”PASSWORDHERE”
dbprefix=”nagios_”
dbinstancename=”Central”
How do I upload my current nagios config (commands, hostgroups, hosts, services, etc) into the centreon gui?
Pete,
Its quite easy just go to Centreon Web GUI then |Configuration>Nagios>Load
Copy and paste or load a .cfg file, just be sure to use the nagios debug (-v) option.
I had problems with centreon 2.1.3 importing servicetext… so be sure to use latest version 2.1.4
good luck,
Felipe
]# ./configure –-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
configure: WARNING: you should use –build, –host, –target
configure: WARNING: invalid host type: –-enable-embedded-perl
configure: error: invalid variable name: –-prefix
Wolf, when copying and paste the — sometimes go crazy… check that
Hi,
I cannot find the APPENDIX number 2, mentioned below –
Installing RRDTools
(NOT WORKING) # yum -y install rrdtool perl-rrdtool
This requires the repository dag.repo (check APPENDIX number 2)
rgds
Check
http://felipeferreira.net/?p=59
[root@centos nagios-plugins-1.4.14]# pear upgrade pear
pear/PEAR dependency package “pear/Archive_Tar” installed version 1.3.6 is not the recommended version 1.3.3, but may be compatible, use –force to install
pear/Archive_Tar requires PEAR Installer (version >= 1.5.4), installed version is 1.4.9
No valid packages found
upgrade failed
Felipe,
This is probably one of the best CentOS installs I have seen. Its short/sweet/quick. I did notice that there is no reference to the ndo .cfgs being modified to change over to the sockets.
NAGVIS does not work on CentOS 5.5 64bit. Do you have any recommendations ?
Termino a instalacao do Nagios, mas quando aponto o browser para localhost, me abre apenas a pagina do apache… onde posso ter errado?
nao vou continuar para instalacao dos plugins, por enqauanto.
colocounagios nagios
http:
ou
http:
Felipe, parabens pelo tutorial!
Estou com um problema ao iniciar o ndo2db, estou recebendo uma mensagem de erro:
Starting ndo2db:Could not bind socket: Address already in use
done.
se eu dou um status:
ndo2db is not running but subsystem locked .
e se eu tento apagar os arquivos, tb nao consigo iniciar o processo… onde devo ter errado?
Gornati,
Da uma olhada se tem algo ja rodando
ps -ef |grep ndo2
Que aparece?
Verifica se nao tem nenhum outro programa utilizando a porta do ndo 5668.
abs
acho que descobri o problema, era a configuracao do ndo2db.cfg…
Hi Filipe
Ive got the Nagios XI VM up and running and was wondering to add Centreon to this do i just follow the steps from Get Centreon down?
or are there any pre requisits.
Any help would be greatly appreciated.
Buenas:
Tu guía ha sido una de las que he seguido para mi instalación de Nagios + Centreon, como quiero hacer una docu nueva y me he basado en tu texto, voy a comentar tu post en mi blog.
Un saludo.
Dear Wesdev,
can you tell me how you installed nagiosXI on centos.
i have been trying to install it but cant get the procedures.
thank you
WilFredm, sorry I have never installed or used NagiosXI… but it should be even easier then the nagios core.
This page is a brilliant and extremely clear presentation of a potentially complex process. Thank you!
I am trying to gain a better understanding of how and where NDOutils fits within the Centreon application. From what I’ve been able to discover, the NDOutils component is only required when using NagVis. Centreon will create the NDO database but does Centreon itself does not require it. Is this correct? If this is not correct, then can you tell me how Centreon uses any of the historical type tables in this database?
Amigo, eu instalei o centreon depois de ja ter todo configurado o meu nagios.. como eu migro as configurações para dentro do centreon??? obrigado!