Ad Widget

Collapse

Quicky: is it possible to use vars in keys?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Justleen
    Junior Member
    • Jan 2009
    • 20

    #1

    Quicky: is it possible to use vars in keys?

    Can I create keys with variables in them?

    something like hostname in the following:
    Code:
    jmx[user:impl-class-name=com.domain.application.jmx.Statistics,name=Statistics,server=$HOST][L1CacheMissCounter]
  • richlv
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Oct 2005
    • 3112

    #2
    short version - yes. a bit longer version - yes, depending on what you want.
    see http://www.zabbix.com/documentation/.../config/macros or http://www.zabbix.com/documentation/...t_level_macros
    Zabbix 3.0 Network Monitoring book

    Comment

    • Justleen
      Junior Member
      • Jan 2009
      • 20

      #3
      Ehm, is there any more documentation om macros for zabbix 1.8?

      Im trying to create one on the host, but I keep getting errors..
      " * Wrong macro : instance001"

      Or should I add something like {$MACRO} -> instance001 on the host config?
      Last edited by Justleen; 16-02-2010, 12:15.

      Comment

      • richlv
        Senior Member
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Oct 2005
        • 3112

        #4
        was the linked one insufficient ? what _exactly_ are you trying to do when you get the error message ?
        Zabbix 3.0 Network Monitoring book

        Comment

        • Justleen
          Junior Member
          • Jan 2009
          • 20

          #5
          Originally posted by richlv
          was the linked one insufficient ? what _exactly_ are you trying to do when you get the error message ?
          Well, yes, since it doenst explain how to use the macros, it only mentions them.

          I did manage to get it working.

          Went to a Host, added a macro there
          {$MACRO} -> instance001

          in my key I use this ${MACRO}, and working as expected..

          Leaves me one question: are the macro names pre-defined, as per the links you posted, or are the names arbitrary, and could I have used something like {$THISISAMACROFORINSTANCEONE} too?

          Comment

          • richlv
            Senior Member
            Zabbix Certified Trainer
            Zabbix Certified SpecialistZabbix Certified Professional
            • Oct 2005
            • 3112

            #6
            hmm, docs might indeed be confusing at some places. there are two different tings.

            1. predefined, hardcoded macros. these are listed in the first table, and their syntax is {MACRO};

            2. user definable macros. there currently are no predefined macros, and their names can be freely set by the user.
            these macros can be configured either on a global, template or host level, with downstream definitions overriding upstream ones. these have syntax of {$MACRO} - note the placement of the dollar sign !

            so ${MACRO} highly likely use the built-in macro and ignore your custom one.
            Zabbix 3.0 Network Monitoring book

            Comment

            • Justleen
              Junior Member
              • Jan 2009
              • 20

              #7
              Just tested some arbitrary names, and yes, that works.

              Seems 'm sorted again! thnx for the quick response!

              Comment

              Working...