Problem with Macro

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
kiko67
Posts: 10
Joined: Mon Apr 28, 2014 9:14 am

Problem with Macro

Post by kiko67 »

Hi everybody,
i made a little script which:
1. Send notifications to a text file which has name of YYYYMMDDHHMMSSNNNNNN of his creation
2. Verify the file and if it's OK a copy is made (file_OK) in the same folder else it send us a mail
Here's the script

Code: Select all

#!/bin/bash
Date=$(date +%Y%m%d%H%M%S%N)
nameFile=notif$Date
cat <<eof > /config_chl/nagios_to_parcpc/spool/$nameFile
SERVICE ALERT:
Type Notification: $NAGIOS_NOTIFICATIONTYPE
Service: $NAGIOS_SERVICEDISPLAYNAME
Host: $NAGIOS_HOSTALIAS
State: $NAGIOS_SERVICESTATE
ID Service: $NAGIOS_SERVICESTATEID
Description: $NAGIOS_LONGSERVICEOUTPUT
Date Time: $NAGIOS_SHORTDATETIME
eof
if test -r config_chl/nagios_to_parcpc/spool/$nameFile]; then
cp -u -p /config_chl/nagios_to_parcpc/spool/$nameFile /config_chl/nagios_to_parcpc/spool/${nameFile}_OK
else
echo -e "NAGIOS\nProblem with Nagios.\nVerify lfolder /config_chl/nagios_to_parcpc/spool" | /bin/mail -s "Probleme interface nagios " email
fi

Now i have a problem

All the fields with differents macros work well except
$NAGIOS_LONGSERVICEOUTPUT
which normally send a long description of alert
while:
$NAGIOS_SERVICEOUTPUT
works very well

Why ? :o
Have you an idea ?

Thx for ur help

PS: In the misccommand i have
command_name >>>>>>>>>notify_to_txt
command_line>>>>>>>>>>>the path to script (WITHOUT MACROS RECALL)
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Problem with Macro

Post by abrist »

What version of nagios are you running?
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