Home > HowTo, Linux, Nagios > Debian Nagios Oreon Howto

Debian Nagios Oreon Howto

August 27th, 2008 Leave a comment Go to comments

***********************************************************
HOW TO INSTALL Debian 4.04 NAGIOS 3.03 CENTREON 2
***********************************************************
Author: Felipe Ferreira / fferreira(a+)osiatis.es / www.xoroz.com
Date: 25/08/2008

Nagios and Centreon are the perfect Network System Monitoring Solution.
Oreon has became a reference as a Nagios Frontend.
The Centreon/Nagios couple is used by a wide range of users, from novices to skilled users,
even if they didn’t knew Nagios before.

+——————–+
| INSTALL OS |
+——————–+

1.Install Debian

Install SSHD

# apt-get install openssh-server

Install Compilers and Libraries (may ask the Ubuntu CD)

# apt-get install libc6-dev g++ gcc
# apt-get install libgd2-xpm libgd2-xpm-dev libjpeg62-dev libgd-tools
# apt-get install libperl-dev

Install Zlib, Libpng Required by LibGD and then LibGD

# wget http://www.gzip.org/zlib/zlib-1.2.3.tar.gz
# wget http://dfn.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.31.tar.gz
# wget http://www.libgd.org/releases/gd-2.0.35.tar.gz

**How To Install .tar.gz, look bottom of document**

Install Apache

# apt-get install apache

+—————————–+
| INSTALL NAGIOS |
+—————————–+

# groupadd nagios
# adduser –ingroup nagios nagios
# passwd nagios

Check if Nagios User is created
# grep nagios /etc/passwd

Add Webserver user (www-data/apache) and Nagios user (nagios)
# usermod -G nagios nagios
# usermod -G www-data,nagios www-data

Check if the users are the members of the group by
# grep nagios /etc/group
# mkdir /usr/local/nagios
# apt-get install build-essential
# apt-get install libgd2-dev (dosent always find)
# wget http://ovh.dl.sourceforge.net/sourceforge/nagios/nagios-3.0.3.tar.gz
cd nagios-3.0.3

# tar -zxvf nagios-3.0.3.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

