Ad Widget

Collapse

Formatting output of remote command

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • guertin
    Junior Member
    • Mar 2010
    • 9

    #1

    Formatting output of remote command

    I'm using a remote command calling ssmtp to generate email notifications of events. (The built-in Zabbix email notification feature is useless for me since it does not do SMTP authentication, and our SMTP server requires authentication).

    I'm trying to construct the body of the outgoing email using macros, e.g.

    {DATE} {TIME} {TRIGGER.NAME}:{STATUS} {IPADDRESS} {PROFILE.LOCATION}

    However, this puts all the data on one line of the email. I would like to insert line breaks. Is this possible? I've tried inserting \n, but those just get printed literally. Is there another way to insert line breaks?
  • alixen
    Senior Member
    • Apr 2006
    • 474

    #2
    Hi,

    I also use msmtp to send authentified mails but instead of remote command, I use a media of type Script that uses msmtp.
    It works fine and I have no problem to send multiline mails.

    Regards
    Alixen
    http://www.alixen.fr/zabbix.html

    Comment

    • guertin
      Junior Member
      • Mar 2010
      • 9

      #3
      Originally posted by alixen
      I also use msmtp to send authentified mails but instead of remote command, I use a media of type Script that uses msmtp.
      It works fine and I have no problem to send multiline mails.
      Thanks. But how does one use a script without calling it with a remote command? That's what I was trying to do, but the only way I could find to call the script was to set it in Configuration > Actions, and under Operations select "Remote command" from the pull-down.

      Is there a better way to do this? I've been trying to learn how to do this by reading the online documentation and searching the forums, but the more I read the more confused I get.

      Dave

      Comment

      • alixen
        Senior Member
        • Apr 2006
        • 474

        #4
        Hi,

        Originally posted by guertin
        Thanks. But how does one use a script without calling it with a remote command? That's what I was trying to do, but the only way I could find to call the script was to set it in Configuration > Actions, and under Operations select "Remote command" from the pull-down.
        Dave
        Short procedure:
        1) Administration/Media type:
        Add a new media of type Script with Script name=your external script
        (your script must be in /etc/zabbix/alert.d unless you changed AlertScriptsPath variable in zabbix_server.conf)

        2) Administration/Users/Create user
        Create a new user and define Media with new media created

        3) Configuration/Action/Create or Edit action
        Define action operation as
        Operation type : Send Message
        Send message to : user created above
        Choose 'Default message' or create your own message format

        That's all.

        Hope this helps
        Alixen
        http://www.alixen.fr/zabbix.html

        Comment

        Working...