Ad Widget

Collapse

UserParameters and Flexible Items

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hvill
    Junior Member
    • Apr 2006
    • 6

    #1

    UserParameters and Flexible Items

    I need a basic how to or just a complete example for Flexible Items and UserParameters.

    An example could be: return the ip address of the host setting in the GUI via a UserParameter simply invoking echo and returning the parameter.

    What do I write in the UserParameter in the agent conf-file before the comma (x[*] maybe) ?
    And what do I write after the comma, that expands to the ipaddr value ?

    And most important: What do I write in the KEY field in the GUI?
    Which values can I use?

    Yes I know, I could just inspect the c-code, but somebody must have been here before (if no other at least the developers) and all help is appreciated.

    Thanks

    Harald
  • just2blue4u
    Senior Member
    • Apr 2006
    • 347

    #2
    That's quite easy:

    Which zabbix version do you use?

    for v1.1beta8:
    Originally posted by /etc/zabbix/zabbix/agentd.conf
    ####### USER-DEFINED MONITORED PARAMETERS #######
    # Format: UserParameter=<key>,<shell command>
    # Note that shell command must not return empty string or EOL only
    #UserParameter=system.test,who|wc -l
    In your case:
    UserParameter=hostname2ip[$1],nslookup $1 | grep "Address" | cut -c10-

    see also Zabbix Documentation

    As far as i know, zabbix 1.0.2 doesn't support dynamit UserParameters?!
    Big ZABBIX is watching you!
    (... and my 48 hosts, 4513 items, 1280 triggers via zabbix v1.6 on CentOS 5.0)

    Comment

    • hvill
      Junior Member
      • Apr 2006
      • 6

      #3
      And the GUI ???

      Thank you very much for you reply. I am using 1.1beta8 on fedora.

      You replied half of my question, what I still do not know is:

      And most important: What do I write in the KEY field in the GUI?
      Which values can I use?


      How do I e.g. reference the ip address of the host in the item definition in the GUI ?

      Thanks

      Harald

      Comment

      • just2blue4u
        Senior Member
        • Apr 2006
        • 347

        #4
        in GUI you write hostname2ip[testpc.domain] as item key.
        you may insert almost every hostname that you want to monitor.

        i didn't check the situation when nslookup isn't able to resolve that hostname. try out!

        in general, the hostname inserted in [] in the GUI becomes $1, and is then inserted in the script.
        Big ZABBIX is watching you!
        (... and my 48 hosts, 4513 items, 1280 triggers via zabbix v1.6 on CentOS 5.0)

        Comment

        • hvill
          Junior Member
          • Apr 2006
          • 6

          #5
          and build-in variables ?

          OK - thanks again.

          I imagined, that I could reference variables such as the ip address of the host in a generic way, but this is maybe not possible.
          I thought, that I in this way could use the same item definition for several hosts without specifying their ip address more than once (in the host definition).

          But thanks again - I now have a solid basis for my further work.

          And thanks to the zabbix developers for a nice and valuable tool.

          / Harald

          Comment

          • just2blue4u
            Senior Member
            • Apr 2006
            • 347

            #6
            you needn't give the name to resolv dynamical...

            of course you may also write

            UserParameter=ipof[host1.domain],nslookup host1.domain | grep "Address" | cut -c10-
            UserParameter=ipof[host2.domain],nslookup host2.domain | grep "Address" | cut -c10-
            Big ZABBIX is watching you!
            (... and my 48 hosts, 4513 items, 1280 triggers via zabbix v1.6 on CentOS 5.0)

            Comment

            Working...