Notification Escalation - [Suppression Workaroun Posted]

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
uaslam
Posts: 21
Joined: Fri Jun 14, 2013 10:38 am

Re: Service Notification Escalation

Post by uaslam »

sreinhardt wrote:I believe you are correct. This should definitely apply to everything. The best option I can give you would be to redefine that service group and check. One for production and one for staging. While its not ideal to have to recreate these things, we would generally suggest to keep intermingling of production and testing to a minimum.
If if select production hosts under escalation and certain services, would that mean escalation would apply to only those hosts and their services? if yes, it solves my problem.

Could you tell me an easy way to rename (append a prefix to) all services that belong to a certain service-template (or service-group)?
Also, its there a way I could have an escalation policy inherit original service contact groups?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Service Notification Escalation

Post by slansing »

If if select production hosts under escalation and certain services, would that mean escalation would apply to only those hosts and their services? if yes, it solves my problem.
If I am understanding you correctly, yes, you can select the host and services, then the escalation will apply to all of the selected objects.
uaslam
Posts: 21
Joined: Fri Jun 14, 2013 10:38 am

Re: Service Notification Escalation

Post by uaslam »

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.
Locked