Gone are the days of tedious console only configuration of Nagios. While it’s an excellent system monitoring tool, it can be a little daunting to configure and setup. Not to mention editing 5 or 6 configuration files when adding one host.

In April 2008, Nagios Administrator was released, which promises to deliver an easy to use administration interface for configuring your Nagios installation with ease. The interface allows for adding contacts, contact groups, services, operating systems, and other settings. The one thing we noticed that was missing was service groups, but we’re not sure that really matters.

Using this article in conjunction with our previous Monitoring Asterisk with SNMP article will yeild you great results and awesome statistics.

Since there is already a demo running of the Nagios Administrator, I don’t think I need to show you screenshots, instead here is a link from their site.

Nagios Administrator: <http://demo.nagiosadmin.de Nagios: http://demo.nagiosadmin.de/nagios

Username: nagiosadmin
Password: nagiosadmin

We installed this on a VMWare Appliance, running Ubuntu Server Edition LTS 8.04, so you may have to change the instructions to suit your particular flavour of Linux. Or Microsoft Windows if you’re brave enough to try this on that OS.

Anyhow, now on to the tutorial on getting Nagios 3.0 running with Nagios Administrator on your Ubuntu Server.

First, with the help of Michel Sigloch, we have this from a script of his that we’ve edited. This will install Nagios 3.0 from source on your ubuntu server, since the apt tree still holds an older version.

Installing Nagios

Start with the preliminaries:

# sudo apt-get install apache2 build-essential wget perl libgd2-xpm-dev openssl libssl-dev openssh-server openssh-client ntpdate snmp smbclient libldap-2.3-0 libldap2-dev mysql-server libmysqlclient15-dev qstat libnet-snmp-perl mrtg nut unzip  
# sudo userdel -f nagios  
# sudo useradd -c "Nagios Admin" nagios  
# sudo groupadd nagcmd  
# sudo usermod -G nagcmd nagios  
# sudo usermod -G nagcmd www-data  
# sudo usermod -a -G nagios www-data

Then We’ll setup the Nagios directories and configure Nagios.

# sudo mkdir /usr/local/src  
# cd /usr/local/src  
# sudo wget <http://nagios.sourceforge.net/download/cvs/nagios-cvs.tar.gz 
# sudo tar xvzf nagios-cvs.tar.gz  
# sudo rm nagios-cvs.tar.gz  
# cd nagios-cvs  
# sudo ./configure –with-command-group=nagcmd

Now lets install Nagios and update the default boot programs, while restarting apache and Nagios

# sudo make all  
# sudo make install  
# sudo make install-init  
# sudo make install-commandmode  
# sudo make install-config  
# sudo ln -sf /usr/local/nagios/etc/ /etc/nagios  
# sudo make install-webconf

Next we’ll setup our htaccess file:

# sudo htpasswd -c /etc/nagios/htpasswd.users nagiosadmin  
# sudo chown www-data htpasswd.users  
# sudo chmod 600 htpasswd.users

Download and configure nagios plugins. The plugins are what let you monitor things like your Asterisk PBX using SNMP or other methods.

# cd /usr/local/src  
# sudo wget <http://heanet.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz 
# sudo tar xvzf nagios-plugins-1.4.11.tar.gz  
# cd nagios-plugins-1.4.11  
# sudo ./configure –with-nagios-user=nagios –with-nagios-group=nagios  
# sudo make  
# sudo make install

Now we are pretty much done with Nagios setup. We can move on to setting up Nagios Administrator. This part of the process can be a little confusing since their documentation is in german. I taught myself a bit of german last night reading this, but I decyphered it for us to use it. Keep reading for the Nagios Administrator Setup portion.

Configuring and installing Nagios Administrator

First, we’ll have to install any pre-requisite packages for Nagios Administrator:

# sudo apt-get install php5-common traceroute php5-cli php5-gd

Now lets create our web directory

# sudo mkdir /var/www/nagiosadmin

Now we can download our Nagios Administrator files and drop them into the web directory on our server.

# cd /usr/src  
# sudo wget <http://www.nagiosadmin.de/nagiosadmin-0.9.1.tar.bz2 
# sudo tar xjpf nagiosadmin-0.9.1.tar.bz2 -C /var/www/nagiosadmin/

Now we’ll create the mysql database. Like this

# mysqladmin -u root -p create nagiosadmin  
# mysql -u root -p
ON nagiosadmin.*  
TO ['nagiosadmin'@'localhost'] 
IDENTIFIED BY 'somepassword';

Now we have to configure Nagios Administrator to connect to our Database.

# cd /var/www/nagiosadmin  
# nano config/propel.ini

and set

propel.database.url = mysql://nagiosadmin:yourpassword@localhost/nagiosadmin

Now we edit the databases file and enter our database settings

