Ad Widget

Collapse

how to create a script media type

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RandySpinaGE
    Member
    • Jun 2006
    • 57

    #1

    how to create a script media type

    because action -> "remote command" passes NO arguments NOR Repeats
    I set upon creating an action using "script media type"
    You will GET macros AND zabbiix will repeat scheduling it while in alarm.

    1) Create Media Type
    decription: ex: External_command
    type: script
    Script name: script.sh (only) (leave out the directory which is set in zabbix_server.conf as AlertScriptsPath= )

    2) Create a USER maybe called script_runner
    list all users and select this new user's media in the actions column
    configure it to be what you just created my ex: = "External_Command"

    3) Now select this NEW MEDIA
    type: "External_Command"
    Send to: /full/pathname/script.sh

    4) Create trigger

    5) Action
    Action Type: Send message (NOT remote command)
    send message to: script_runner

    6) Your done

    Have fun with Macros in subject and messagebody that get sent to your script as arguments $2 $3... its great

    My script calls zabbix_get on the Actions's {IPADDRESS} and {TRIGGER.KEY} and | mail -s "$2" [email protected]

    This sends UPDATED VALUE of item to on-call person(s) email in repeat interval ONLY while in alarm

    Thats what my Application guy Wanted

    I hope this helps someone - a few fields got me confused and it took a full workday to get it.

    zabbix 1.1.3 (1.1.x)

    Thank You.
    Last edited by RandySpinaGE; 10-04-2007, 03:32.
  • teleneko
    Junior Member
    • Oct 2004
    • 20

    #2
    Thank you for the post I find it very interesting, Does anyone know how to do the same (increase frequency or even activate queries when a trigger is on) but based in snmp queries?

    R-ds

    Comment

    • erozen
      Junior Member
      Zabbix Certified Specialist
      • Apr 2007
      • 18

      #3
      snmp

      Originally posted by teleneko
      Thank you for the post I find it very interesting, Does anyone know how to do the same (increase frequency or even activate queries when a trigger is on) but based in snmp queries?

      R-ds

      On linux, use the snmptrap command - part of the net-snmp suite.

      Simply have you script call 'snmptrap <options>.
      There will be a similar package for windows, I'm sure - GIYF.

      Comment

      • rileo8
        Junior Member
        • Feb 2007
        • 27

        #4
        Hi,
        thanks for the guide....very helpful!
        I have only a problem : when the trigger become true the action is fired and i see in actions that zabbix response is "sent" but bothing happens...

        I create a test script that write it seems not to work (if called from zabbix)
        I tested it running it from command line as zabbix user and it work correctly..

        Any help?
        thanks,Riccardo

        Comment

        • deathemperor
          Junior Member
          • Aug 2009
          • 3

          #5
          Thanks the OP for posting this. This is a very helpful cookbook. I will now be using this to send SMS alert for our zabbix.

          our sms gateway is called through a service, that's why it can't be configured as zabbix internal.

          Comment

          • dagun
            Member
            • Sep 2009
            • 71

            #6
            I am failed.

            But ,i am failed.
            Who can give me some necessary screenshots???

            Comment

            Working...