Nagios with MySQL under Debian Install Guide

From KoshWiki

Jump to: navigation, search

Contents

Description

This guide is based almost solely on the guide I found through google[1].

EDIT: I later realised (wasn't looking was I ?) that the reference I have is a copy/paste of another reference on another site[2]

Installing Nagios-MySQL

Step One - apt-get packages

apt-get install apache2 mysql-server libapache2-mod-auth-mysql nagios-mysql nagios-plugins

This should be fairly straight forward, there were alot of package changes on the server I tested it on, but that was because of the age since the last apt-get dist-upgrade

Step Two - Setup MySQL

(You may not need to do this if you installed from apt-get, my package set this up for me)

Clipped from /usr/share/doc/nagios-common/README.mysql

If you want to run MySQL on the same machine as nagios, we
can help.  First thing, install the mysql-server package.

$ mysqladmin -u root -p create nagios

$ mysql -u root -p nagios < /usr/share/doc/nagios-mysql/create_mysql

$ mysql -u root -p nagios

mysql should be at it's prompt.  Give it the following command:

GRANT SELECT, INSERT, UPDATE, DELETE ON nagios.* TO nagios@localhost IDENTIFIED BY 'password';

(You may want to choose something other than the word 'password')

If you're running MySQL version 4.0.2 or newer, then you will also
have to allow the nagios user to lock the tables. This is done with
the following SQL line (in addition to the GRANT above!):

GRANT LOCK TABLES ON nagios.* TO nagios@localhost IDENTIFIED BY 'password';

Now for the copy/paste enthusiasts, the first line is to make up a good password for you (I like to make up my own, but each to his own).

# head -c1024 /dev/urandom | md5sum | awk '{print $1}'
# mysqladmin -u root -p create nagios
# mysql -u root -p nagios < /usr/share/doc/nagios-mysql/create_mysql
# mysql -u root -p nagios
> GRANT LOCK TABLES, SELECT, INSERT, UPDATE, DELETE ON nagios.* TO nagios@localhost IDENTIFIED BY 'reallysecretpasswordgoeshere';
> quit;

Step Three - Configure Nagios

This is the hard bit, i'll go into this a bit more later, i'll probably have to just wrap up some example "working" files. The examples that come with nagios are way too long for a "make it work and figure it out" kind of person.


References

  1. Debian, Nagios and MySQL Configuration
  2. SAPNagiosRFCPing/NagiosInstall
Personal tools