Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-8672

Allow to use time suffixes after user macro in trigger functions

    XMLWordPrintable

    Details

      Description

      I have a usermacro {$CPU_UTILIZATION_TIME} = 4

      I have also trigger:
      Name: "CPU Utilization > 10 % for {$CPU_UTILIZATION_TIME} hours"

      If I try to save trigger with expression like this:

      {it0:test.item.avg({$CPU_UTILIZATION_TIME}h)}>10
      

      frontend returns this error:

      Cannot implode expression "{it0:test.item.avg({$CPU_UTILIZATION_TIME}h)}>10". Incorrect trigger function "max({$CPU_UTILIZATION_TIME}h)" provided in expression. Invalid first parameter.  ...
      

      So it's not allowed by frontend.

      But when I hack the expression in database directly - it appeared to be actually working on server side:

       17399:20140827:125700.685 Starting Zabbix Server. Zabbix 2.2.4rc3 (revision 46631).
      ...
       17405:20140827:125716.084 trapper got '{"request":"sender data","data":[{"host":"it0","key":"test.item","value":"3000"}]}'
      ...
       17414:20140827:125720.710 In DCmass_add_history()
       17414:20140827:125720.710 query [txnlev:1] [insert into history_uint (itemid,clock,ns,value) values (23745,1409133436,85023061,3000);]
       17414:20140827:125720.711 In zbx_vc_add_value() itemid:23745 value_type:3 timestamp:1409133436.85023061
       17414:20140827:125720.711 End of zbx_vc_add_value():FAIL
       17414:20140827:125720.711 End of DCmass_add_history()
       17414:20140827:125720.711 In DCmass_update_triggers()
       17414:20140827:125720.711 In evaluate_expressions() tr_num:1
       17414:20140827:125720.711 In substitute_simple_macros() data:'{13324}>10'
       17414:20140827:125720.711 End substitute_simple_macros() data:'{13324}>10'
       17414:20140827:125720.711 In substitute_functions()
       17414:20140827:125720.711 In zbx_extract_functionids() tr_num:1
       17414:20140827:125720.711 End of zbx_extract_functionids() functionids_num:1
       17414:20140827:125720.711 In zbx_populate_function_items() functionids_num:1
       17414:20140827:125720.711 End of zbx_populate_function_items() ifuncs_num:1
       17414:20140827:125720.711 In zbx_evaluate_item_functions() ifuncs_num:1
       17414:20140827:125720.711 In evaluate_function() function:'it0:test.item.avg({$CPU_UTILIZATION_TIME}h)'
       17414:20140827:125720.711 In evaluate_AVG()
       17414:20140827:125720.712 In __get_function_parameter_uint31() parameters:'{$CPU_UTILIZATION_TIME}h' Nparam:1
       17414:20140827:125720.712 In substitute_simple_macros() data:'{$CPU_UTILIZATION_TIME}h'
       17414:20140827:125720.712 In DCget_user_macro() macro:'{$CPU_UTILIZATION_TIME}'
       17414:20140827:125720.712 In DCget_host_macro() macro:'{$CPU_UTILIZATION_TIME}'
       17414:20140827:125720.712 End of DCget_host_macro():SUCCEED
       17414:20140827:125720.712 End of DCget_user_macro()
       17414:20140827:125720.712 End substitute_simple_macros() data:'1h'
       17414:20140827:125720.712 __get_function_parameter_uint31() flag:0 value:3600
       17414:20140827:125720.712 End of __get_function_parameter_uint31():SUCCEED
       17414:20140827:125720.712 In zbx_vc_get_value_range() itemid:23745 value_type:3 seconds:3600 count:0 timestamp:1409133436
       17414:20140827:125720.712 query [txnlev:1] [select clock,ns,value from history_uint where itemid=23745 and clock>1409129836 and clock<=1409133440]
       17414:20140827:125720.713 End of zbx_vc_get_value_range():SUCCEED count:6 cached:1
       17414:20140827:125720.713 End of evaluate_AVG():SUCCEED
       17414:20140827:125720.713 End of evaluate_function():SUCCEED value:'1121.5'
       17414:20140827:125720.713 End of zbx_evaluate_item_functions()
       17414:20140827:125720.713 In zbx_substitute_functions_results() ifuncs_num:1 tr_num:1
       17414:20140827:125720.713 zbx_substitute_functions_results() expression[0]:'{13324}>10' => '1121.5>10'
       17414:20140827:125720.713 End of zbx_substitute_functions_results()
       17414:20140827:125720.713 End of substitute_functions()
       17414:20140827:125720.713 In evaluate() expression:'1121.5>10'
       17414:20140827:125720.713 End of evaluate() value:1.000000
       17414:20140827:125720.713 End of evaluate_expressions()
       17414:20140827:125720.713 In process_triggers() values_num:1
       17414:20140827:125720.713 In process_trigger() triggerid:13703 value:1(0) new_value:1
       17414:20140827:125720.713 End of process_trigger():FAIL
       17414:20140827:125720.713 End of process_triggers()
      

      Could you please allow to save such expressions in frontend?

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              zalex_ua Oleksii Zagorskyi
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: