Ad Widget

Collapse

user parameters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pierreC
    Junior Member
    • Jun 2017
    • 13

    #1

    user parameters

    Hi,
    I'm actually using UserParameter on one of my monitored agent.
    I've describe it like : UserParameter=portCheck,/opt/zabbix/scripts/portCheck.pl

    Problem I want to execute my script with some attribut (the socket), formated like that :
    /opt/zabbix/scripts/portCheck.pl @IP PORT

    What should be the key of my item to do that ?

    I know I can do it by system.run but I would like to use UserParameters.
  • pierreC
    Junior Member
    • Jun 2017
    • 13

    #2
    Update :

    I've found how to add argument to my user parameter here is my configuration

    agent.conf : UserParameter=portCheck[*],/opt/zabbix/scripts/portCheck.pl

    item key : portCheck[{#IP} {#PORT}]

    I get the 2 arguments in my script and print it, there is not arguments.
    I've test it by giving it arguments in command line in local, it works so the problem isn't the code.
    {#IP} and {#PORT} are not the problem, I use them in the tittle of the item and they show.
    The problem should be in my item key or the user parameters of my agent.

    Idea ??

    Comment

    • volter
      Member
      Zabbix Certified Specialist
      • Dec 2011
      • 85

      #3
      Originally posted by pierreC
      Update :

      I've found how to add argument to my user parameter here is my configuration

      agent.conf : UserParameter=portCheck[*],/opt/zabbix/scripts/portCheck.pl

      item key : portCheck[{#IP} {#PORT}]

      I get the 2 arguments in my script and print it, there is not arguments.
      I've test it by giving it arguments in command line in local, it works so the problem isn't the code.
      {#IP} and {#PORT} are not the problem, I use them in the tittle of the item and they show.
      The problem should be in my item key or the user parameters of my agent.

      Idea ??
      You are assuming that Zabbix is automatically attaching the argument vector, which it doesn't. You want something like:

      UserParameter=portCheck[*],/opt/zabbix/scripts/portCheck.pl "$1" "$2"

      Comment

      • pierreC
        Junior Member
        • Jun 2017
        • 13

        #4
        Thank that's working

        Comment

        Working...