nagiosdigger
------------

How to install:
- copy all .php files somewhere reachable by your webserver. consider shielding
  it with an .htaccess file
- install the jpgraph library (http://www.aditus.nu/jpgraph/)
- create a database with a table that will contain the logging. use
  'create_tables.sql' as a table-template
  mysql:
  CREATE DATABASE nagiosdigger;
  GRANT INSERT,SELECT ON nagiosdigger.logs TO nagioslogs@localhost IDENTIFIED BY 'nagioslogspw';
  FLUSH PRIVILEGES;
  cat create_tables.sql | mysql nagiosdigger
- change the dbi_... variables in /etc/nagios/nagiosdigger/config.ini to what they must be to be able to reach your database;
- in the config.inc.php-file you should also change the path that points to the jpgraph library;
- don't forget to set 'log_rotation_method=' in nagios.cfg to something different
  then 'n' ('n' = none)

2 options for sending the nagios events to the database
- create a cronjob (running, say, ever half hour) entry doing this:
  cat /usr/local/nagios/var/nagios.log | /root/bin/import_nagios_logging
  You might need to change the path to the nagios-logging. You might also need to
  change the path to the 'import_nagios_logging' script.

**ALT note:** The script is at /usr/sbin/nagiosdigger-import.

OR
- in 'nagios.cfg' change 'global_service_event_handler' to:
  global_service_event_handler=global_service_event_handler
  and add to 'misccommands.cfg' (or some other file as long as it is included by
  nagios.cfg) the following:
  define command {
          command_name    global_service_event_handler
          command_line    /root/bin/global_service_event_handler "$TIMET$" "$HOSTNAME$" "$SERVICEDESC$" "$SERVICESTATE$" "$SERVICESTATETYPE$" "$SERVICEATTEMPT$" "$SERVICEOUTPUT$"
          }
  You might need to change the path to the 'global_service_event_handler' script.

**ALT note:** The command is called nagiosdigger-service-handler. The
  corresponding configuration files is already in /etc/nagios/commands.

Importing old data:
  cat /usr/local/nagios/var/archives/* | sort | /root/bin/import_nagios_logging

On Debian systems, the logging is actually stored in /var/log/nagios[23]/[archive/]


Feel free to contact me for anything you like at folkert@vanheusden.com
Please consider using PGP when sending e-mail to me. My key-id is 1f28d8ae.
