Page 1 of 1

email notifications using longserviceoutput have \n

Posted: Fri May 08, 2020 11:08 am
by NeoMatrixJR
email notifications using longserviceoutput have \n in the text instead of actual line breaks. Can this be fixed?
Also, I'd like to send a CLI formatted table that would contain "|" characters, is there any way to have "|" characters in the multi-line/long output of a check/plugin without it thinking everything after the 2nd "|" is perf data?

Re: email notifications using longserviceoutput have \n

Posted: Fri May 08, 2020 12:41 pm
by NeoMatrixJR
Also, why does well formatted data like this (on the command line)

Code: Select all

Order sync process has 13 files backed up | files_backed_up=13
StoreID     OrderID              OrderDate           MinutesDelayed FulfillmentDate     StatusID StatusDescription
----------- -------------------- ------------------- -------------- ------------------- -------- -------------------------
       1013              9474275 2020-05-08 12:20:00 11             2020-05-08 00:00:00        1 Order Loading to Store
       1026              9474291 2020-05-08 12:21:00 11             2020-05-09 00:00:00        1 Order Loading to Store
       1040              9474297 2020-05-08 12:21:00 11             2020-05-11 00:00:00        1 Order Loading to Store
       1394              9474288 2020-05-08 12:21:00 11             2020-05-08 00:00:00        1 Order Loading to Store
       1519              9474292 2020-05-08 12:21:00 11             2020-05-09 00:00:00        1 Order Loading to Store
       1531              9460845 2020-05-08 00:11:00 11             2020-05-08 00:00:00        7 Ready for Pickup/Delivery
       1600              9463606 2020-05-08 07:48:00 11             2020-05-08 00:00:00        7 Ready for Pickup/Delivery
       1600              9463705 2020-05-08 07:52:00 11             2020-05-08 00:00:00        7 Ready for Pickup/Delivery
       1600              9474271 2020-05-08 12:20:00 11             2020-05-09 00:00:00        1 Order Loading to Store
       1637              9402457 2020-05-06 11:19:00 11             2020-05-08 00:00:00        7 Ready for Pickup/Delivery
       1637              9436929 2020-05-07 11:14:00 11             2020-05-08 00:00:00        7 Ready for Pickup/Delivery
       1637              9444227 2020-05-07 14:43:00 11             2020-05-08 00:00:00        7 Ready for Pickup/Delivery
       1637              9450530 2020-05-07 18:22:00 11             2020-05-08 00:00:00        7 Ready for Pickup/Delivery
End up like this in the service detail page:

Code: Select all

StoreID OrderID OrderDate MinutesDelayed FulfillmentDate StatusID StatusDescription
----------- -------------------- ------------------- -------------- ------------------- -------- -------------------------
1009 9466419 2020-05-08 09:12:00 11 2020-05-08 00:00:00 7 Ready for Pickup/Delivery
1010 9455895 2020-05-07 20:55:00 14 2020-05-08 00:00:00 7 Ready for Pickup/Delivery
1010 9474519 2020-05-08 12:27:00 15 2020-05-09 00:00:00 1 Order Loading to Store
1013 9465683 2020-05-08 08:51:00 14 2020-05-08 00:00:00 7 Ready for Pickup/Delivery
1013 9452274 2020-05-07 19:15:00 11 2020-05-08 00:00:00 7 Ready for Pickup/Delivery
1013 9447808 2020-05-07 16:46:00 11 2020-05-08 00:00:00 7 Ready for Pickup/Delivery
1013 9474275 2020-05-08 12:20:00 21 2020-05-08 00:00:00 1 Order Loading to Store
1019 9446334 2020-05-07 15:53:00 15 2020-05-08 00:00:00 7 Ready for Pickup/Delivery
1019 9428353 2020-05-07 06:42:00 15 2020-05-08 00:00:00 7 Ready for Pickup/Delivery
1019 9463554 2020-05-08 07:46:00 15 2020-05-08 00:00:00 7 Ready for Pickup/Delivery
1019 9464841 2020-05-08 08:29:00 13 2020-05-08 00:00:00 7 Ready for Pickup/Delivery
1019 9465561 2020-05-08 08:48:00 13 2020-05-08 00:00:00 7 Ready for Pickup/Delivery
1022 9466965 2020-05-08 09:25:00 11 2020-05-08 00:00:00 7 Ready for Pickup/Delivery
1022 9467220 2020-05-08 09:31:00 11 2020-05-08 00:00:00 7 Ready for Pickup/Delivery
1022 9468160 2020-05-08 09:52:00 11 2020-05-08 00:00:00 7 Ready for Pickup/Delivery
1022 9468217 2020-05-08 09:53:00 11 2020-05-08 00:00:00 7 Ready for Pickup/Delivery
1022 9469671 2020-05-08 10:27:00 11 2020-05-08 00:00:00 7 Ready for Pickup/Delivery
1022 9438650 2020-05-07 11:59:00 11 2020-05-08 00:00:00 7 Ready for Pickup/Delivery

Re: email notifications using longserviceoutput have \n

Posted: Fri May 08, 2020 1:57 pm
by ssax
Try editing your xi_service_notification_handler command and change longserviceoutput to this:

Code: Select all

--longserviceoutput="$$(echo "$LONGSERVICEOUTPUT$" | sed 's/\\n/\n/g' )"
See if that resolves it.

There's not currently a way to use | in the output, it's reserved for perfdata, please update the plugin to replace it with some other character for it to work.

This is why the spaces are removed:

Code: Select all

https://stackoverflow.com/a/17784740