Custom variables in notifcations return 1

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
cockraml
Posts: 28
Joined: Tue May 07, 2013 8:10 am

Custom variables in notifcations return 1

Post by cockraml »

I am having problems having a custom variable show up in email alerts correctly. My point of contact line returns 1. The service alerts work fine. Thanks for your help.


Below is a snippet of my objects.cache:

Code: Select all

 
      define host {
        host_name      <hostname>
        address <ipaddress>       
       ... 
       retain_status_information       1
        retain_nonstatus_information    1
        _XIWIZARD       solaris
        _POC_GROUP      Unix Team
        }


define command {
        command_name    xi_host_notification_handler
        command_line    /usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_notification.php --notification-type=host --contact="$CONTACTNAME$" --contactemail="$CONTACTEMAIL$" --type=$NOTIFICATIONTYPE$ --escalated="$NOTIFICATIONISESCALATED$" --author="$NOTIFICATIONAUTHOR$" --comments="$NOTIFICATIONCOMMENT$" --host="$HOSTNAME$" --hostaddress="$HOSTADDRESS$" --hostalias="$HOSTALIAS$" --hostdisplayname="$HOSTDISPLAYNAME$" --hoststate=$HOSTSTATE$ --hoststateid=$HOSTSTATEID$ --lasthoststate=$LASTHOSTSTATE$ --lasthoststateid=$LASTHOSTSTATEID$ --hoststatetype=$HOSTSTATETYPE$ --currentattempt=$HOSTATTEMPT$ --maxattempts=$MAXHOSTATTEMPTS$ --hosteventid=$HOSTEVENTID$ --hostproblemid=$HOSTPROBLEMID$ --hostoutput="$HOSTOUTPUT$" --longhostoutput="$LONGHOSTOUTPUT$" --datetime="$LONGDATETIME$" --hostpocgroup "$_HOSTPOC_GROUP$"
        }

define command {
        command_name    xi_service_event_handler
        command_line    /usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_event.php --handler-type=service --host="$HOSTNAME$" --service="$SERVICEDESC$" --hostaddress="$HOSTADDRESS$" --hoststate=$HOSTSTATE$ --hoststateid=$HOSTSTATEID$ --hosteventid=$HOSTEVENTID$ --hostproblemid=$HOSTPROBLEMID$ --servicestate=$SERVICESTATE$ --servicestateid=$SERVICESTATEID$ --lastservicestate=$LASTSERVICESTATE$ --lastservicestateid=$LASTSERVICESTATEID$ --servicestatetype=$SERVICESTATETYPE$ --currentattempt=$SERVICEATTEMPT$ --maxattempts=$MAXSERVICEATTEMPTS$ --serviceeventid=$SERVICEEVENTID$ --serviceproblemid=$SERVICEPROBLEMID$ --serviceoutput="$SERVICEOUTPUT$" --longserviceoutput="$LONGSERVICEOUTPUT$"
        }






Below is a snippet of the email I receive:

Code: Select all

Notification Type: PROBLEM
Host: <hostname>
State: DOWN
...
Point of Contact: 1



Attached is what is in admin -> Notification management
You do not have the required permissions to view the files attached to this post.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Custom variables in notifcations return 1

Post by abrist »

Could we see the xi_service_notification_handler definition that is working?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
cockraml
Posts: 28
Joined: Tue May 07, 2013 8:10 am

Re: Custom variables in notifcations return 1

Post by cockraml »

This is the command for the service notifications. This is working, just not the host one.

Code: Select all

define command {
	command_name	xi_service_notification_handler
	command_line	/usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_notification.php --notification-type=service --contact="$CONTACT
NAME$" --contactemail="$CONTACTEMAIL$" --type=$NOTIFICATIONTYPE$ --escalated="$NOTIFICATIONISESCALATED$" --author="$NOTIFICATIONAUTHOR$" --comments
="$NOTIFICATIONCOMMENT$" --host="$HOSTNAME$" --hostaddress="$HOSTADDRESS$" --hostalias="$HOSTALIAS$" --hostdisplayname="$HOSTDISPLAYNAME$" --servic
e="$SERVICEDESC$" --hoststate=$HOSTSTATE$ --hoststateid=$HOSTSTATEID$ --servicestate=$SERVICESTATE$ --servicestateid=$SERVICESTATEID$ --lastservice
state=$LASTSERVICESTATE$ --lastservicestateid=$LASTSERVICESTATEID$ --servicestatetype=$SERVICESTATETYPE$ --currentattempt=$SERVICEATTEMPT$ --maxatt
empts=$MAXSERVICEATTEMPTS$ --serviceeventid=$SERVICEEVENTID$ --serviceproblemid=$SERVICEPROBLEMID$ --serviceoutput="$SERVICEOUTPUT$" --longserviceo
utput="$LONGSERVICEOUTPUT$" --datetime="$LONGDATETIME$" --servicepocgroup="$_SERVICEPOC_GROUP$"
	}
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Custom variables in notifcations return 1

Post by abrist »

Ah, I failed a literacy check, you are missing an "=" in your host handler:
cockraml wrote:--hostpocgroup "$_HOSTPOC_GROUP$"
Needs to be:

Code: Select all

--hostpocgroup="$_HOSTPOC_GROUP$"
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
cockraml
Posts: 28
Joined: Tue May 07, 2013 8:10 am

Re: Custom variables in notifcations return 1

Post by cockraml »

That was it. Thank you!!!
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Custom variables in notifcations return 1

Post by abrist »

No problem. Locking 'er up.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked