Ad Widget

Collapse

Problem with Linebreaks in Custom Alert Script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mrgadgetnz
    Junior Member
    • Jul 2011
    • 11

    #1

    Problem with Linebreaks in Custom Alert Script

    Hi,

    We've recently migrated from 2.2.X to 3.4.4 and our custom alerts script has stopped working. We use msmtp to send the email with an HTML body that zabbix forms in the action and is outputted to the custom alert in the {ALERT.MESSAGE} macro.

    Stripping all this down to he basics, I've found the issues we're having.

    If I place the following text in the action default message:
    Code:
    test1 test2 test3
    test4 test5
    test6
    And use the following custom alert script:
    Code:
    #!/bin/bash
    
    to="$1"
    subject="$2"
    body="$3"
    
    echo $body > /tmp/email_body.txt
    the output in /tmp/email_body.txt is
    Code:
    test6 test5test3
    So basically, no matter what content I put in the action default message box, {ALERT.MESSAGE} is coming out as one line - it's as if there's carriage returns, but the line feeds have been removed.

    I have tried creating a new Action and a new Media Type in 3.4.4, results are the same.

    Any ideas while I still have hair?

    Thanks,
    Ben
Working...