NagVis: Map Your Architecture with Nagios Alerts
Introduction
NagVis is a really great product, easy to use but not to install. That’s why I did this documentation. You also need to install NDOUtils. We’ll see the installation too.
NDOUtils
Prepair System
Make sure your System meets the requirements:
- Nagios v2.X (stable) is running
- mysql (Version > 4)
Download NDOUtils
You can get the latest version of NDOUtils on the Nagios website https://www.nagios.org/download/
Unpack NDOUtils
Unpack NDOUtils in a path of your choice
|
|
You should have at least the following files and directories:
- Config: This directory contains all the configuration file of NDOUtils.
- db: This directory contains all the sql information to install or upgrade the mysql database.
- docs: This directory contains the technical documentation of NDOUtils.
- Include: This directory contains all the libraries.
- src: This directory contains the source code.
- configure: This file will be use to compile the program
Compiling NDOUtils
Use the following commands to compile the NDO broker module, NDO2DB daemon, and additional utilities:
|
|
After the compilation open the config.log file and take care that there’s no failed status inside. If there is some failed status it’s probably because you don’t have all the libraries installed in your C compiler. Install it and recompile it.
Note:
|
|
Initializing the SQL Database
You have to create a database for storing the data.
|
|
You also have to create a specific user for nagios with the rights: SELECT, INSERT, UPDATE, and DELETE.
|
|
Then now you can run the DB installation script in the db/ subdirectory.
|
|
Make sure the script create the tables in the database (use phpmyadmin for exemple)
Configuration
Sample config files are included in the config/ subdirectory. You have 2 files to modify:
- Ndomod.cfg, you have to change and uncomment the following lines:
|
|
Feel free to change the other parameters according to your configuration.
- Ndo2db.cfg, you have to change and uncomment the following lines:
|
|
Feel free to change the other parameters according to your configuration.
- There is another file to modify: Nagios.cfg. This file is located in the
/etc/nagios/
directory. You have to enable the event_broker_option like this:
|
|
Installation
To install the script you have to copy files compiled and the configuration files in the right directories.
|
|
Getting Things Running
Start the NDO2DB daemon:
|
|
Start or restart nagios if is already running:
|
|
Check the Nagios logs to make sure it started okay:
|
|
You should see some entries in the database. If you want that the NDO2DB start at the system, you have to create a script.
NagVis
Prepair System
Make sure your System meets the requirements:
- Nagios v2.X is running and authentication is configured (.htaccess file placed and configured properly!)
- NDOUtils v1.X is installed and worked (https://nagios.sourceforge.net/docs/ndoutils/NDOUtils.pdf)
- Working PHP installation (Version > 4.2.0) with “php-gd” support
- php-mysql support is needed for the strongly recommended “ndomy” backend
Download NagVis
You can get the latest version of Nagvis on the Nagvis’ website. https://www.nagvis.org/downloads
Unpack NagVis
Unpack NagVis in a path of your choice
|
|
You should have the following files:
- etc: This directory contain configuration file and demo Map.
- nagvis: This directory contain all the templates, images and functions of Nagvis.
- wui: This directory contain all Ajax functionalities (to configure map)
- Config.php: This file is used to configure maps.
- Index.php: This will be the index of Nagvis.
Move NagVis
Place the NagVis directory tree (with etc, nagvis, wui, config.php and index.php inside) into your Nagios share folder.
|
|
Configure
Move to new NagVis directory
|
|
An example for the configuration file can be found in etc/nagvis.ini.php-sample. Copy this example to nagvis/etc/nagvis.ini.php.
|
|
Now you can edit this file with your favorite text editor:
|
|
The most lines in the fresh copied config.ini.php are commented out. If you want to set different settings, than there are set, uncomment the line and change the value of it. Edit the following lines:
|
|
Permissions
First check which user the webserver is running with (In my case it is www-data). If you don’t know which user the webserver is running on have a look at the webservers configuration. In case of apache you can do this by the following command:
|
|
If your configuration file is located in another path you should correct this in the command above. The set the permissions to your NagVis directory (In my case the path are like this):
|
|
It’s possible to set lower permissions on the files, in my setup it’s ok like this. Only change them if you know, what you are doing.
The WUI
NagVis has an included web based config tool called WUI. If you want to use it use your browser to open the page:
http://<nagiosserver>/nagvis/config.php
Hint: If you have some script or popup blockers, disable them for the WUI.
When you see the NagVis image, right click on it, a context menu should open, now you can configure NagVis and create maps with the WUI.
The Config Tools DOES NOT display the current Nagios States of Objects configured. Its only for configuring! To “use” your configured Maps afterwards, see STEP 7!
If this does’t work for you, or if you don’t want to use the WUI, you can simply edit the map config files in the nagvis/etc/maps/ directory with your favorite text editor. For valid format and values have a look at Map Config Format Description on NagVis.org (https://www.nagvis.org/docs/1.2/map_config_format_description).
Watch the Maps
You should now be able to watch your defined maps in your browser:
http://<nagiosserver>/nagvis/index.php?map=<mapname>
Resources
Last updated 11 Mar 2008, 07:33 +0200.