Page 1 of 1

Notification variables

Posted: Wed Feb 05, 2014 9:23 pm
by BanditBBS
Ok, so I want to modify my on_call handling just a tad, I have these two commands in ccm:

Code: Select all

xi_service_notification_handler_on_call
  $USER1$/service_on_call.pl "$CONTACTNAME$" $NOTIFICATIONTYPE$ "$NOTIFICATIONISESCALATED$" "$NOTIFICATIONAUTHOR$" "$NOTIFICATIONCOMMENT$" "$HOSTNAME$" "$HOSTADDRESS$" "$HOSTALIAS$" "$HOSTDISPLAYNAME$" "$SERVICEDESC$" $HOSTSTATE$ $HOSTSTATEID$ $SERVICESTATE$ $SERVICESTATEID$ $LASTSERVICESTATE$ $LASTSERVICESTATEID$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ $MAXSERVICEATTEMPTS$ $SERVICEEVENTID$ $SERVICEPROBLEMID$ "$SERVICEOUTPUT$" "$LONGSERVICEOUTPUT$" "$LONGDATETIME$"

Code: Select all

  xi_host_notification_handler_on_call
  $USER1$/host_on_call.pl "$CONTACTNAME$" $NOTIFICATIONTYPE$ "$NOTIFICATIONISESCALATED$" "$NOTIFICATIONAUTHOR$" "$NOTIFICATIONCOMMENT$" "$HOSTNAME$" "$HOSTADDRESS$" "$HOSTALIAS$" "$HOSTDISPLAYNAME$" $HOSTSTATE$ $HOSTSTATEID$ $LASTHOSTSTATE$ $LASTHOSTSTATEID$ $HOSTSTATETYPE$ $HOSTATTEMPT$ $MAXHOSTATTEMPTS$ $HOSTEVENTID$ $HOSTPROBLEMID$ "$HOSTOUTPUT$" "$LONGHOSTOUTPUT$" "$LONGDATETIME$"
Both of those scripts do what they need to do and end with a command similar to this:

Code: Select all

system("/usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_notification.php --notification-type=host --contact=\"$user\" --contactemail=\"@$ref\" --type=$ARGV[1] --escalated=\"$ARGV[2]\" --author=\"$ARGV[3]\" --comments=\"$ARGV[4]\" --host=\"$ARGV[5]\" --hostaddress=\"$ARGV[6]\" --hostalias=\"$ARGV[7]\" --hostdisplayname=\"$ARGV[8]\" --hoststate=$ARGV[9] --hoststateid=$ARGV[10] --lasthoststate=$ARGV[11] --lasthoststateid=$ARGV[12] --hoststatetype=$ARGV[13] --currentattempt=$ARGV[14] --maxattempts=$ARGV[15] --hosteventid=$ARGV[16] --hostproblemid=$ARGV[17] --hostoutput=\"$ARGV[18]\" --longhostoutput=\"$ARGV[19]\" --datetime=\"$ARGV[20]\"");
What I'm wanting to do, is change what my scripts do, based on the notification #. Is there a variable I can pass that tells it what notification it is currently on? I tried searching and just couldn't seem to find the proper information if it exists.

Re: Notification variables

Posted: Thu Feb 06, 2014 10:37 am
by BanditBBS
tired of waiting on that slow poke Trevor to answer or Andy to come and tell me NO, so I googled some more. LOL :lol:

http://nagios.sourceforge.net/docs/3_0/ ... tionnumber is what I want, right?

Re: Notification variables

Posted: Thu Feb 06, 2014 10:50 am
by abrist
BanditBBS wrote:Andy to come and tell me NO
BanditBBS wrote:is what I want, right?
Yes.

Re: Notification variables

Posted: Thu Feb 06, 2014 10:52 am
by BanditBBS
HAHAHA, On an angry call right now and I almost bust out laughing.

Thanks Andy, lock her up!

Re: Notification variables

Posted: Thu Feb 06, 2014 10:55 am
by abrist
BanditBBS wrote:Thanks Andy, lock her up!
NO.