Installing Nagios & Nagvis on Centos 6.2 (Part II)

NagVis is a visualization addon for the well known network managment system Nagios.
NagVis can be used to visualize Nagios Data, e.g. to display IT processes like a mail system or a network infrastructure.

Prerequisite: First you need to install Nagios
if you do not have Nagios installed, please look at this post :
Installing Nagios & Nagvis on Centos 6.2 (Part I)

Installing Nagvis

# yum install -y ndoutils mysql-server php-gd php-mbstring php-pdo php-mysql graphviz

Set MySQL service to start on boot

# chkconfig mysqld on

Start MySQL service

# service mysqld start

Create database and access permissions

# mysql
mysql> create database nagios;
mysql> GRANT ALL PRIVILEGES ON nagios.* TO ‘nagios’@'localhost’ IDENTIFIED BY ‘nagiossecret’;
mysql>flush privileges;

Initialize the database

# cd /usr/share/ndoutils
# ./installdb -u nagios -p nagiossecret -h localhost -d nagios

Set up “nagios.cfg” file

# nano /etc/nagios/nagios.cfg

Add line:  broker_module=/usr/libexec/ndomod-3x.o config_file=/etc/nagios/ndomod.cfg

event_broker_options=-1
broker_module=/usr/libexec/ndomod-3x.o  config_file=/etc/nagios/ndomod.cfg

Start NDOUtils service

# service ndoutils start

Restart Nagios service

# service nagios restart

 
Now check logs

# nano  /var/log/nagios/nagios.log

We can see is OK

[1348588492] Nagios 3.2.3 starting… (PID=4262)
[1348588492] Local time is Tue Sep 25 17:54:52 CEST 2012
[1348588492] LOG VERSION: 2.0
[1348588492] ndomod: NDOMOD 1.4b8 (07-16-2009) Copyright (c) 2009 Nagios Core Development Team and Community Contributors


Download
Nagvis last version (1.7.1)

# cd /tmp
#  wget http://sourceforge.net/projects/nagvis/files/latest/download?source=files

Unzip

# tar zxvf nagvis-1.7.1.tar.gz


Install Nagvis

# cd nagvis-1.7.1
# ./install.sh

+——————————————————————————+
| Welcome to NagVis Installer 1.7.1                                            |
+——————————————————————————+
| This script is built to facilitate the NagVis installation and update        |
| procedure for you. The installer has been tested on the following systems:   |
| – Debian Etch, Hardy (4.0, 5.0)                                              |
| – Ubuntu Hardy, Intrepid, Jaunty, Karmic, Lucid (8.04 to 10.04)              |
| – SuSE Linux Enterprise Server 10 and 11                                     |
|                                                                              |
| Similar distributions to the ones mentioned above should work as well.       |
| That (hopefully) includes RedHat, Fedora, CentOS, OpenSuSE                   |
|                                                                              |
| If you experience any problems using these or other distributions, please    |
| report that to the NagVis team.                                              |
+——————————————————————————+
| Do you want to proceed? [y]:   y
+——————————————————————————+
| Starting installation of NagVis 1.7.1                                        |
+——————————————————————————+
| OS  : CentOS release 6.3 (Final)                                             |
|                                                                              |
+— Checking for tools ——————————————————-+
| Using packet manager /bin/rpm                                          found |
+— Checking paths ———————————————————–+
| Please enter the path to the nagios base directory [/usr]: /usr/share/nagios
|   nagios path /usr/share/nagios                                        found |
| Please enter the path to NagVis base [/usr/nagvis]: /usr/share/nagvis
+— Checking prerequisites —————————————————+
| PHP 5.3                                                                found |
|   PHP Module: gd php                                                   found |
|   PHP Module: mbstring php                                             found |
|   PHP Module: gettext compiled_in                                      found |
|   PHP Module: session compiled_in                                      found |
|   PHP Module: xml compiled_in                                          found |
|   PHP Module: pdo php                                                  found |
|   Apache mod_php                                                       found |


don not set up the backend, after set up from file

| Checking Backends. (Available: mklivestatus,ndo2db,ido2db,merlinmy)          |
| Do you want to use backend mklivestatus? [y]: n
| Do you want to use backend ndo2db? [n]: n
| Do you want to use backend ido2db? [n]: n
| Do you want to use backend merlinmy? [n]: n
| NO (valid) backend(s) specified                                      MISSING |