# sudo nano config/databases.yml

and set

database: nagiosadmin  
username: nagiosadmin  
password: yourpassword

Now we have to make sure our Nagios shell commands are set properly in Nagios Administrator.

# sudo nano apps/backend/modules/generator/config/module.yml

and make sure your paths are correct for these two lines

config_check_command: /usr/local/nagios/bin/nagios -v /etc/nagios/nagios.cfg 2>&1  
reload_nagios_command: /usr/bin/sudo /usr/bin/killall -HUP nagios

Now we have to enter visudo to set up the permissions for our Nagios user, done like this:

# sudo visudo

then add

# for nagios  
%nagcmd ALL= NOPASSWD: /usr/bin/killall -HUP nagios

Exit visudo by hitting the ESC key, and then typing “:wq” hitting enter.

Now, We have to do a few things that are pretty self explanitory with the Nagios Administrator control file.

# cd /var/www/nagiosadmin  
# sudo ./symfony fix-perms  
# sudo ./symfony propel-insert-sql  
# sudo ./symfony propel-load-data backend  
# sudo ./symfony check

Next we’ll have to insert our Apache virtual host.

# sudo nano /etc/apache2/conf.d/nagios.conf

Make sure you enter this line, and change the path to match your install if you changed the above instructions

Alias /nagios/images/logos/nagiosimages /var/www/nagiosadmin/web/uploads/os_images

Also, in the default settings, make sure to change all of the references to the htpasswd file to the following

AuthUserFile /etc/nagios/htpasswd.users

Now, lets setup the new virtual host for our Nagios Administrator and Nagios site.

# sudo mv /etc/apache2/sites-enabled/000-default ~/000-default.backup  
# sudo rm /etc/apache2/sites-enabled/000-default

Now we have to add our new default virtual host configuration like so

# sudo touch /etc/apache2/sites-enabled/nagios.conf

Enter the following, changing any paths as according to your configuration if you deviated from above.

<VirtualHost *:80>

ServerAdmin <root@yourdomain.com 
ServerName monitor.yourdomain.com  
DocumentRoot "/var/www/nagiosadmin/web"  
php_admin_flag magic_quotes_gpc 0  
php_admin_value memory_limit "32M"

<Directory "/var/www/nagiosadmin/web" 
AllowOverride All  
Order allow,deny  
Allow from all  

<Files index.php 
AuthType Basic  
AuthName "NagiosAdmin"  
AuthUserFile /etc/nagios/htpasswd.users  
require user nagiosadmin  

Alias /phpmyadmin /var/www/phpmyadmin  
<Directory /var/www/phpmyadmin 
AllowOverride All  
Order allow,deny  
Allow from all  

Now we have to enable mod rewrite like this

# sudo mod_rewrite aktivieren

And next lets restart Apache

# sudo /etc/init.d/apache2 restart

Configuring Nagios 3.0 to work with Nagios Administrator

Now we have to make some quick edits to the nagios configuration and we’ll be up and running in no time.

First lets edit the Nagios configuration file

# nano /etc/nagios/nagios.cfg

Now make sure yours looks like the following, commenting out the ones that are on by default and adding the new Nagios Administrator directory at the bottom.


# Definitions for monitoring the local (Linux) host  


Now, before starting nagios for the first time, lets go into the configuration interface and set up some default values.

Open a web browser and hit this url:


You should see the login box for your Nagios Administrator site, which you can login with “nagiosadmin” and the password you entered earlier.

Once you login to the site, you will have to configure the following things:

contacts -create -make one or two contacts
contact groups -create -create a contact group, and assign some contacts to it
host groups -create -create a host group
host -create -create some hosts

Now, go to the “Generator” Menu, and click on “Save”.

Now, go back to your command prompt, and start Nagios. It should start with no errors.

# sudo /etc/init.d/nagios start

Now, go back to the web interface, you should be able to save and generate your configuration file with no errors.

Finally, add Nagios to your default runlevel

# sudo update-rc.d nagios defaults

Congratulations, we’re finished!

We are now finished with the setup. It’s up to you to setup proper security measures for the Nagios Administrator and Nagios site.

You can visit the Nagios Administrator panel here:


and you can visit Nagios here


Remember, you can also take a look at our Monitoring Asterisk with SNMP Howto for information on getting even more statistics from your Asterisk PBX than you ever thought possible. We hope you like this article, and welcome comments.


Comment by Simon on 2008-12-03 10:16:16 -0500

This is quite useful but i’m having a minor problem. i have managed to install both Nagios and nagios administrator, i can log in through the web interface but the problem is with creating contacts, groups, hosts etc. i dont see anywhere to add contacts, when i go to view configuration the only option i get is UPDATE. Please assist.

