Nagios Core 3.2.3
I'm trying to use the $LONGSERVICEOUTPUT$ Macro, which as I understand it, it holds everything after the first line by escaping
all "\n" newline chars and putting all the subsequent lines (*after the 1st line) onto a single line and stores it in $LONGSERVICEOUTPUT$ Macro.
But when I receive the Service Notification that contains the LONGSERVICEOUTPUT Macro it is blank....
I'm sending the command to Nagios using NSCA.
So if I run this command from the remote server:
Code: Select all
echo "Host_name1,Check_Service myName,2,CRITICAL: This is a Test Message for Nagios\nThis is Line 2\nThis is Line 3\nLines 1-2-3 should be in the LONGSERVICEOUTPUT Macro" | send_nsca -H 192.168.111.1 -p 5667 -d , -c /usr/local/nagios/etc/send_nsca.cfg
Code: Select all
Jan 11 17:31:14 Localhost nagios: EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;Host_name1;Check_Service myName;2;CRITICAL: This is a Test Message for Nagios
Jan 11 17:31:14 Localhost nagios: EXTERNAL COMMAND: PROCESS_HOST_CHECK_RESULT;Lines 1;2;3 should be in the LONGSERVICEOUTPUT Macro
Jan 11 17:31:14 Localhost nagios: Warning: Passive check result was received for host 'Lines 1', but the host could not be found!
Jan 11 17:31:20 Localhost nagios: PASSIVE SERVICE CHECK: Host_name1;Check_Service myName;2;CRITICAL: This is a Test Message for Nagios
Jan 11 17:31:20 Localhost nagios: SERVICE ALERT: Host_name1;Check_Service myName;CRITICAL;HARD;1;CRITICAL: This is a Test Message for Nagios
I created 2 scripts that simply take in a few variables (which will be the Macros I want to use) and write their values to a file.
Here are the Commands Config:
These get called because they are defined in my Contact's Config which is apart of the Main Service Definition for this Service in question.
So the service gets run, it then checks my contact which contains the 2 commands below. Then after they run it DOES write to the file but
some of the MACROS are NOT getting any data... Mostly just want LONGSERVICEOUTPUT
Code: Select all
define command {
command_name get-host-macros
command_line $USER1$/prelude_logSize_check/TEST_MACROS/write_hostMacros "$HOSTNAME$" "$HOSTDISPLAYNAME$" "$HOSTALIAS$" "$HOSTADDRESS$" "$HOSTOUTPUT$" "$HOSTNOTES$"
}
define command {
command_name get-service-macros
command_line $USER1$/prelude_logSize_check/TEST_MACROS/write_serviceMacros "$SERVICEDESC$" "$SERVICEDISPLAYNAME$" "$SERVICESTATE$" "$SERVICESTATEID$" "$SERVICEDURATION$" "$LONGSERVICEOUTPUT$" "$SERVICEPERFDATA$" "$SERVICENOTES$"
}
Any thoughts would be MUCH appreciated!!
Thanks in Advance,
Matt