Thanks CGraham, but your suggestion return (null) :
Aug 12 06:13:43 nagios nagios: SERVICE ALERT: Inwise;Drive D: Disk Usage;CRITICAL;HARD;2;(null)
Anyway, I did somthing simular and used "sed" on the command itself:
$USER1$/check_nt -H $HOSTADDRESS$ -s "$ARG1$" -p 12489 -v $ARG2$ $ARG3$ | sed -e 's/%/ percent/g'
This is not good as from some reason when I simulate now "WARNING" it returns "OK". maybe the % "sign" is hardcoded somewhere ?
without sed:
Aug 12 07:18:15 nagios nagios: SERVICE NOTIFICATION: _Test;Inwise;Drive D: Disk Usage;WARNING;notify-oz_test-ser
vice;D:\ - total: 10.00 Gb - used: 3.33 Gb (33%) - free 6.67 Gb (67%)
With sed:
Aug 12 07:22:10 nagios nagios: SERVICE NOTIFICATION: _Test;Inwise;Drive D: Disk Usage;OK;notify-oz_test-ser
vice;C:\ - total: 10.00 Gb - used: 3.33 Gb (33 percent) - free 6.67 Gb (67 percent)
--------------------------------------------------------------------------------------------------------------------------
In general, I want the save some costs by converting the SMS notifications into smartphone push notification.
So I have an external company proccess which runs in the backround and collects events.
The command which generates the event:
/usr/bin/printf "Destination:oz_test|\nSubject: $NOTIFICATIONTYPE$ : $HOSTNAME$ \nBody: $SERVICESTATE$ - $HOSTALIAS$ - $SERVICEDESC$ - $SERVICEOUTPUT$ - $HOSTADDRESS$ - $LONGDATETIME$\n\n"> `mktemp -p /usr/local/test_Nagios/eventfiles/ nagioseventfile_XXXXXXXXX`
Now, the "printf' command doesn't returns "%" so the it just cuts every thing after that sign.
the event generated:
Aug 12 07:18:15 nagios nagios: SERVICE NOTIFICATION: _Test;Inwise;Drive D: Disk Usage;WARNING;notify-oz_test-by-TeamTilt-ser
vice;D:\ - total: 10.00 Gb - used: 3.33 Gb (33
I can use the "echo" command instead of "printf" and then the event turns out ok with the "%" but somehow thier proccess won't accept it (they can't help with that).
I have tried also sed on the "SERVICEOUTPUT" inside that command but it's not working also:
usr/bin/printf "Destination:oz_test|\nSubject: $NOTIFICATIONTYPE$ : $HOSTNAME$ \nBody: $SERVICESTATE$ - $HOSTALIAS$ - $SERVICEDESC$ - $(echo $SERVICEOUTPUT$ | sed -r 's/[%]+/&&/') - $HOSTADDRESS$ - $LONGDATETIME$\n\n"> `mktemp -p /usr/local/test_Nagios/eventfiles/ nagioseventfile_XXXXXXXXX`.
----------------------------------------------------------------------------------------------------------------------------
I can't understand how I can customize a macro for my needs according to the below link:
http://assets.nagios.com/downloads/nagi ... iables.pdf
I need that "SERVICEOUTPUT" to not contain any "%".
Maybe you can also help to understand why the "sed" manipulation on the "check_nt" returns "OK" instead of "WARNING"
Thanks a lot.