Author: Felipe Ferreira /
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:

  • Varios Posts sobre Nagios

    | 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
    # 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

    Using a proxy with pear
    # pear config-set http_proxy

    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

    # ./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
    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/

    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.

    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
    # chomod +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
    (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:

    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

    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

    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:

  • 23 Thoughts

    1. 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.


      1. 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:

      1. 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,

    2. ]# ./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

    3. 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)


    4. [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

    5. 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.

    6. 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.

    7. 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

      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?

      1. 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.

    8. 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.

    9. 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.

    10. 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

    11. 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?

    12. 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!

    Leave a Reply

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

    VAMOVE *