Create a Symbolic Link to Perl(Only if you get errors)
(find perl lib: # find / -name libperl.so ,should be this:)
# ln -s /usr/lib/libperl.so libperl.so

Finally Install Nagios:
# make all
# make install
# make install-init
# make install-commandmode
# make install-config
# ls -l /usr/local/nagios

You should see five different subdirectories unde /usr/local/nagios.
sbin , share , var , libexec , etc

Configure apache set the password for the Web Access:
# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Edit the apache2.conf
# vim /etc/apache2/apache2.conf

ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin
Directory “/usr/local/nagios/sbin” Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName “Nagios Access”
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
/Directory
Alias /nagios /usr/local/nagios/share
Directory “/usr/local/nagios/share”| Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName “Nagios Access”
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
/Directory

Note: FIX THE DIRECTORY OPEN CLOSE BRACKETS

Edit cgi.cfg to allow nagiosadmin user
# vim /usr/local/nagios/etc/cgi.cfg
authorized_for_system_information=nagiosadmin

Restart Apache and Nagios
# /etc/init.d/apache2 restart
# /etc/init.d/nagios restart

+———————————————+
| INSTALL NAGIOS PLUGINS |
+———————————————+

->Install OpenSSL (optional, If want check_https to work)
# apt-get install libssl-dev

Check where the Headers files are (default: /usr/include/openssl)
# wget http://downloads.sourceforge.net/nagiosplug/nagios-plugins-1.4.11.tar.gz?modtime=1197587122&big_mirror=0

# ./configure –with-openssl=/usr/include/openssl –enable-perl-modules –with-perl=/usr/bin/perl –with-nagios-user=nagios
# make all
# make install

Check if the plugins are here:
# ls -l /usr/local/nagios/libexec

Give nagios:nagios permission
# chown nagios:nagios /usr/local/nagios/libexec

Oreon Requirements
Install MySQL & PHP5 (requirements for Oreon)

# apt-get install mysql-server
# apt-get install libmysqlclient15-dev
# apt-get install php5
# apt-get install php-db php-date
# apt-get install php5-gd php5-mysql php5-snmp php5-ldap
# apt-get install php-mail php-mail-mime php-net-smtp php-net-socket
# apt-get install php5-xmlrpc
# apt-get install php5 libapache2-mod-php5

Install PostFix and Sendmail ( OPTIONAL):
# apt-get install postfix
# apt-get install sendmail
Do an Email Test:
# echo “TEST EMAIL” | sendmail -s “testing my first email” youtemail@domain.xxx
Check /var/log/mail.log for errors.

RRDTools for the Graphics:
# apt-get install rrdtool librrds-perl

Perl Libraries
# apt-get install libconfig-inifiles-perl

Snmp
# apt-get install snmp snmpd libnet-snmp-perl

Upgrade PEAR(Oreon 2 may perform this automatic?)
# pear upgrade pear
# pear install -o -f –alldeps DB_DataObject DB_DataObject_FormBuilder MDB2 Numbers_Roman
Numbers_Words HTML_Common HTML_QuickForm2 HTML_QuickForm_advmultiselect HTML_Table Auth_SASL
HTTP Image_Canvas Image_Color Image_Graph Image_GraphViz Net_Traceroute Net_Ping Validate XML_RPC
# pear install -o -f –alldeps SOAP
Note: Versions are old, but pear/oreon will know about the new ones, so no problem.

INSTALL NDOUTILS:

# wget http://dfn.dl.sourceforge.net/sourceforge/nagios/ndoutils-1.4b7.tar.gz

(confirm the last version here)
Requires MySQL libraries (libmysqlclient15-dev)
# ./configure –with-mysql-lib=/usr/lib/mysql
# make
# cp src/ndomod-3x.o /usr/local/nagios/bin/ndomod.o
# cp src/ndo2db-3x src/log2ndo src/file2sock /usr/local/nagios/bin/
# cp config/ndomod.cfg /usr/local/nagios/etc/
# vi /usr/local/nagios/etc/nagios.cfg

event_broker_options=-1
broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg
… (VERY IMPORTANT,THE ABOVE HAS TO BE IN THE SAME LINE)
# cp config/ndo2db.cfg /usr/local/nagios/etc/
# chown nagios:nagios /usr/local/nagios/bin/*
# chown nagios:nagios /usr/local/nagios/etc/ndo*

Allow SQL Nagios DB access:

# mysql -u root -p mysql

# GRANT ALL ON nagios.* TO ndouser IDENTIFIED BY ‘userndo’;

(create nagios and ndouser(or just use nagios) account in my sql can use phpmyadmin)

Command to Start NDODaemon:
# /usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg

Automatic Start / Stop NDO with Nagios:
vim /etc/init.d/nagios

echo -n “Starting nagios:”
$NagiosBin -v $NagiosCfgFile > /dev/null 2>&1;
if [ $? -eq 0 ]; then
su – $NagiosUser -c “/usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg”
su – $NagiosUser -c “touch $NagiosVarDir/nagios.log $NagiosRetentionFile”

stop)
echo -n “Stopping nagios: ”
pid_nagios
killproc_nagios nagios
su – $NagiosUser -c “skill ndo2db-3x”

Import of the ndoutils

Go to /usr/src/ndoutils-1.4b7/db and run ./installdb.

+———————————————————+
| INSTALL OREON WEB INTERFACE |
+———————————————————+

DOWNLOAD OREON
(at this time latest is 2RC3 27/08/2008 , 2 final should be on its way.)
# wget http://download.oreon-project.org/index.php?id=89
# bash install.sh

All defaults OK, but these:
Where is your NDO ndomod binary ?
/usr/local/nagios/bin/ndomod-3x.o

Go thru entire configuration, attention to Database names and users!
http://localhost/centreon
First time you login there will be a NDO error, don’t worry edit centreon ndo configurations files

