[ZBX-9919] Change graph type from pie (and graph sum) to normal and Y scale calculation fails Created: 2015 Sep 30  Updated: 2017 May 30  Resolved: 2015 Oct 14

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 2.4.6
Fix Version/s: 2.2.11rc1, 2.4.7rc1, 3.0.0alpha3

Type: Incident report Priority: Critical
Reporter: Linwood Ferguson Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: graphs, piegraphs
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 15.04, Postgresql 9.4 (but I think any)


Attachments: PNG File reproduced.png    

 Description   

I found that some graphs were not correctly calculating the Y min/max so as to permit all items to be viewed. Upon further testing, a reproducible case is caused by the UI not resetting the "graphs_items" table field "type" from 2 to 0.

To reproduce the problem:

1) Pick a host which has something like total disk space and used disk space, where the used is substantially less than the total.

2) Create a graph for the host:
a. Type pie
b. Total space as “Graph sum” <<< This sets up the failure
c. Used space as “Simple”

3) Add (i.e. save).

4) If you query the tables, in graphs_items, the type field is set (as appropriate) to 2. The graph works fine at this point.

5) Now go back in and edit the graph:
a. Change the type to “Normal” first (notice this hides type field)
b. Note that MIN and MAX are set to calculated (no need to change them as it should default)
c. Save

6) If you query the tables, the type is still set to 2, which ideally would be irrelevant, but (as you see) is not.

7) Display the graph – notice that the Y scale is set based solely on the used space, not the total (the total is likely off the screen entirely).

8) If you use SQL to reset the type from 2 to 0, and redisplay the graph, it scales correctly (at least for me nothing was cached, in theory you might need to stop the server before doing the SQL update, and start after).

This also is inherited with templates, so if you define a graph prototype in this fashion, when the LLD creates the actual graphs, the "2" is propagated to the individual disks and hosts, and continues to cause all (or almost all) of them to function incorrectly.

I would argue there are two separate issues; one is that the type of "2" probably should not even be looked at for line/region graphs, but more to the point when changing the graph type to normal, the graph-sum value should be reset as part of changing the graph type. While either would fix this particular problem, the latter is probably the most conservative fix in case the type=2 is handled differently elsewhere.



 Comments   
Comment by Oleksii Zagorskyi [ 2015 Sep 30 ]

More short description:
graph items with type=2 (may be set as "Graph sum" when switch graph to Pie) are not taken into account for scaling axis for Normal graphs.

To reproduce easier:
when creating a graph with two items, even before saving, switch temporary to Pie mode, select "Graph sum" for one items (which has greater values), switch back to Normal mode, click preview.

CONFIRMED !
Changed priority to critical.

Comment by Oleksii Zagorskyi [ 2015 Oct 01 ]

I'd prefer to keep the type=2 in database, but ignore it for Normal graphs.
It will be more correct than set type=0 for all items when change a graph to Normal, IMO.

Comment by richlv [ 2015 Oct 01 ]

but type=2 is meaningless for normal graphs, what's the point keeping it ?

Comment by Oleksii Zagorskyi [ 2015 Oct 01 ]

When user switch a graph back to Pie - those settings will be preserved.
I consider this as a more user friendly approach.
It currently works so for example in maintenance settings when you switch between one-time and recurring maintenance mode - some independent settings are preserved and I like it.

Comment by Linwood Ferguson [ 2015 Oct 01 ]

To the "leave 2 in database" one question for consideration: Why did the scale calculation even look at that field? I ask because that answer might indicate if other not yet discovered code also (inappropriately) looks at the same field?

Comment by vitalijs.cemeris (Inactive) [ 2015 Oct 06 ]

(1) No translation strings changed.

iivs CLOSED.

Comment by vitalijs.cemeris (Inactive) [ 2015 Oct 06 ]

RESOLVED in development branch svn://svn.zabbix.com/branches/dev/ZBX-9919

Comment by Oleksii Zagorskyi [ 2015 Oct 06 ]

(2) I see this part removed from CLineGraphDraw.php:

if ($this->items[$item]['type'] == ITEM_TYPE_TRAPPER) {
					$draw = true;
				}

which is wrong, IMO.
And replacing $type by $item_type is also wrong, at least in some places, IMO!

vitalijs.cemeris RESOLVED in r55964

zalex_ua thanks, looks more correct now. should be checked/tested by devs.

iivs Please, see minor coding style fix in r56086

vitalijs.cemeris CLOSED

Comment by Ivo Kurzemnieks [ 2015 Oct 12 ]

TESTED,

but, please, close (2) before merging. Keep in mind that this should be fixed for 2.2 as well.

Comment by vitalijs.cemeris (Inactive) [ 2015 Oct 14 ]

FIXED IN

  • pre-2.2.11rc1 r56154
  • pre-2.4.7rc1 r56152
  • pre-3.0.0alpha3 (trunk) r56138
Generated at Sat Apr 27 01:59:45 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.