Page 1 of 1

Add Response URL to custom notification commands

Posted: Wed Dec 12, 2012 5:12 pm
by westernuniv
If a contact defined with such as xi_host_notification_handler" and "xi_service_notification_handler" commands, then the standard email notification will have the Response URL in the message content.

I have the following command defined for qpage notification and it worked.
/usr/bin/printf "Service: %s\nHost: %s\nAddress: %s\nState: %s\nInfo: %s\nDate: %s" '$SERVICEDESC$' '$HOSTNAME$' '$HOSTADDRESS$' '$SERVICESTATE$' '$SERVICEOUTPUT$' '$LONGDATETIME$' | /usr/local/bin/qpage -l 0 -p $CONTACTPAGER$ -s <qpage-server>

I would like to add the Response URL to the Qpage notification message. May I know the variable name referring to response_url which can be used in custom notification?

Thanks

Re: Add Response URL to custom notification commands

Posted: Wed Dec 12, 2012 6:01 pm
by scottwilkerson
This is not possible without creating it in the custom handler.

This is created in the XI Event Notification

Re: Add Response URL to custom notification commands

Posted: Thu Dec 13, 2012 1:25 pm
by westernuniv
Ok, Thanks

The response URL is something like this…
Respond: https://<nagios-host>/nagiosxi//rr.php?uid=49-326-6afb870716f6ee5896167299877d028b

And the xi_service_notification_handler defined as below, May I know which variable below representing the uid in the above URL?

/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$"

Thanks

Re: Add Response URL to custom notification commands

Posted: Thu Dec 13, 2012 4:45 pm
by scottwilkerson
None of these represent it. it is built internally and is complex (on purpose)..but I will break it down for you

49-326-6afb870716f6ee5896167299877d028b

49 = user_id (has to be an XI user id)
326 = object_id of the host/service to open
6afb870716f6ee5896167299877d028b = md5 hash of the use users backend API ticket for the user (from the backend API component)

Re: Add Response URL to custom notification commands

Posted: Thu Dec 13, 2012 5:04 pm
by westernuniv
Oh, it's really complex. I'll give up the idea of having Response URL int he qpage message.
Thanks alot