Ad Widget

Collapse

Fuzzytime() function seems not work

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MarekHanus
    Junior Member
    • Feb 2018
    • 9

    #1

    Fuzzytime() function seems not work

    Hello all,

    I have decided to use function fuzzytime in a trigger but it does not work or I do not understand fuzzytime functionality.

    "Supported trigger function" section in Zabbix Documentation 3.4 says following about fuzzytime:

    Checking how much an item timestamp value differs from the Zabbix server time. 0 - if difference between item timestamp value and Zabbix server timestamp is over T seconds; 1 - otherwise.

    My trigger's expression is {Template TVM Machine:me.machine.state.last()}=1 and {Template TVM Machine:me.machine.state.fuzzytime(30)}=0. If I understand correctly, the function should return 0 if difference between times is over 30 seconds.


    I sent message for zabbix trapper and message was successfully processed.

    29152:20181026:070526.186 trapper got '{"request":"sender data","data":[{"host":"001","key":"me.machine.state","clock":154 0530321,"value":"1","ns":393000000}]}' (note: server time in UTC 5:05:26, item timestamp in UTC 5:05:21, difference 5 seconds)

    There is difference only 5 seconds between server time and value timestamp, but my trigger fired.

    Let me show you extract from zabbix log:

    29131:20181026:070526.634 In evaluate_function() function:'001:me.machine.state.fuzzytime(30)'
    29131:20181026:070526.634 In evaluate_FUZZYTIME()
    29131:20181026:070526.634 In get_function_parameter_int() parameters:'30' Nparam:1
    29131:20181026:070526.634 In substitute_simple_macros() data:'30'
    29131:20181026:070526.634 get_function_parameter_int() type:sec value:30
    29131:20181026:070526.634 End of get_function_parameter_int():SUCCEED
    29131:20181026:070526.634 In zbx_vc_get_value() itemid:52536 value_type:3 timestamp:1540530321.999999999
    29131:20181026:070526.634 End of zbx_vc_get_value():SUCCEED cache_used:1
    29131:20181026:070526.634 End of evaluate_FUZZYTIME():SUCCEED
    29131:20181026:070526.634 End of evaluate_function():SUCCEED value:'0'


    If I understand correctly based on last row the fuzztime function returned 0, but it should be 1 because there is no difference over 30 seconds.

    29131:20181026:070526.635 In evaluate_function() function:'001:me.machine.state.last()'
    29131:20181026:070526.635 In evaluate_LAST()
    29131:20181026:070526.635 In get_function_parameter_int() parameters:'' Nparam:1
    29131:20181026:070526.635 In substitute_simple_macros() data:EMPTY
    29131:20181026:070526.635 get_function_parameter_int() type:num value:1
    29131:20181026:070526.635 End of get_function_parameter_int():SUCCEED
    29131:20181026:070526.635 In zbx_vc_get_value_range() itemid:52536 value_type:3 seconds:0 count:1 timestamp:1540530321
    29131:20181026:070526.635 End of zbx_vc_get_value_range():SUCCEED count:1 cached:1
    29131:20181026:070526.635 End of evaluate_LAST():SUCCEED
    29131:20181026:070526.635 End of evaluate_function():SUCCEED value:'1'


    Function last() is correct.


    I tried to send message with 2 minutes time difference from server and result of fuzzytime function is the same - 0.


    Is there a bug or I do not understand fuzzytime functionality correctly?

    Thank you very much for your help.

    Marek

  • MarekHanus
    Junior Member
    • Feb 2018
    • 9

    #2
    Oh, I got it. It does not compare item timestamp of an item, but timestamp has to be send as value of an item. I am a little disappointed with this function.

    Comment

    Working...