Comment by Matt G on 2008-12-04 04:37:23 -0500

Hi Simon,

Hmm. That sounds like a permissions issue, or the nagios administrator hasn’t been installed properly. I’m not sure I can be of much help with this – the instructions above have worked on a few servers of ours now without issue. The best I can say with the information you’ve provided would be to check your permissions, make sure that your paths are correct, and that apache has been restarted.

if you can provide some more info (logs, etc) then perhaps I can provide more help 🙂


Comment by Simon on 2008-12-15 08:53:40 -0500

Hi again,

I dont know how to explain this situation better, but it seems like i dont have working links! I can open nagios administrator interface, (its in dutch) link to english is not working. When I click kontakte to add a contact the link is not working as well (in my case the link is… I think I need to start afresh! how do i remove everything and start from scratch. I’m new to linux. Thanks in advance.

Comment by Matt G on 2008-12-15 16:04:23 -0500

Hi Simon,

Hmm, it sounds to me like it is a permissions problem, or problem with your virtual host. Can you paste your .htaccess file and your virtual host files so I can take a look?

If you really want to remove everything, just delete your virtual host directory and start fresh, but I don’t think you need to do that as most of the setup is done and it’s just making it work now.

If you can paste your .htaccess, vhost settings and your error.log file from apache that would help in troubleshooting this for you.


Comment by Simon on 2008-12-16 03:13:17 -0500


Options +FollowSymLinks +ExecCGI

RewriteEngine On

# uncomment the following line, if you are having trouble
# getting no_script_name to work
#RewriteBase /

# we skip all files with .something
RewriteCond %{REQUEST_URI} ..+$
RewriteCond %{REQUEST_URI} !.html$
RewriteRule .* – [L]

# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f

# no, so we redirect to our front web controller
RewriteRule ^(.*)$ index.php [QSA,L]

# big crash from our front web controller
ErrorDocument 500 “Application errorsymfony application failed to start properly”

Comment by Simon on 2008-12-16 03:15:51 -0500

ServerAdmin <sbalthazar@tznic.or.tz ServerName
DocumentRoot “/var/www/nagiosadmin/nagiosadmin-0.9.1/web”
php_admin_flag magic_quotes_gpc 0
php_admin_value memory_limit “32M”

AllowOverride All
Order allow,deny
Allow from all

AuthType Basic
AuthName “NagiosAdmin”
AuthUserFile /etc/nagios/htpasswd.users
require user nagiosadmin

Alias /phpmyadmin /var/www/phpmyadmin

AllowOverride All
Order allow,deny
Allow from all

Comment by VP on 2008-12-17 16:17:50 -0500

Hi Simon,

Here’s our VHOST for cacti:

ServerAdmin <support@whatever.com ServerName monitor.whatever.com
DocumentRoot “/var/www/nagiosadmin/web”

AllowOverride All
Order allow,deny
Allow from all
AuthType Basic
AuthName “Administrator”
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require user nagiosadmin

Alias /nagios/images/logos/nagiosimages /var/www/nagiosadmin/web/uploads/os_images

Allow from all
#Order allow,deny
AuthName “Nagios Access”
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user

ScriptAlias /nagios/cgi-bin “/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

Alias /nagios “/usr/local/nagios/share”

Options None
AllowOverride All
Order allow,deny
Allow from all
AuthName “Nagios Access”
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user

Comment by VP on 2008-12-17 16:21:02 -0500

and we do not have a htaccess in /var/www/nagiosadmin

see if that helps ya

Comment by mysql problem on 2009-02-09 11:55:45 -0500

any idea about this error ? :

mysqlGRANT SELECT,INSERT,UPDATE,DELETE,CREATE,ALTER,INDEX,DROPON nagiosadmin.*TO ’nagiosadmin’@’localhost’IDENTIFIED BY ‘password’;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘DROPON nagiosadmin.*TO ’nagiosadmin’@’localhost’IDENTIFIED BY ‘password’ at line 1

Comment by mysql problem on 2009-02-09 12:59:45 -0500

ok. problem solved…

Comment by Mario on 2009-03-23 11:22:10 -0500

From browser open nagios server and …….

Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 4864 bytes) in /var/www/nagiosadmin/lib/vendor/symfony/lib/util/sfYaml.class.php on line 72

how can resolve?

Comment by Matt G on 2009-03-23 11:42:17 -0500

You’ll have to increase your php memory limit to get rid of that error.

Comment by sunpengya on 2009-07-02 07:48:08 -0500

Be sure that the settings for config_check_command in the file /usr/local/apache2/htdocs/nagiosadmin/apps/backend/modules/generator/config/module.yml are set correctly.

Comment by sunpengya on 2009-07-02 07:49:44 -0500

Everything is ok ,but generator the nagiosadministrator refer to that.