| Graphviz 2.26                                                          found |
|   Graphviz Module dot 2.26.0                                           found |
|   Graphviz Module neato 2.26.0                                         found |
|   Graphviz Module twopi 2.26.0                                         found |
|   Graphviz Module circo 2.26.0                                         found |
|   Graphviz Module fdp 2.26.0                                           found |
| SQLite 3.6                                                             found |
|                                                                              |
+— Trying to detect Apache settings —————————————–+
| Please enter the web path to NagVis [/nagvis]: /nagvis
| Please enter the name of the web-server user [apache]: apache
| Please enter the name of the web-server group [apache]: apache
| create Apache config file [y]: y
+——————————————————————————+
| Summary                                                                      |
+——————————————————————————+
| NagVis home will be:           /usr/share/nagvis                             |
| Owner of NagVis files will be: apache                                        |
| Group of NagVis files will be: apache                                        |
| Path to Apache config dir is:  /etc/httpd/conf.d                             |
| Apache config will be created: yes                                           |
|                                                                              |
| Installation mode:             install                                       |
|                                                                              |
| Do you really want to continue? [y]: y
+——————————————————————————+
| Starting installation                                                        |
+——————————————————————————+
| Creating directory /usr/share/nagvis…                                done  |
| Creating directory /usr/share/nagvis/var…                            done  |
| Creating directory /usr/share/nagvis/var/tmpl/cache…                 done  |
| Creating directory /usr/share/nagvis/var/tmpl/compile…               done  |
| Creating directory /usr/share/nagvis/share/var…                      done  |
| Copying files to /usr/share/nagvis…                                  done  |
| Creating directory /usr/share/nagvis/etc/profiles…                   done  |
/usr/share/nagvis/share/frontend/nagvis-js/js
| Creating main configuration file…                                    done  |
| adding base=”/usr/share/nagvis”                                        done  |
|   Adding webserver group to file_group…                              done  |
| Creating web configuration file…                                     done  |
| Setting permissions for web configuration file…                      done  |
|                                                                              |
|                                                                              |
|                                                                              |
+— Setting permissions… —————————————————+
| /usr/share/nagvis/etc/nagvis.ini.php-sample                            done  |
| /usr/share/nagvis/etc                                                  done  |
| /usr/share/nagvis/etc/maps                                             done  |
| /usr/share/nagvis/etc/maps/*                                           done  |
| /usr/share/nagvis/etc/geomap                                           done  |
| /usr/share/nagvis/etc/geomap/*                                         done  |
| /usr/share/nagvis/etc/profiles                                         done  |
| /usr/share/nagvis/share/userfiles/images/maps                          done  |
| /usr/share/nagvis/share/userfiles/images/maps/*                        done  |
| /usr/share/nagvis/share/userfiles/images/shapes                        done  |
| /usr/share/nagvis/share/userfiles/images/shapes/*                      done  |
| /usr/share/nagvis/var                                                  done  |
| /usr/share/nagvis/var/*                                                done  |
| /usr/share/nagvis/var/tmpl                                             done  |
| /usr/share/nagvis/var/tmpl/cache                                       done  |
| /usr/share/nagvis/var/tmpl/compile                                     done  |
| /usr/share/nagvis/share/var                                            done  |
|                                                                              |
+——————————————————————————+
| Installation complete                                                        |
|                                                                              |
| You can safely remove this source directory.                                 |
|                                                                              |
| For later update/upgrade you may use this command to have a faster update:   |
| ./install.sh -n /usr/share/nagios -p /usr/share/nagvis -u apache -g apache -w /etc/httpd/conf.d -a y
|                                                                              |
| What to do next?                                                             |
| – Read the documentation                                                     |
| – Maybe you want to edit the main configuration file?                        |
|   Its location is: /usr/share/nagvis/etc/nagvis.ini.php                      |
| – Configure NagVis via browser                                               |
|   <http://localhost/nagvis/config.php>                                       |
| – Initial admin credentials:                                                 |
|     Username: admin                                                          |
|     Password: admin                                                          |
+——————————————————————————+


Set up NDO backend

# nano /usr/share/nagvis/etc/nagvis.ini.php


Set db_name, db_user and db_pass
created in Part I

; hostname for NDO-db
dbhost=”localhost”
; portname for NDO-db
dbport=3306
; database name for NDO-db
dbname=”nagios”
; username for NDO-db
dbuser=”nagios”
; password for NDO-db
dbpass=”nagiossecret”


 
Finally we access from:  http://Your_Server_Nagios_IP:/nagvis/
Default user/passwd: admin/admin