I have created a work around for what we desire, im posting it here so others can benefit from it. Basically we setup contacts normally with no escalation policy. To suppress X amount notification for some contacts I did the following...
Edit
/usr/local/nagiosxi/scripts/handle_nagioscore_notification.php and add the folowing code on line 22 after //print_r($args);
Code: Select all
// Usman
if (array_key_exists("notificationcount", $args) AND array_key_exists("suppressioncount", $args)) {
// echo "Conditions Match!\n";
if($args['notificationcount'] <= $args['suppressioncount']){
// echo "Notification Supressed!\n";
exit();
}
else{
// echo "Notification Sent!\n";
}
}
else{
// echo "Conditions DONT Match!\n";
}
// Usman
update the
xi_service_notification_handler command to pass the two extra required variables
/usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_notification.php --notification-type=service --contact="$CONTACTNAME$" --contactemail="$CONTACTEMAIL$" --type=$NOTIFICATIONTYPE$ --escalated="$NOTIFICATIONISESCALATED$" --author="$NOTIFICATIONAUTHOR$" --comments="$NOTIFICATIONCOMMENT$" --host="$HOSTNAME$" --hostaddress="$HOSTADDRESS$" --hostalias="$HOSTALIAS$" --hostdisplayname="$HOSTDISPLAYNAME$" --service="$SERVICEDESC$" --hoststate=$HOSTSTATE$ --hoststateid=$HOSTSTATEID$ --servicestate=$SERVICESTATE$ --servicestateid=$SERVICESTATEID$ --lastservicestate=$LASTSERVICESTATE$ --lastservicestateid=$LASTSERVICESTATEID$ --servicestatetype=$SERVICESTATETYPE$ --currentattempt=$SERVICEATTEMPT$ --maxattempts=$MAXSERVICEATTEMPTS$ --serviceeventid=$SERVICEEVENTID$ --serviceproblemid=$SERVICEPROBLEMID$ --serviceoutput="$SERVICEOUTPUT$" --longserviceoutput="$LONGSERVICEOUTPUT$" --datetime="$LONGDATETIME$"
--notificationcount=$SERVICENOTIFICATIONNUMBER$ --suppressioncount=$_CONTACTSUPPRESSIONCOUNT$
Add
_SUPPRESSIONCOUNT free variable under misc settings in XI to contact templates and define it to 0.
Define
_SUPPRESSIONCOUNT free variable on individual contacts with a number X. Essentially, the hack will not send out these notifications and escalates if the service state remains critical for X number of notifications.
Requires no escalation policies, you can use contacts just as you normally would and once setup, its maintenance free. If you have any suggestion to make it better, please share.
Word doc with screenshots is attached. This thread can be locked or marked as resolved.
Thanks!
You do not have the required permissions to view the files attached to this post.