Ad Widget

Collapse

custom items syntax: arguments

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Zabbixazzer
    Junior Member
    • Jul 2006
    • 15

    #1

    custom items syntax: arguments

    Talking about zabbix 1.1 (and so referring to 1.1 syntax), it is possible to put custom intems into zabbix_agentd.conf, for example:

    Code:
    UserParameter=mysql.ping,mysqladmin -uroot ping|grep alive|wc -l
    UserParameter=mysql.uptime,mysqladmin -uroot status|cut -f2 -d":"|cut -f1 -d"T"
    UserParameter=mysql.threads,mysqladmin -uroot status|cut -f3 -d":"|cut -f1 -d"Q"
    UserParameter=mysql.questions,mysqladmin -uroot status|cut -f4 -d":"|cut -f1 -d"S"
    UserParameter=mysql.slowqueries,mysqladmin -uroot status|cut -f5 -d":"|cut -f1 -d"O"
    UserParameter=mysql.qps,mysqladmin -uroot status|cut -f9 -d":"
    UserParameter=mysql.version,mysql -V
    If I want to create a custom item that accepts arguments, how can I do?

    If I write something like this:
    Code:
    UserParameter=mycommand[*],
    then after the comma goes the shell command, in that command how can I refer to the item's argument? Can I write something like this:
    Code:
    UserParameter=mycommand[*],shellcommand [B]$1[/B]
    where $1 refers to mycommand[] argument?

    Or maybe just isn't possible to use arguments?
  • stever
    Member
    • Jun 2006
    • 36

    #2
    You are correct across the board... Here's an example form my config:

    UserParameter=usr.net.in[*],netstat -v -I $1 | grep -v Name | head -1 | awk "{print $ 5}"

    and to use it:

    usr.net.in[bge1]

    Comment

    • Zabbixazzer
      Junior Member
      • Jul 2006
      • 15

      #3
      Thank you!!

      It works!!

      Comment

      • SebD
        Junior Member
        • Jul 2007
        • 24

        #4
        Hello,

        I've got a problem with argument in an item.

        Here is how I write my check :

        In the item configuration : reboot.check[apache]

        In the zabbix_agentd.conf :
        UserParameter=reboot.check[*],/opt/zabbix/rebootSvce $1

        And when I redirect this argument (in the script) to a text file, I can see that the argument is empty!

        When I try my script directly in bash, it's ok!

        Any idea?

        Thanks!

        Sébastien

        Comment

        • SebD
          Junior Member
          • Jul 2007
          • 24

          #5
          Hello,

          It's running, I've modified zabbix_agentd.conf :
          UserParameter=reboot.check[*],/opt/zabbix/rebootSvce "$1"

          $1 must be in ""

          Sébastien

          Comment

          Working...