[ZBX-3019] In DM mode enabled template graphs not copied for discovered host Created: 2010 Sep 19  Updated: 2017 May 30  Resolved: 2010 Sep 30

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F), Server (S)
Affects Version/s: 1.9.0 (alpha)
Fix Version/s: 1.8.4

Type: Incident report Priority: Critical
Reporter: Alexander Ignatyev Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux 2.6.34-gentoo-r1, PostgreSQL 8.4.4, whatever



 Description   

When Distributed Monitoring enabled there are no graphs for autodiscovered hosts. Debug mode helps to find what a problem is. It's all about function DBcopy_graph_to_host in svn/trunk/src/libs/zbxdbhigh/host.c. Function DBget_graphitems takes argument sql, prepared few lines ago like this:
zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset, 256,
"select 0,dst.itemid,dst.key_,gi.drawtype,gi.sortorder,"
and so on.

In fact sql query was truncated like this:
select 0,dst.itemid,dst.key_,gi.drawtype,gi.sortorder,gi.color,gi.yaxisside,gi.calc_fnc,gi.type,gi.periods_cnt from graphs_items gi,items i,items dst where gi.itemid=i.itemid and i.key_=dst.key_ and gi.graphid=100100000000391 and dst.hostid=10010000001035

I can't see any "order by dst.key_" which is a part of query and also hostid is truncated: 10010000001035 instead of 100100000010350. I guess 256 is enough for non DM installations but makes a trouble when ids expanded with DM node id.

Following modification worked for me [svn/trunk/src/libs/zbxdbhigh]:
Index: host.c
===================================================================
— host.c (revision 14504)
+++ host.c (working copy)
@@ -2732,7 +2732,7 @@
name_esc = DBdyn_escape_string(name);

sql_offset = 0;

  • zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset, 256,
    + zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset, 512,
    "select 0,dst.itemid,dst.key_,gi.drawtype,gi.sortorder,"
    "gi.color,gi.yaxisside,gi.calc_fnc,"
    "gi.type,gi.periods_cnt"


 Comments   
Comment by Aleksandrs Saveljevs [ 2010 Sep 20 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/zbx-3019-discovery-graph.

Comment by Aleksandrs Saveljevs [ 2010 Sep 30 ]

Merged into pre-1.8.4 in r14638.

Generated at Thu Apr 25 19:44:30 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.