Home > HowTo, Linux, Nagios > HOW TO INSTALL CENTREON on CENTOS 5.4

HOW TO INSTALL CENTREON on CENTOS 5.4

November 18th, 2009 Leave a comment Go to comments
HOW TO INSTALL CENTREON on CENTOS 5.43.854

*****************************************************
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:

  • 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 \etc\inittab

    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://: my_proxy.com:port

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

    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:///nagios/nagvis/wui/index.php

    Then just open your browser in USER mode go to:

    http:///nagios/nagvis/index.php

    VN:F [1.7.5_995]
    Rating: 3.8/5 (4 votes cast)
    1. November 25th, 2009 at 21:36 | #1

      Excelente informacion. Saludos desde argentina

      UN:F [1.7.5_995]
      Rating: 5.0/5 (1 vote cast)
    2. Sean
      December 11th, 2009 at 21:18 | #2

      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

      UN:F [1.7.5_995]
      Rating: 0.0/5 (0 votes cast)
    3. December 14th, 2009 at 14:09 | #3

      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”

      UA:F [1.7.5_995]
      Rating: 0.0/5 (0 votes cast)
    4. January 13th, 2010 at 23:12 | #4

      How do I upload my current nagios config (commands, hostgroups, hosts, services, etc) into the centreon gui?

      UN:F [1.7.5_995]
      Rating: 0.0/5 (0 votes cast)
    5. January 21st, 2010 at 16:06 | #5

      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

      UA:F [1.7.5_995]
      Rating: 0.0/5 (0 votes cast)
    6. K. Wolf.
      March 1st, 2010 at 15:54 | #6

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

      UN:F [1.7.5_995]
      Rating: 0.0/5 (0 votes cast)
    7. March 4th, 2010 at 19:03 | #7

      Wolf, when copying and paste the — sometimes go crazy… check that

      UA:F [1.7.5_995]
      Rating: 0.0/5 (0 votes cast)
    8. v
      March 17th, 2010 at 11:24 | #8

      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

      UN:F [1.7.5_995]
      Rating: 0.0/5 (0 votes cast)
    9. v
      March 18th, 2010 at 10:27 | #9

      [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

      UN:F [1.7.5_995]
      Rating: 0.0/5 (0 votes cast)
    10. March 18th, 2010 at 14:03 | #10

      Check
      http://felipeferreira.net/?p=59

      UA:F [1.7.5_995]
      Rating: 0.0/5 (0 votes cast)
    11. Michael Joyner
      April 27th, 2010 at 06:05 | #11

      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.

      UN:F [1.7.5_995]
      Rating: 0.0/5 (0 votes cast)
    12. Iczdog
      May 20th, 2010 at 13:41 | #12

      NAGVIS does not work on CentOS 5.5 64bit. Do you have any recommendations ?

      UN:F [1.7.5_995]
      Rating: 0.0/5 (0 votes cast)
    1. No trackbacks yet.