Nagios has a lot to offer, though the setup and administration of the network monitoring tool can be a challenge. Even once this powerful system is up and running, you have to manually configure flat text files to add hosts, domains, alerts, and more. NagiosQL is a web-based GUI tool that you can use for the administration work.
NagiosQL's features include these capabilities:
- Build complex configurations
- Manage and use all of your configurations
- 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 configurations
- MySQL database platform
NagiosQL's installation requirements
- Web server (Apache 2.x or greater preferred)
- MySQL 5.x or greater
- Nagios 2.x/3.x (local or remote)
- PHP 5.2.0 or greater including:
- PHP Module: Session
- PHP Module: MySQL
- PHP Module: gettext
- PHP Module: filter
- PHP Module: FTP (optional)
- PECL Extension: SSH (optional)
For this tutorial, I assume you have Nagios installed and have tested a basic configuration so you know it's running properly. You should have everything you need to install NagiosQL with one tiny exception: a database; the good news is the NagiosQL installer will create and populate that database for you.
I walk through the steps of getting this powerful GUI installed so you can start managing your Nagios monitor. I demonstrate this installation on a Ubuntu machine; this installation should work fine on Ubuntu 10.04-12.04.
Step 1: Download the necessary file
Download NagiosQL (make sure the release most closely matches the release of Nagios you are running). After you download the proper .tar.gz file, move that file into the document root of your web server (in the case of Ubuntu, it is /var/www).
Step 2: Extract the downloaded file
- Open a terminal.
- Change to the document root with the command cd /var/www.
- Unpack the newly downloaded tar file with the command sudo tar xvzf nagiosql_XXX.tar.gz (XXX is the release number).
- Rename the newly created nagiosql32 directory to nagiosql with the command sudo mv nagiosql32 nagiosql.
Step 3: Change the permissions of the necessary folders
You must run the following commands in order to give NagiosQL the proper permission to install and run. (Note: This assumes your web server runs under the www-data user name; if it doesn't, alter the commands to suit your setup.)
Nagios main configuration files
- sudo chgrp www-data /etc/nagios
- sudo chgrp www-data /etc/nagios/nagios.cfg
- sudo chgrp www-data /etc/nagios/cgi.cfg
- sudo chmod 775 /etc/nagios
- sudo chmod 664 /etc/nagios/nagios.cfg
- sudo chmod 664 /etc/nagios/cgi.cfg
- sudo chmod 6755 /etc/nagiosql
- sudo chown www-data.nagios /etc/nagiosql
- sudo chmod 6755 /etc/nagiosql/hosts
- sudo chown www-data.nagios /etc/nagiosql/hosts
- sudo chmod 6755 /etc/nagiosql/services
- sudo chown www-data.nagios /etc/nagiosql/services
NagiosQL backup configuration
- sudo chmod 6755 /etc/nagiosql/backup
- sudo chown www-data.nagios /etc/nagiosql/backup
- sudo chmod 6755 /etc/nagiosql/backup/hosts
- sudo chown www-data.nagios /etc/nagiosql/backup/hosts
- sudo chmod 6755 /etc/nagiosql/backup/services
- sudo chown www-data.nagios /etc/nagiosql/backup/services
Amend already existing files
- sudo chmod 644 /etc/nagiosql/*.cfg
- sudo chown www-data.nagios /etc/nagiosql/*.cfg
- sudo chmod 644 /etc/nagiosql/hosts/*.cfg
- sudo chown www-data.nagios /etc/nagiosql/hosts/*.cfg
- sudo chmod 644 /etc/nagiosql/services/*.cfg
- sudo chown www-data.nagios /etc/nagiosql/services/*.cfg
The Nagios binary must be executable by the Apache user
- sudo chown nagios.www-data /usr/sbin/nagios
- sudo chmod 750 /usr/sbin/nagios-
Step 4: Begin the web installYou should be able to fire up your browser and point it to http://ADDRESS_TO_SERVER/nagiosql/install/ (ADDRESS_TO_SERVER is the actual address of the server hosting NagiosQL), where you can begin the web-based installation. On the first screen, NagiosQL lists what you need and prompts you to install (Figure A). Click the START INSTALLATION button to begin the process. Figure A
Click the image to enlarge.NagiosQL will make sure everything passes muster for the installation. If anything fails, this screen (Figure B) will give you plenty of information about the problem. In Figure B, you see two warnings that must be fixed before proceeding (this was done intentionally). Figure B
Click the image to enlarge.
You will most likely encounter the timezone issue on your php.ini file. For the Ubuntu installation, here's how that is solved:
- Open a terminal.
- Change to the /etc/php5/apache2 directory.
- Open the php.ini file in your favorite editor.
- Find the line ; date.timezone =America/Chicago (it will be around line 951).
- Remove the ";" and make sure the timezone information is accurate.
- Save the file.
After you handle everything on this page, a green arrow button will appear at the bottom right corner of the page—click it to move on to the next stage.
Step 5: Configure a databaseThe installer creates a database for you. On the next screen (Figure C), enter all of the necessary information for the database and for the NagiosQL admin user setup, check the boxes for the importing of sample config files (if you want them), and click the green arrow at the bottom of the page. If there are default values (such as for the database name), those should work fine. Figure C
Click the image to enlarge.
In the final page of the setup, you will be prompted to remove the install directory and click the green arrow. To remove the install directory, do the following:
- Open a terminal window.
- Change to the /var/www/nagiosql directory with the command cd /var/www/nagiosql.
- Remove the directory with the command sudo rm -rf install.
Step 6: Log in
You log in to your NagiosQL site by pointing your browser to http://ADDRESS_TO_SERVER/nagiosql/ (ADDRESS_TO_SERVER is the address of the server hosting NagiosQL) and logging in with the credentials you created during installation.
Congratulations! You now have a web-based GUI tool that will help you configure and manage your Nagios monitor. Happy Nagios-ing.
Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website getjackd.net.