View Full Version : Blank Graphs in low-frequency items. (24h - 31d period)
smallclanger
12-03-2008, 11:55
Got an odd issue with some graphs of low frequency data. This issue cropped up only since I upgraded from 1.1.2 to 1.4.4, but is affecting items that existed before the upgrade and new ones created since.
It seems that periods beyond 34 days render perfectly well, as do periods below around 24 hours. Anything in between results in blank graphs in some cases, or as in this example big gaps in the lines.
Example graphs with 2 items, both with frequency 86400 seconds (1 day) First one, 31d, broken. 2nd one 62 day, working. The data and trends seem to be intact in both cases.
Any ideas what might be causing this (or how I could debug it further? There's nothing useful in the logs)
Thanks,
Terry.
smallclanger
12-03-2008, 12:09
Attaching the second graph separately to avoid it stretching the post to an enormous width.
Terry.
Well,
depending on your item configuration, times scopes above a cetrain value will use the trend values for graphing, anything less will use history.
Have you checked the textual values of the history? do you see the same gaps there?
smallclanger
12-03-2008, 13:30
Yep, I tried that. Comparing the last 50 values for one of the above items the data, the earliest 'clock' for history is 1201582098, and 1201406400 for trends, which puts them a couple of days apart. All the history values are populated, so there's defeintely data there that's not being rendered.
Also, I can reduce the period to 48 hours and it will show the graphs for data that isn't visible with a period of 31d.
Finally, I've got the history and trend retention for these items set to 7300 days (yes, that's 20 years, but I'm only storing 1 value per day). I thought zabbix only used trend data for periods exceeding the history retention? (I've already got more than 2 years of data these item histories)
Its possible that due to the once-per-day item data, the graph function has a hard time drawing them, but i really dont know =\
smallclanger
25-03-2008, 12:17
It's true that this only seems to be happening on the low-frequency items. It seems that any periods above about 35 days render correctly, and all of the usual 1 minute/30 second items render perfectly well at any scale.
Another new issue is that I get 'Incorrect value for [period]' for any graph period over about 1.2 years, now.
Time to start digging about in the PHP...
smallclanger
25-03-2008, 13:16
Another new issue is that I get 'Incorrect value for [period]' for any graph period over about 1.2 years, now.
Time to start digging about in the PHP...
Ok, so I've cured this one by altering the values ZBX_MIN_PERIOD and ZBX_MAX_PERIOD in includes/defines.inc.php.
I'm not sure (didn't check), but because of the low-frequency item, I think it's wrongly calculated from which table we need to take data. :rolleyes:
smallclanger
27-03-2008, 12:07
I guess it's not a typical use for Zabbix.
The graphs in question are just historical data for web sites (hits/hosts/bytes per day). The items are read from a file generated daily by analog. I suppose I could increase the frequency, but it would only be reading the same value multiple times each day.
Is there a way I can work around this? I've had a look in the graph class, but my PHP isn't all that great so I'm lost in there :)
In graph.inc.php change this code at line ~984:
$type = $this->items[$i]["calc_type"];
if($type == GRAPH_ITEM_AGGREGATED) {
/* skip current period */
$from_time = $this->from_time - $this->period * $this->items[$i]["periods_cnt"];
$to_time = $this->from_time;
} else {
$from_time = $this->from_time;
$to_time = $this->to_time;
}
$calc_field = 'round('.$x.'*(mod('.zbx_dbcast_2bigint('clock').' +'.$z.','.$p.'))/('.$p.'),0)'; /* required for 'group by' support of Oracle */
$sql_arr = array();
if(($this->period / $this->sizeX) <= (ZBX_MAX_TREND_DIFF / ZBX_GRAPH_MAX_SKIP_CELL))
{
array_push($sql_arr,
'select itemid,'.$calc_field.' as i,'.
' count(*) as count,avg(value) as avg,min(value) as min,'.
' max(value) as max,max(clock) as clock'.
' from history where itemid='.$this->items[$i]['itemid'].' and clock>='.$from_time.
' and clock<='.$to_time.' group by itemid,'.$calc_field
,
'select itemid,'.$calc_field.' as i,'.
' count(*) as count,avg(value) as avg,min(value) as min,'.
' max(value) as max,max(clock) as clock'.
' from history_uint where itemid='.$this->items[$i]['itemid'].' and clock>='.$from_time.
' and clock<='.$to_time.' group by itemid,'.$calc_field
);
}
else
{
array_push($sql_arr,
'select itemid,'.$calc_field.' as i,'.
' sum(num) as count,avg(value_avg) as avg,min(value_min) as min,'.
' max(value_max) as max,max(clock) as clock'.
' from trends where itemid='.$this->items[$i]['itemid'].' and clock>='.$from_time.
' and clock<='.$to_time.' group by itemid,'.$calc_field
);
$this->items[$i]['delay'] = max(($this->items[$i]['delay']*ZBX_GRAPH_MAX_DELAY),ZBX_MAX_TREND_DIFF)/ZBX_GRAPH_MAX_DELAY + 1;
}
to this:
$real_item = get_item_by_itemid($this->items[$i]['itemid']);
$type = $this->items[$i]["calc_type"];
if($type == GRAPH_ITEM_AGGREGATED) {
/* skip current period */
$from_time = $this->from_time - $this->period * $this->items[$i]["periods_cnt"];
$to_time = $this->from_time;
} else {
$from_time = $this->from_time;
$to_time = $this->to_time;
}
$calc_field = 'round('.$x.'*(mod('.zbx_dbcast_2bigint('clock').' +'.$z.','.$p.'))/('.$p.'),0)'; /* required for 'group by' support of Oracle */
$sql_arr = array();
if((($real_item['history']*86400) > (time()-($from_time+$this->period/2))) && // should pick data from history or trends
(($this->period / $this->sizeX) <= (ZBX_MAX_TREND_DIFF / ZBX_GRAPH_MAX_SKIP_CELL))) // is reasonable to take data from history?
{
array_push($sql_arr,
'SELECT itemid,'.$calc_field.' as i,'.
' count(*) as count,avg(value) as avg,min(value) as min,'.
' max(value) as max,max(clock) as clock'.
' FROM history '.
' WHERE itemid='.$this->items[$i]['itemid'].
' AND clock>='.$from_time.
' AND clock<='.$to_time.
' GROUP BY itemid,'.$calc_field
,
'SELECT itemid,'.$calc_field.' as i,'.
' count(*) as count,avg(value) as avg,min(value) as min,'.
' max(value) as max,max(clock) as clock'.
' FROM history_uint '.
' WHERE itemid='.$this->items[$i]['itemid'].
' AND clock>='.$from_time.
' AND clock<='.$to_time.
' GROUP BY itemid,'.$calc_field
);
}
else{
array_push($sql_arr,
'SELECT itemid,'.$calc_field.' as i,'.
' sum(num) as count,avg(value_avg) as avg,min(value_min) as min,'.
' max(value_max) as max,max(clock) as clock'.
' FROM trends '.
' WHERE itemid='.$this->items[$i]['itemid'].
' AND clock>='.$from_time.
' AND clock<='.$to_time.
' GROUP BY itemid,'.$calc_field
);
// $this->items[$i]['delay'] = max(($this->items[$i]['delay']*ZBX_GRAPH_MAX_DELAY),ZBX_MAX_TREND_DIFF)/ZBX_GRAPH_MAX_DELAY + 1;
$this->items[$i]['delay'] = max($this->items[$i]['delay'],3600);
}
I haven't check this, but should work :rolleyes:
smallclanger
01-04-2008, 16:30
That worked perfectly once I'd gotten it pasted in correctly. :)
Thanks for the patch.
Terry.
Pasha-nsk
03-04-2008, 06:59
Hello to all.
I have tried to correct a file graph.inc.php but nothing has turned out. Can you post a corrected version of file. Zabbix v1.4.5 OS Ubuntu 7.10
i noticed that graphing older periods gave me blank results for periods in past, shorter than some 81.25 hours.
a simple way to improve this to some 40.625 hours was to increase ZBX_GRAPH_MAX_SKIP_CELL (in include/classes/graph.inc.php for 1.4.6) from 16 to 32.
note, trunk has this defined in include/defines.inc.php
as i don't code and i couldn't find the description on what this variable controls, i'll avoid making wild guesses here :)
would it make any sense to change this period (either by chaning default value for this variable or in some other way) ?
Clark_Kent
27-11-2009, 13:12
The only thing I can get is a 1 h graph.
How can a configure other time frames in first place?
/Clark
configure where ? for viewing you simply use time controls below the graph to change displayed period
Clark_Kent
27-11-2009, 17:02
Thank you very much.
Although it is not very obvious, like many other thinks
in Zabbix .