Ad Widget

Collapse

UserParameter Blues...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • James Wells
    Senior Member
    • Jun 2005
    • 664

    #1

    UserParameter Blues...

    Greetings,

    Many of us have been there. You want to add a new UserParameter item, but to do so, means you have to push out the new script to each client, then you have to stop and restart Zabbix Agentd, then you have to go through the UI and enable the items. It got so bad for me recently, that I sat down and started writing an Agent side plugin system. But what if there is an easier way?

    This weekend, I was in the middle of working on the plugin system and I had a thought. WHY??? Why not just use a single UserParameter entry that calls a simple wrapper? What I came up with is the following;
    zabbix_agentd.conf
    Code:
    UserParameter=zabbix.plugin[*],/opt/zabbix/lib/zabbix.plugin $1
    Zabbix Items
    Code:
    zabbix.plugin['uptime']
    zabbix.plugin['ping zabbix.zabbixtest.net']
    zabbix.plugin['load cpu0']
    zabbix.plugin['load cpu1']
    /opt/zabbix/lib/zabbix.plugin
    Code:
    #!/bin/bash
    #
    # Simple Wrapper Script
    case ${1} in
        "uptime")
              /usr/bin/uptime
              ;;
        "ping")
              /bin/ping -c 1 ${2} | grep "packets transmitted"
              ;;
        ...
       *)
             /bin/echo "0"
             ;;
    Obviously there needs to be a bit more meat in the zabbix.plugin, but it is working right now for single argument commands. By doing this, I still need to push out the code to all of the clients, but I no longer need to restart the Zabbix Agent(d) when I add new checks, nor do I need to push out the new code before I add the item checks to the server.. I can pre-load the new item checks without fear of breaking anything when the Zabbix Agent(d) returns an incorrect value type, instead a zero gets returned if the wrapper doesn't know how to handle the new item yet.
    Unofficial Zabbix Developer
  • LEM
    Senior Member
    Zabbix Certified Specialist
    • Sep 2004
    • 112

    #2
    You're idea is interesting (especially for 1.0 release).

    But why don't you consider running system.run (with 1.1.x) ?

    Cheers,
    --
    LEM

    Comment

    • James Wells
      Senior Member
      • Jun 2005
      • 664

      #3
      LOL!!! I actually use 1.3 But even 1.1 and dev versions of 1.4 require Zabbix Agent(d) restart when you add new UserParameter entries and the Agent(d) plugin system is still in development.
      Unofficial Zabbix Developer

      Comment

      • LEM
        Senior Member
        Zabbix Certified Specialist
        • Sep 2004
        • 112

        #4
        Hum... I was talking about the 'system.run" zabbix agentd active feature : you don't need to restart your agentd when you had a new item using system.run on the zabbix server.
        --
        LEM

        Comment

        • James Wells
          Senior Member
          • Jun 2005
          • 664

          #5
          Nice. I guess I mis-read it before, I was under the impression it was just for executing remote commands. Didn't notice that it allows for return data. Thanx.
          Unofficial Zabbix Developer

          Comment

          • peter_field
            Member
            • Jun 2006
            • 71

            #6
            Problems with system.run

            You can have problems using symbols with triggers with system.run items that can be a bit restrictive.

            See:

            Comment

            Working...