Ad Widget

Collapse

1.6.1 macros in keys & triggers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • teferi
    Member
    • Jul 2008
    • 93

    #1

    1.6.1 macros in keys & triggers

    The functionality, that implements usage of macros in item keys is quite handy. But that produced another problem - I'm unable to create a trigger with such an item.

    here's the expression:
    {Template_color:grpsum[{HOSTNAME},"icmpping","last","0"].last(0)}<2

    here's what frontend complains:

    * pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: operator does not exist: character varying = integer ������ 1:...osts where (hostid/100000000000000) in (0) and host in (0) ^ ���������: No operator matches the given name and argument type(s). You might need to add explicit type casts.[/spool/frontend/php/include/db.inc.php:392]
    * Error in query [select distinct * from hosts where (hostid/100000000000000) in (0) and host in (0)] [ERROR: operator does not exist: character varying = integer ������ 1:...osts where (hostid/100000000000000) in (0) and host in (0) ^ ���������: No operator matches the given name and argument type(s). You might need to add explicit type casts.]
    * pg_fetch_assoc() expects parameter 1 to be resource, boolean given[/spool/frontend/php/include/db.inc.php:522]
    * Unknown macro [{HOSTNAME}]
  • teferi
    Member
    • Jul 2008
    • 93

    #2
    Damn.

    Seems like I just forgot to switch from 1.6 to 1.6.1 everything works fine. sorry.

    Please mark https://support.zabbix.com/browse/ZBX-594 as closed

    Comment

    • teferi
      Member
      • Jul 2008
      • 93

      #3
      Still I've got a problem with triggers. If i place such a trigger in a template:
      {Template_color:grpsum[{HOSTNAME},"icmpping","last","0"].last(0)}<2

      I get {color000:grpsum[{HOSTNAME},"icmpping","last","0"]. last( 0 ) }<2 as a resulting expression in a host linked to that template. which is not really what is expected.

      Comment

      • Alexei
        Founder, CEO
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2004
        • 5654

        #4
        Originally posted by teferi
        I get {color000:grpsum[{HOSTNAME},"icmpping","last","0"]. last( 0 ) }<2 as a resulting expression in a host linked to that template. which is not really what is expected.
        That's absolutely correct. What did you expect to see?
        Alexei Vladishev
        Creator of Zabbix, Product manager
        New York | Tokyo | Riga
        My Twitter

        Comment

        • teferi
          Member
          • Jul 2008
          • 93

          #5
          Originally posted by Alexei
          That's absolutely correct. What did you expect to see?
          I expected to see:

          {color000:grpsum["color000","icmpping","last","0"]. last( 0 ) }<2

          Am I wrong?

          Comment

          • teferi
            Member
            • Jul 2008
            • 93

            #6
            And overall, either I do not understand how these templates intend to work, or they really do not work(at least for group items)

            I've created a temlpate
            with an item, that has this key:
            grpsum["{HOSTNAME}","icmpping","last","0"]
            it has zabbix aggregate, no mistake here.

            after I link a host to that template I expect the item to become

            grpsum["myhostname","icmpping","last","0"], but the macro doesn't seem to be substituted at any time. I do understand that the key should contain macro, but it's not substituted in any page(the way it happens with macros in trigger's names)

            And the resulting item grpsum["{HOSTNAME}","icmpping","last","0"] becomes unsuported with reason "No values".


            Am I doing smth wrong?

            $zabbix_server -V
            ZABBIX Server (daemon) v1.6.1 (04 November 2008)

            Frontend is also 1.6.1

            Comment

            • teferi
              Member
              • Jul 2008
              • 93

              #7
              Well I guess one part of the problem is that macros are not substituted in aggregated items keys.

              I added one line to solve the problem.

              Code:
              +++ src/libs/zbxdbhigh/db.c     2008-11-11 13:01:27.000000000 +0300
              @@ -1853,6 +1853,7 @@
                              case ITEM_TYPE_ZABBIX_ACTIVE:
                              case ITEM_TYPE_SIMPLE:
                              case ITEM_TYPE_EXTERNAL:
              +               case ITEM_TYPE_AGGREGATE:
                                      key = zbx_dsprintf(key, "%s", item->key_orig);
                                      substitute_simple_macros(NULL, NULL, item, &key, MACRO_TYPE_ITEM_KEY);
                                      item->key       = key;
              Is there anything I might have missed?

              Comment

              Working...