Error with custom service macros and event handling.
Posted: Mon Mar 10, 2014 4:01 pm
Hello!
I'm working on implementing an event handler that would create a trouble ticket with an external ticketing system when a service was in a CRITICAL state. Because of how the ticket system works, it needs a lot of variables and I've found that the custom _SERVICE macros can fill that role nicely. My problem is that I'm trying to pass a specific number of arguments (16) to an event handler and only a certain amount of data is actually getting through.
Here is the service:
Here is the command.cfg entry:
Now here is the restartservice.sh script and a quick explanation. All I want do to at this moment is get a listing of the variables sent to me so that I can ensure that they are formatted correctly and look right before I actually try submitting the data to the ticketing system script:
Here is the email I get:
Any insights would be hugely appreciated - thanks!
- Jim
I'm working on implementing an event handler that would create a trouble ticket with an external ticketing system when a service was in a CRITICAL state. Because of how the ticket system works, it needs a lot of variables and I've found that the custom _SERVICE macros can fill that role nicely. My problem is that I'm trying to pass a specific number of arguments (16) to an event handler and only a certain amount of data is actually getting through.
Here is the service:
Code: Select all
define service{
use prod-java ; Name of service template to use
host_name WorkQueueDelta-PFIX
service_description DeltaSessionManager: SW114
check_command check_nrpe_long!check_sw114
check_interval 3
_SERVICE restart_sw114
_CLASSIFICATIONID SC_WORKFLOW_PORTAL
_HIERARCHYPATH '"SC_APP_SYS \\\ SC_WORKFLOW_PORTAL"'
_CLASSSTRUCTUREID 5642
_DESCRIPTION '"sw114 DeltaSession Manager has stopped running."'
_FR1CODE '"Unknown - code issue."'
_FR2CODE '"Restart standalone java process."'
_PROBLEMCODE '"Standalone sw114 process terminated on it's own."'
_IMPACT 3
_INTERNALPRIORITY 4
_REPORTEDPRIORITY 3
_URGENCY 3
_OWNER AR333
_OWNERGROUP WASTEAM
retry_interval .5
max_check_attempts 2
event_handler restart-service
notifications_enabled 1
}Code: Select all
define command {
command_name restart-service
command_line $USER1$/restartservice.sh $SERVICESTATE$ $HOSTADDRESS$ $_SERVICECLASSIFICATIONID$ $_SERVICEHIERARCHYPATH$ $_SERVICECLASSSTRUCTUREID$ $_SERVICEDESCRIPTION$ $_SERVICEFR1CODE$ $_SERVICEFR2CODE$ $_SERVICEPROBLEMCODE$ $_SERVICEIMPACT$ $_SERVICEINTERNALPRIORITY$ $_SERVICEREPORTEDPRIORITY$ $_SERVICEURGENCY$ $_SERVICEOWNER$ $_SERVICEOWNERGROUP$ $SERVICEPROBLEMID$
}Code: Select all
#!/bin/bash
#
case "$1" in
OK)
;;
WARNING)
;;
UNKNOWN)
;;
CRITICAL)
echo "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" "$10" "$11" "$12" "$13" "$14" "$15" "$16"| mail -s "Variables going to perl" [email protected]
;;
esac
exit 0Here is the email I should get:CRITICAL 10.14.172.238 SC_WORKFLOW_PORTAL SC_APP_SYS \ SC_WORKFLOW_PORTAL 5642 sw114 DeltaSession Manager
What am I doing wrong? Is there a limit that I'm hitting? Am I doing something super stupid that is obvious and I can't see? I've seen no documentation on the number of custom macros that I can use or anything that would explain what I'm doing wrong. I've looked through macros.h, limits.h, nagios.h, etc and I got nothin. I have tried a few different ways of getting the ARGV variables and processing / displaying them and I've hit a wall.CRITICAL 10.14.172.238 SC_WORKFLOW_PORTAL SC_APP_SYS \ SC_WORKFLOW_PORTAL 5642 sw114 DeltaSession Manager has stopped running. Unknown - code issue. Restart standalone java process. Standalone sw114 process terminated on it's own. 3 4 3 3 AR333 WASTEAM *SERVICEPROBLEMID*
Any insights would be hugely appreciated - thanks!
- Jim