Configuration – Centreon – ndomod.cfg
Configuration – Centreon – ndo2db.cfg

To the same setting we had at /usr/local/nagios/etc
Enjoy it now!

Verify the Permissions:
# chown www-data:nagios -R /usr/local/nagios/libexec/
# chmod 775 -R /usr/local/nagios/libexec/

+—————–+
| APPENDIX |
+—————-+

###PROBLEM NDO

*Common Linux Instalation cmd:
# tar -zxvf gd-2.0.35.tar.gz
# cd gd-2.0.35
# ./configure
# make
# make install

**SETUP SAMBA ROOTSHARE:(LAB ONLY)
Note: This will give COMPLETE RW access to you linux server, I do not recomend this in production but for testing only!
# apt-get install samba
# /usr/bin/smbpasswd root
Copy And Paste this Config
# vim /etc/samba/smb.conf

[global]
workgroup = OSX
realm = OSX
server string = %h server
interfaces = eth0
obey pam restrictions = Yes
passdb backend = tdbsam
passwd program = /usr/bin/passwd %u
passwd chat = *EntersnewsUNIXspassword:* %nn *RetypesnewsUNIXspassword:* %nn *passwordsupdatedssuccessfully* .
syslog = 0
log file = /var/log/samba/log.%m
max log size = 1000
dns proxy = No
panic action = /usr/share/samba/panic-action %d
[ShareRoot]
comment = Root
path = /
username = root
valid users = %S, root
force user = root
read only = No
create mask = 0700
directory mask = 0700
guest ok = Yes

# /etc/init.d/samba restart
In windows cmd:
c: net use p: IPShareRoot /user:root
***ALLOW MYSQL REMOTE ACCESS: MySQL5 – connect from Remote 1. download Navicat 8 (or others MYSQL Win Clients) 2. Login via SSH Edit /etc/mysql/my.cnf with bind-address = 192.168.X.X (localhost IP)
# vim /etc/mysql/my.cnf
# mysql -u root -p mysql

use oreon
GRANT ALL ON ods.* TO root@’192.168.X.X’ IDENTIFIED BY ‘PASSWORD’;
use ods
GRANT ALL ON ods.* TO root@’192.168.X.X’ IDENTIFIED BY ‘PASSWORD’;
# /etc/init.d/mysql restart
Run Navicat to browse MySQL DB Anoteher Option is to install myphpadmin
#apt-get install myphpadmin
http:myphpadmin ****GRAPH USING OREON ODS make sure to start ods s start
Oreon Web Interface – > create a service template > Data Treatment > Process Perf Data (On) Configure ODS Oreon Web Interface – > Options > CentreonDataStorage > Config Be sure that you have the .rrd files created
# find / -name *.rrd

*****Make Nagios Pretty ( Nuvola Style )
First Backup /usr/local/nagios/share/*..html and all stylesheets directory.
# cd /usr/local/nagios/share
# wget http://www.xoroz.com/files/nagiosstyle.zip
# unzip nagiosstyle.zip
Set the permissions
# chown nagios:nagios *.*
# chown nagios:nagios -R side
# chown nagios:nagios -R stylesheet
Edit the config.js with your correct cgi-bin
# /etc/init.d/apache2 restart

*******More cool cmds Get an overview of all hosts (new cmd with nagios 2.11)
# /usr/local/nagios/bin/nagiostats /usr/local/nagios/etc/nagios.cfg -v NUMHOSTS

********Autostart Daemon only with Ubuntu
# /usr/sbin/update-rc.d mysql defaults

*********Install FIREFOX ADD-ON NAGIOS CHECKER https://addons.mozilla.org/en-US/firefox/addon/3607

*********Network Latency Tool Smokeping howto http://howtoforge.com/monitoring_network_latency_smokeping_debian_etch

************Troubleshooting problems If in Oreon monitor does not update itself, its a permission problem related to status.log Read the user nagios emails for problems regarding cron jobs and permissions Check the logs at Oreon > Monitor > Event-logs for any errors

************Reset MySQL Password:

Stop SQL
#/etc/init.d/mysql stop

Start in Safe mode:
# /usr/bin/mysqld_safe –skip-grant-tables & [1] 6702

Login to MySQL and update password:
# mysql --user=root mysql
update user set Password=PASSWORD('NEWPASSWORDHERE') WHERE User='root';

AUTO INSTALL SCRIPT
TROUBLESHOOTING POST LINK HERE
  1. September 1st, 2008 at 16:13 | #1

    Hi,
    Sorry for my bad english.
    With your manual, NDO Database is not created…
    Is an error?

    **In spanish (Sorry)**
    Hola:
    Con las instrucciones de tu manual al finalizar el proceso encuentro que la BBDD de NDO no existe.
    He tenido que crearla con el script sql que hay en el directorio /centreon/www/install/createNDODB.sql

    ¿Se debería haber creado automáticamente durante el proceso de instalación o es que falta el paso de crearla en el manual?

    Un saludo y felicidades por el gran manual que has escrito.
    Diego Fernández

  2. admin
    September 1st, 2008 at 16:58 | #2

    Hola Diego,
    Soy muy contento que el manual te has ayudado.
    El mensaje de error esta previsto y documentado
    “Go thru entire configuración, attention to Database names and users!
    http://localhost/centreon
    First time you login there will be a *NDO error*, don’t worry edit centreon ndo configurations files”
    Pienso que es solamente porque centreon por default tiene las configuraciones de NDO diferentes,
    asi que hace falta entrar en oreon y configurarlas a mano via oreon
    Configuration -> Centreon -> ndomod.cfg (mira imagen adjunta
    Configuration – Centreon – ndo2db.cfg
    Esto de arrancar via el script probablemente no hace falta, ya que una vez bien configurado oreon debería
    haber encontrado la DB que hemos creado antes (en la configuración de oreon)

  3. March 15th, 2009 at 15:45 | #3

    Thank you for the HowTo.

    A couple of things to add:
    I noticed the PNP plugin doesn’t compile or is not included.
    Download it here and compile it with ./configure and make all:
    http://sourceforge.net/project/showfiles.php?group_id=191615&package_id=225647&release_id=662412

    The import of the ndoutils databases is not included in the HowTo.
    Just go to /usr/src/ndoutils-1.4b7/db and run ./installdb. But before you do this, read the next item.

    I also got ndo2db-3x mysql errors when updating nagios_configfilevariables, saying that varname isn’t unique.
    Edit the ndo2db mysql.sql, remove the following line at
    — Table structure for table `nagios_configfilevariables`

    UNIQUE KEY `instance_id` (`instance_id`,`configfile_id`,`varname`)

    Execute the Mysql script in phpmyadmin or run ./installdb from the db folder.

    Greets,
    Remon

    • admin
      March 16th, 2009 at 16:43 | #4

      THanks Remon, I will add to the post.
      Cheers

  4. Marcio
    July 15th, 2009 at 16:35 | #5

    Hi Felipe, your tutorial it’s good, the part of pear installation help me.

    But, I need import Nagios configuration to Centreon, did you know?

    Thanks!

    • July 15th, 2009 at 17:17 | #6

      Hey Marcio,
      You can easly do that, just login to centreon and go to:
      Configuration>Nagios>Load (browse) select the .cfg file you want to import. It should be loaded in Centreon. Be sure to check what kind of file you are importing…
      if it is a notification, check as notification, same for nagios.cfg etc…
      After importing you should see in Configuration, to have changes applied restart Centreon doing:
      >Configuration>Nagios>[x]Move files,Reload Nagios
      cheers,
      Felipe

  5. Marcio
    July 16th, 2009 at 19:06 | #7

    @admin
    Thanks it’s work. Thanks a lot!

  6. pete
    October 28th, 2009 at 19:15 | #8

    This is the best guide on setting up Nagios out there on the web. It has been many years since I setup Nagios. Thanks!!

  1. December 3rd, 2008 at 08:20 | #1
  2. July 30th, 2009 at 13:46 | #2

VAMOVE *

*