Ad Widget

Collapse

custom script parameters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • verus
    Member
    • Feb 2009
    • 67

    #1

    custom script parameters

    Hi,

    I use a custom script (for sms_client) and years ago somebody here gave me the values i can use in the sms_client from zabbix (subject and message).
    But because i switched from employer, i lost the settings and i don't find them here.
    Does somebody knows how to send the zabbix parameters into the script ? (it was something with "#"or "%" signs if i remember well...).
    And i don't find it in the manual, just found:

    Script
    Custom script. Zabbix passes three command line parameters to the script: Recipient, Subject and Message.

    but not the command line parameters themself.

    thanks,
    Verus.
    Last edited by verus; 31-03-2011, 16:13.
  • Rudd
    Member
    • Mar 2011
    • 69

    #2
    Are you referring to "Run remote commands" in the "Action operations"?

    I use the following for my custom sms script:

    zabbix.my.net.au:/usr/local/zabbix/bin/smsalert.pl --phone=61412345678 --message="{TRIGGER.NAME}: {ITEM.LASTVALUE}"

    Comment

    • verus
      Member
      • Feb 2009
      • 67

      #3
      hi,

      no, in the actions pane i send a message to a media type i have "sms.script" which is a script (of course) in the directory /etc/zabbix/alert.d
      The script in that directory is "sms.script" with the following:
      sms_client -l 0 user1 "<values>"

      Now, there are parameters that i need for those values and these are the parameters for the message subject and body and it was something with "%" but i don't have the details and i really would like that info again.

      I believe Alexei gave me those parameters before but it is years ago.
      thanks, Verus.

      Comment

      • MrKen
        Senior Member
        • Oct 2008
        • 652

        #4
        Depends on what langage you write you script (or binary).

        If your script is a shell script, you'll get those values as $1, $2, $3...
        If your "script" is a C binary, you'll pull those values from argc/argv...
        If your script is written in perl, you get get args with $ARGV[0], $ARGV[1]...

        In php I use:
        #!/usr/bin/php
        <?php

        $ToNumber=$argv[1];
        $Subject=$argv[2];
        $Message=$argv[3];

        MrKen
        Disclaimer: All of the above is pure speculation.

        Comment

        • verus
          Member
          • Feb 2009
          • 67

          #5
          thanks,
          that's what i needed.
          Where do you find that info ? or am i blind that i didn't found it in the manual ?
          many thanks, verus.

          Comment

          Working...