Ad Widget

Collapse

Blank Graphs in low-frequency items. (24h - 31d period)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • smallclanger
    Junior Member
    • Dec 2006
    • 13

    #1

    Blank Graphs in low-frequency items. (24h - 31d period)

    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.
    Attached Files
    Last edited by smallclanger; 12-03-2008, 13:08.
  • smallclanger
    Junior Member
    • Dec 2006
    • 13

    #2
    Attaching the second graph separately to avoid it stretching the post to an enormous width.

    Terry.
    Attached Files

    Comment

    • xs-
      Senior Member
      Zabbix Certified Specialist
      • Dec 2007
      • 393

      #3
      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?

      Comment

      • smallclanger
        Junior Member
        • Dec 2006
        • 13

        #4
        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)

        Comment

        • xs-
          Senior Member
          Zabbix Certified Specialist
          • Dec 2007
          • 393

          #5
          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 =\

          Comment

          • smallclanger
            Junior Member
            • Dec 2006
            • 13

            #6
            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...

            Comment

            • smallclanger
              Junior Member
              • Dec 2006
              • 13

              #7
              Originally posted by smallclanger
              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.

              Comment

              • Aly
                ZABBIX developer
                • May 2007
                • 1126

                #8
                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.
                Zabbix | ex GUI developer

                Comment

                • smallclanger
                  Junior Member
                  • Dec 2006
                  • 13

                  #9
                  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

                  Comment

                  • Aly
                    ZABBIX developer
                    • May 2007
                    • 1126

                    #10
                    In graph.inc.php change this code at line ~984:
                    Code:
                    				$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:

                    Code:
                    			$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
                    Zabbix | ex GUI developer

                    Comment

                    • smallclanger
                      Junior Member
                      • Dec 2006
                      • 13

                      #11
                      That worked perfectly once I'd gotten it pasted in correctly.

                      Thanks for the patch.

                      Terry.

                      Comment

                      • Pasha-nsk
                        Junior Member
                        • Mar 2008
                        • 12

                        #12
                        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

                        Comment

                        • richlv
                          Senior Member
                          Zabbix Certified Trainer
                          Zabbix Certified SpecialistZabbix Certified Professional
                          • Oct 2005
                          • 3112

                          #13
                          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) ?
                          Zabbix 3.0 Network Monitoring book

                          Comment

                          • Clark_Kent
                            Junior Member
                            • Nov 2009
                            • 2

                            #14
                            24 h graph

                            The only thing I can get is a 1 h graph.
                            How can a configure other time frames in first place?

                            /Clark

                            Comment

                            • richlv
                              Senior Member
                              Zabbix Certified Trainer
                              Zabbix Certified SpecialistZabbix Certified Professional
                              • Oct 2005
                              • 3112

                              #15
                              configure where ? for viewing you simply use time controls below the graph to change displayed period
                              Zabbix 3.0 Network Monitoring book

                              Comment

                              Working...