Nagios is system and network monitoring application.

Because many people experience installation problems under Debian, there are some notes about the installation of Nagios with the MySql support under Debian sarge.


Database access

Unless it already exists, create a database:

mysqladmin -u root -p create nagios

Then, load the nagios database schema:

zcat /usr/share/doc/nagios-mysql/create_mysql.gz | mysql -u root -p nagios

Grant the necessary privileges to the nagios database login:

mysql -u root -p nagios 
GRANT SELECT, INSERT, UPDATE, DELETE ON nagios.* TO nagios@localhost IDENTIFIED BY 'somepass'; 
GRANT LOCK TABLES ON nagios.* TO nagios@localhost IDENTIFIED BY 'somepass';

Edit the /etc/nagios/resource.cfg and /etc/nagios/cgi.cfg files to set the database name, user and password, beginning with the resource.cfg file lines :


After editing, they should read similarly to :


Note that this assumes that you've left mysql on the standard port. If not, please adjust the port setting accordingly and uncomment that line. After you have edited the status data DB settings, you will need to edit the comment, downtime, and retention settings; you can either uncomment each appropriate line and duplicate the appropriate settings, or you can copy the whole block of settings and change the setting names (e.g. xsddb_host becomes xcddb_host for comment data, xdddb_host for downtime data, and xrddb_host for retention data).

Now edit the /etc/nagios/cgi.cfg and put a # in front of the line :

nagios_check_command=/usr/lib/nagios/plugins/check_nagios /var/log/nagios/status.log 5 'nagios'

and remove the # in front of the line ::


Note: you need to restart the nagios daemon to use these new settings ::

$> sudo /etc/init.d/nagios restart

You should see this message in the /var/log/nagios/nagios.log log file ::

$> tail -f /var/log/nagios/nagios.log
[1072703571] Nagios 1.1 starting... (PID=10166)

And nothing which begins with Error: ;-)

Apache configuration

Include the /etc/nagios/apache.conf into your apache configuration. You can add this line to your /etc/apache/httpd.conf :

Include /etc/nagios/apache.conf

Apache authentication

Create a htpasswd entry for the nagiosadmin user :

sudo htpasswd -c /etc/nagios/htpasswd.users nagiosadmin

Bug fixes

Permissions on /etc/nagios-plugins prevent nagios from working

If you have followed all other steps, including those in /usr/share/doc/nagios-mysql/README.Debian, and are still being told that you lack permission to view host or service information, verify that /etc/nagios-plugins is owned by user nagios and group nagios so that the CGI scripts can access it.


how_to_install_nagios_under_debian.txt · Last modified: 2006/10/21 09:51 by
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Run by Debian Driven by DokuWiki