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 ?
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)