[ZBX-12117] History export module loaded in zabbix_proxy always return 0 values Created: 2017 Apr 28  Updated: 2024 Apr 10  Resolved: 2017 Nov 19

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Proxy (P)
Affects Version/s: 3.2.4, 3.2.5
Fix Version/s: 3.2.11rc1, 4.0 (plan)

Type: Problem report Priority: Trivial
Reporter: Sergey Ignatov Assignee: Glebs Ivanovskis (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File ZBX-12117.patch    
Team: Team C
Team: Team C
Sprint: Sprint 18, Sprint 19, Sprint 20, Sprint 21
Story Points: 0.5

 Description   

Hi,

The following code of loadable module return always 0 values (0.0000 for float) if module loaded with zabbix_proxy.
Same module with zabbix_server prints non zero history values.

.itemid and .clock has correct values in both cases.

static void     cb_history_float_cb(const ZBX_HISTORY_FLOAT *history, int history_num)
{
        int     i;

        for (i = 0; i < history_num; i++)
        {
    zabbix_log(LOG_LEVEL_INFORMATION, "float %d: %f %d", history[i].itemid, history[i].value, history[i].clock);
        }
}

static void     cb_history_integer_cb(const ZBX_HISTORY_INTEGER *history, int history_num)
{
        int     i;

        for (i = 0; i < history_num; i++)
        {
          zabbix_log(LOG_LEVEL_INFORMATION, "int %d: %u %d", history[i].itemid, history[i].value, history[i].clock);
        }
}

ZBX_HISTORY_WRITE_CBS   zbx_module_history_write_cbs(void)
{
        static ZBX_HISTORY_WRITE_CBS    cb_callbacks =
        {
                cb_history_float_cb,
                cb_history_integer_cb,
    NULL, NULL, NULL
        };

        return cb_callbacks;
}


 Comments   
Comment by Glebs Ivanovskis (Inactive) [ 2017 Apr 29 ]

Proxy does not calculate deltas and does not apply custom multipliers, therefore we should be sending h->value_orig.dbl and h->value_orig.ui64 to modules instead of h->value.dbl and h->value.ui64 in DCmodule_prepare_history().

Comment by Sergey Ignatov [ 2017 Apr 29 ]

with debug logging:

we see proxy is storing non zero data in sqlite, but in callback we haven't non-zero values data

insert into proxy_history (itemid,clock,ns,value) values (69826,1493424232,31842793,'0.000000');
insert into proxy_history (itemid,clock,ns,value) values (69827,1493424232,31846440,'0.063662');
insert into proxy_history (itemid,clock,ns,value) values (69828,1493424232,31849820,'0.000000');
insert into proxy_history (itemid,clock,ns,value) values (69829,1493424232,31853627,'0.186741');
insert into proxy_history (itemid,clock,ns,value) values (69830,1493424232,31856896,'5.886597');
insert into proxy_history (itemid,clock,ns,value) values (69831,1493424232,31859664,'4.918937');
insert into proxy_history (itemid,clock,ns,value) values (69834,1493424232,31862514,'1493424232');
insert into proxy_history (itemid,clock,ns,value) values (69837,1493424232,31879725,'0.000000');
insert into proxy_history (itemid,clock,ns,value) values (69838,1493424232,31882784,'0');
insert into proxy_history (itemid,clock,ns,value) values (69840,1493424232,34188949,'21');
insert into proxy_history (itemid,clock,ns,value) values (69878,1493424232,34457778,'22628401152');
insert into proxy_history (itemid,clock,ns,value) values (69883,1493424232,34713611,'52.383076');
insert into proxy_history (itemid,clock,ns,value) values (69893,1493424232,34986498,'20569522176');
insert into proxy_history (itemid,clock,ns,value) values (69880,1493424232,35266450,'62245097472');
insert into proxy_history (itemid,clock,ns,value) values (69885,1493424232,35535697,'80.015999');
insert into proxy_history (itemid,clock,ns,value) values (69895,1493424232,35811462,'15545716736');
insert into proxy_history (itemid,clock,ns,value) values (69854,1493424232,37113289,'6788976640');
]
  7139:20170429:000356.891 In DCsync_history() history_num:40
  7138:20170429:000356.891 __zbx_zbx_setproctitle() title:'history syncer #3 [synced 0 items in 0.000007 sec, syncing history]'
  7159:20170429:000356.891 __zbx_zbx_setproctitle() title:'self-monitoring [processing data]'
  7136:20170429:000356.891 End of DCmass_proxy_add_history()
  7139:20170429:000356.891 __zbx_zbx_setproctitle() title:'history syncer #4 [synced 0 items in 0.001816 sec, idle 1 sec]'
  7138:20170429:000356.891 In DCsync_history() history_num:40
  7159:20170429:000356.891 In collect_selfmon_stats()
  7136:20170429:000356.891 In DCmass_proxy_update_items()
  7138:20170429:000356.891 __zbx_zbx_setproctitle() title:'history syncer #3 [synced 0 items in 0.000183 sec, idle 1 sec]'
  7159:20170429:000356.891 End of collect_selfmon_stats()
  7136:20170429:000356.891 End of DCmass_proxy_update_items()
  7159:20170429:000356.891 __zbx_zbx_setproctitle() title:'self-monitoring [processed data in 0.000156 sec, idle 1 sec]'
  7136:20170429:000356.892 query [txnlev:1] [commit;]
  7136:20170429:000356.892 syncing float history data with modules...
  7136:20170429:000356.892 ... module "carbon.so"
  7136:20170429:000356.892 carbon float 70499: 0.000000 1493424231
  7136:20170429:000356.892 carbon float 69862: 0.000000 1493424231
  7136:20170429:000356.892 carbon float 70503: 0.000000 1493424231
  7136:20170429:000356.892 carbon float 69866: 0.000000 1493424231
  7136:20170429:000356.892 carbon float 69820: 0.000000 1493424232
  7136:20170429:000356.892 carbon float 69821: 0.000000 1493424232
  7136:20170429:000356.892 carbon float 69822: 0.000000 1493424232
  7136:20170429:000356.892 carbon float 69825: 0.000000 1493424232
  7136:20170429:000356.892 carbon float 69826: 0.000000 1493424232
  7136:20170429:000356.892 carbon float 69827: 0.000000 1493424232
  7136:20170429:000356.892 carbon float 69828: 0.000000 1493424232
  7136:20170429:000356.892 carbon float 69829: 0.000000 1493424232
  7136:20170429:000356.892 carbon float 69830: 0.000000 1493424232
  7136:20170429:000356.892 carbon float 69831: 0.000000 1493424232
  7136:20170429:000356.892 carbon float 69837: 0.000000 1493424232
  7136:20170429:000356.892 carbon float 69883: 0.000000 1493424232
  7136:20170429:000356.892 carbon float 69885: 0.000000 1493424232
  7136:20170429:000356.892 synced 17 float values with modules
  7136:20170429:000356.892 syncing integer history data with modules...
  7136:20170429:000356.892 ... module "carbon.so"
  7136:20170429:000356.892 carbon int 70500: 0 1493424231
  7136:20170429:000356.892 carbon int 69860: 0 1493424231
  7136:20170429:000356.892 carbon int 69861: 0 1493424231
  7136:20170429:000356.892 carbon int 70501: 0 1493424231
  7136:20170429:000356.892 carbon int 70502: 0 1493424231
  7136:20170429:000356.892 carbon int 70504: 0 1493424231
Comment by Glebs Ivanovskis (Inactive) [ 2017 Apr 29 ]

Are you interested in testing a patch?

Comment by Sergey Ignatov [ 2017 Apr 29 ]

yes

Comment by Glebs Ivanovskis (Inactive) [ 2017 Apr 30 ]

Patch for 3.2: ZBX-12117.patch

Comment by Sergey Ignatov [ 2017 Apr 30 ]

yes, this patch fixed the issue. Thank you!

Comment by Glebs Ivanovskis (Inactive) [ 2017 Nov 13 ]

Fixed in pre-3.2.11rc1 r74547.

In 3.4 and trunk there is a different issue: ZBX-13030.

Generated at Fri Apr 19 09:23:20 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.