No announcement yet.

Scripts for notification - some details elude me

  • Filter
  • Time
  • Show
Clear All
new posts

    Scripts for notification - some details elude me

    Ok, I have a script that, when fed the proper command-line switches, will send a specific alert type (Growl, if it matters). Tried and tested from the command line, so that part is dealt with.

    The issue now is the process of making Zabbix use it and feed it those command line switches.

    As far as I can tell, step one is to do Administration \ Media Types and add the script there. Now - is this also where you specify those command line switches? Ie, " -H $1 -t $2" or some such?

    From there, you go to Administration \ Users and make sure the users have that media type active. You can also enter an "send to" field... where does that come into play? Can you access that via a macro? It would be pretty ideal to get that to get fed to the command line (I could set up the user IP/DNS name there which would be all the per-user config I'd need.)

    After that, you probably hit Configuration \ Actions and create an action. For this application I'd probably want some of those command line switches in subject and then the message sent as one big command line switch, or something along those lines - but I have no clue how these macro entries communicate with the script, if at all. Can it be done or are this macros just Zabbix internal and together they cook up a big blob of text that gets sent somehow?

    Like I said, I don't really get the interactions here, the email notification media type just uses some magic so subject and message gets sent behind the scenes but how are you supposed to do this to talk to a script-based media event? Or can you?

    Hope this help:

    Place your script in /home/zabbix/bin
    (check AlertScriptsPath in your zabbix_server.conf file) and chmod 755 on script.

    $1 is the “Send to” field from user media.
    $2 is “Subject” field (in Action Operation)
    $3 is “Message” field … lines concatenated (big blob of text)
    Macros are “processed” to values before passed to the script.



      Thanks! I appreciate that, that info should be enough to get it going (hopefully).

      Just to clarify - once you have the AlertPath settings done (already did that) you enter the script in the Media Type like so: $1 $2 $3



        Parameters are "build in" as I understand it


          Ahh... ok then the script needs some work, it expects specific switches on stdin. I was hoping there was a way to specify part static info and part macros on the stdin (ie, -H $1 -s $2 -m $3, something like that).

          Guess I'll go back to the drawing board.


            Good lock :-)


              Fixed it:

              Thanks again for pointing me in the right direction about the command line variables!