Ad Widget

Collapse

Media Types --script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dagun
    Member
    • Sep 2009
    • 71

    #1

    Media Types --script

    I appreriate anyone to help me.
    Today I wonder use script to alert something.But I am failed.
    Who can help me ?

    1.media types(description:TEST, Script nmae:test)
    2.users--media--new media(/usr/local/zabbix/bin/test)
    #!/bin/sh
    echo "$1" >> sun.log
    echo "$1" >> sun.log
    echo "$1" >> sun.log
    echo "it is atest!" >> sun.log
    3.action
    But ,the sun.log is empty, Audit action is display "sent".
    the sun.log is empty, I can't get result.
  • Calimero
    Senior Member
    • Nov 2006
    • 481

    #2
    You should give a full path to your logfile as you don't know what directory you'll be in.

    Code:
    #!/bin/bash
    date >> /tmp/sun.log
    echo $1 >> /tmp/sun.log
    echo $2 >> /tmp/sun.log
    echo $3 >> /tmp/sun.log
    Remove sun.log manually to make sure it will be created by your script and you don't mess permissions (ie: sun.log created by root, zabbix won't be able to write to it).

    Comment

    • dagun
      Member
      • Sep 2009
      • 71

      #3
      Hi Camilero

      I know it.Thank you.T will try it.

      Comment

      • dagun
        Member
        • Sep 2009
        • 71

        #4
        I am failed.

        I will give you my configuration.
        This my screenshot.
        script:
        #!/bin/sh
        date >> /tmp/sun.log
        echo "$1" >> /tmp/sun.log
        echo "$2" >> /tmp/sun.log
        echo "$3" >> /tmp/sun.log
        ----------------------------------

        chown zabbix.zabbix sun.log
        chmod 777 sun.log

        any errors?????
        Attached Files

        Comment

        • dagun
          Member
          • Sep 2009
          • 71

          #5
          Hi everyone.

          I have resolve it.

          Comment

          • jaxxm
            Junior Member
            • Mar 2009
            • 14

            #6
            resolved?

            Hi Dagun

            Could you please tell us how you resolved it so other could learn from i?

            thanks

            Comment

            Working...