Page 1 of 1

service alert email notification - data truncated

Posted: Tue Nov 15, 2016 1:26 pm
by jh129666
I get the below output when running a plugin from the nagios server, which is the correct output.

WARNING:
plmdb003.prod.cin.mp-emaxx.com
SPACE USAGE WARNING



COLOR...TABLESPACE.................WARN..ALERT...%FREE......TOTAL_MB...FREE_MB
-------|-------------------------|-----|------|-------|-------------|---------
yellow..LABREP_DATA..............60000G....30G....0.86..17,172,608...148,224


When I get the email notification, data in the additional info field is truncated. I thought it was because of the pipe symbol, so I removed the pipe symbol from illegal_macro_output_chars in nagios.cfg but that didn't resolve the issue.


Additional Info:

WARNING:p879jhuk
SPACE USAGE WARNING



COLOR...TABLESPACE.................WARN..ALERT...%FREE......TOTAL_MB...FREE_MB
-------



This is the notify-service-by-email command being used.

/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$$LONGSERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$

Re: service alert email notification - data truncated

Posted: Tue Nov 15, 2016 1:51 pm
by avandemore
What happens if you put a space between $SERVICEOUTPUT$ $LONGSERVICEOUTPUT$?

Re: service alert email notification - data truncated

Posted: Tue Nov 15, 2016 2:35 pm
by jh129666
I added the space but the data is still being truncated in the email notification.


/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$ $LONGSERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$

Re: service alert email notification - data truncated

Posted: Tue Nov 15, 2016 3:04 pm
by gormank
You probably want to not use the pipe character in plugin output (other than for perfdata). Its reserved to separate output from perfdata, so it gets removed as part of processing the plugin output.

Re: service alert email notification - data truncated

Posted: Tue Nov 15, 2016 3:33 pm
by avandemore
Thanks @gormank but the pipe character is required in this context. Without it, it wouldn't work at all.