Monday, June 3, 2013

nagios:: notify-by-email.sh

Requirement:


I want to know who acknowledged a nagios alert I've just received. 

Here's how,

Copy this script to your nagios plugins directory,



Then make sure you specify this file under your nagios configuration, under the commands file or section of you configuration (depends on how your nagios is setup)

define command{
        command_name    notify-by-email
        command_line   /usr/lib64/nagios/plugins/notify-by-email.sh $NOTIFICATIONTYPE$ "$SERVICEDESC$" "$HOSTALIAS$" "$HOSTADDRESS$" "$SERVICESTATE$" "$SERVICEDURATION$" "$LONGDATETIME$" "$SERVICEOUTPUT$" "$CONTACTEMAIL$" "$NOTIFICATIONAUTHOR$" "$NOTIFICATIONCOMMENT$" 
        }

Then under your contacts set the service_notification_commands to notify-by-email as example below,

define contact{
use generic-contact
name email-only
service_notification_commands   notify-by-email
~ truncated ~
}

Enjoy! Remember this is just a quick overview of how to. If you have any question regarding your nagios installation, then please ask.

Cheers,
D

No comments:

Post a Comment