Thursday, July 16, 2015

Nagios Core Configuration Using NagiosQL (Web Interface)

NagiosQL is a web based administration tool designed for Nagios, but might also work with forks. It helps you to easily build a complex configuration with all options, manage and use them. NagiosQL is based on a webserver with PHP, MySQL and local file or remote access to the Nagios configuration files.

NagiosQL Features
create, delete, modify and copy settings
create and export configuration files
create and download configuration files
easy configuration import
auto backup configuration files
consistency checks
syntax verification
user management
instant activation of new configs
many translations
easy Installation wizard
MySQL database platform
We have already discussed how to Install Nagios4.0.8 on ubuntu 15.04 Server
Install NagioSQL on Ubuntu 15.04
Download the latest version from here .Once you have .tar.gz file you can move this to /var/www directory
cp nagiosql_320.tar.gz /var/www
Extract the file
sudo tar -xvzf nagiosql_320.tar.gz
Change the permissions
sudo chown -R www-data:www-data nagiosql32
Now you need to configure NagioSQL website under /etc/apache2/sites-available
sudo vi /etc/apache2/sites-available/nagiosql32.conf
add the following lines
Alias /nagiosql32 /var/www/nagiosql32/

Options None
Order allow,deny
allow from all
Save and exit the file
Enable NagioSQL website using the following command
sudo a2ensite nagiosql32
Enabling site nagiosql32.
To activate the new configuration, you need to run:
sudo service apache2 reload
Now you can access the NgiosQL web interface using the following URL
You can see similar to the following screen here click the button START INSTALLATION
NagiosQL installation requirements verification
From the above screen we can see date.timezone setting missing so this can be changed from /etc/php5/apache/php.ini file
sudo vi /etc/php5/apache2/php.ini
change the following line
;date.timezone =
date.timezone =Europe/London
Save and exit the file
NsqiosQL configuration tool required certain permission to change the Naqios Core configuration files from the web interface. Following commands will give proper permission to NagiosQL plugin for the successful installation.
sudo chgrp www-data /usr/local/nagios/etc/
sudo chgrp www-data /usr/local/nagios/etc/nagios.cfg
sudo chgrp www-data /usr/local/nagios/etc/cgi.cfg
sudo chmod 775 /usr/local/nagios/etc/
sudo chmod 664 /usr/local/nagios/etc/nagios.cfg
sudo chmod 664 /usr/local/nagios/etc/cgi.cfg
sudo chown nagios:www-data /usr/local/bin/nagios
sudo chmod 750 /usr/local/bin/nagios
Once you have fixed the error you can see simiilar to the following screen and click next
In this step installer will input the database details to be used for nagiosql. Also update the nagiosql path values as per given screenshots. Click Next
This screen showing that all the steps has successfully completed. You just need to click Next
After completing installation, you will be redirected to NagiosQL login screen here you need to enter login credentials
Once you logged in you can see similar to the following screen
Configure NagiosQL3.2.0 with Nagios Core
This is very important part of NagiosQL setup which will help you to complete integration
Edit NagiosQL Configuration
Login to NagiosQL administrator section and navigate to Administration ---> Administration ---> Config targets and click on Modify button for Local installation.
Edit Nagios Core Configuration File
Now edit nagios configuration file ( Eg: /usr/local/nagios/etc/nagios.cfg ) and commend all earlier cfg_file and cfg_dir configuration settings and add new cfg_dir with /usr/local/nagios/nagiosql only.
sudo vi /usr/local/nagios/etc/nagios.cfg
Comment out all the following lines
Add the following line
Save and exit the file
Verify Nagios core configuration file
sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If above command show no errors on screen, restart nagios core service
sudo /etc/init.d/nagios restart

No comments:

Post a Comment