tags:

views:

11

answers:

1

We use Nagios to send emails when a machine goes down. This works well. We have a self-made alerting system that has an API for issuing alerts. I would like to program against the Nagios alerts and would prefer not to have to parse emails.

Can Nagios logs alerts it sees into a file, or can be configured to run a script when it sees an alert? I could then write a program against this to hook into my alerter.

Thanks!

A: 

First you need to define a command. ours is in our misccommands.cfg

define command{
command_name writetofile
command_line /path/to/script $SERVICESTATE$ $SERVICETYPE$ etc...
}

Then, you need to call this on the event_handler of your service.

define servicenamehere{
...
event_handler writetofile
...
}

mezzie