diff options
Diffstat (limited to '')
-rw-r--r-- | type/Default.class.php | 95 | ||||
-rw-r--r-- | type/GenericIO.class.php | 28 | ||||
-rw-r--r-- | type/GenericStacked.class.php | 16 | ||||
-rw-r--r-- | type/Uptime.class.php | 16 |
4 files changed, 98 insertions, 57 deletions
diff --git a/type/Default.class.php b/type/Default.class.php index 48852d4..8632328 100644 --- a/type/Default.class.php +++ b/type/Default.class.php | |||
@@ -16,9 +16,12 @@ class Type_Default { | |||
16 | var $rrd_title; | 16 | var $rrd_title; |
17 | var $rrd_vertical; | 17 | var $rrd_vertical; |
18 | var $rrd_format; | 18 | var $rrd_format; |
19 | var $scale; | 19 | var $scale = 1; |
20 | var $width; | 20 | var $width; |
21 | var $heigth; | 21 | var $heigth; |
22 | var $graph_type; | ||
23 | var $negative_io; | ||
24 | var $graph_smooth; | ||
22 | 25 | ||
23 | var $files; | 26 | var $files; |
24 | var $tinstances; | 27 | var $tinstances; |
@@ -32,6 +35,13 @@ class Type_Default { | |||
32 | $this->parse_get(); | 35 | $this->parse_get(); |
33 | $this->rrd_files(); | 36 | $this->rrd_files(); |
34 | $this->identifiers = $this->file2identifier($this->files); | 37 | $this->identifiers = $this->file2identifier($this->files); |
38 | $this->width = GET('x'); | ||
39 | if (empty($this->width)) $this->width = $config['width']; | ||
40 | $this->heigth = GET('y'); | ||
41 | if (empty($this->heigth)) $this->heigth = $config['heigth']; | ||
42 | $this->graph_type = $config['graph_type']; | ||
43 | $this->negative_io = $config['negative_io']; | ||
44 | $this->graph_smooth = $config['graph_smooth']; | ||
35 | } | 45 | } |
36 | 46 | ||
37 | function rainbow_colors() { | 47 | function rainbow_colors() { |
@@ -104,6 +114,13 @@ class Type_Default { | |||
104 | return str_replace(':', '\:', $value); | 114 | return str_replace(':', '\:', $value); |
105 | } | 115 | } |
106 | 116 | ||
117 | function parse_filename($file) { | ||
118 | if ($this->graph_type == 'canvas') { | ||
119 | $file = 'rrd.php/' . str_replace($this->datadir . '/', '', $file); | ||
120 | } | ||
121 | return $this->rrd_escape($file); | ||
122 | } | ||
123 | |||
107 | function rrd_files() { | 124 | function rrd_files() { |
108 | $files = $this->get_filenames(); | 125 | $files = $this->get_filenames(); |
109 | 126 | ||
@@ -149,43 +166,61 @@ class Type_Default { | |||
149 | return $files; | 166 | return $files; |
150 | } | 167 | } |
151 | 168 | ||
152 | function rrd_graph($debug=false) { | 169 | function rrd_graph($debug = false) { |
153 | if (!$this->colors) | 170 | if (!$this->colors) |
154 | $this->rainbow_colors(); | 171 | $this->rainbow_colors(); |
155 | 172 | ||
156 | $graphdata = $this->rrd_gen_graph(); | 173 | $graphdata = $this->rrd_gen_graph(); |
157 | 174 | ||
158 | if(!$debug) { | 175 | $style = $debug !== false ? $debug : $this->graph_type; |
159 | # caching | 176 | switch ($style) { |
160 | if (is_numeric($this->cache) && $this->cache > 0) | 177 | case 'cmd': |
161 | header("Expires: " . date(DATE_RFC822,strtotime($this->cache." seconds"))); | 178 | print '<pre>'; |
162 | header("content-type: image/png"); | 179 | foreach ($graphdata as $d) { |
163 | $graphdata = implode(' ', $graphdata); | 180 | printf("%s \\\n", $d); |
164 | echo `$graphdata`; | 181 | } |
165 | } elseif ($debug == 'cmd') { | 182 | print '</pre>'; |
166 | print '<pre>'; | 183 | break; |
167 | foreach ($graphdata as $d) { | 184 | case 'canvas': |
168 | printf("%s \\\n", $d); | 185 | printf('<canvas id="%s" class="rrd">', sha1(serialize($graphdata))); |
169 | } | 186 | foreach ($graphdata as $d) { |
170 | print '</pre>'; | 187 | printf("%s\n", $d); |
171 | } else { | 188 | } |
172 | print '<pre>'; | 189 | print '</canvas>'; |
173 | print_r($graphdata); | 190 | break; |
174 | print '</pre>'; | 191 | case 'debug': |
192 | case 1: | ||
193 | print '<pre>'; | ||
194 | print_r($graphdata); | ||
195 | print '</pre>'; | ||
196 | break; | ||
197 | case 'png': | ||
198 | default: | ||
199 | # caching | ||
200 | if (is_numeric($this->cache) && $this->cache > 0) | ||
201 | header("Expires: " . date(DATE_RFC822,strtotime($this->cache." seconds"))); | ||
202 | header("content-type: image/png"); | ||
203 | $graphdata = implode(' ', $graphdata); | ||
204 | echo `$graphdata`; | ||
205 | break; | ||
175 | } | 206 | } |
176 | } | 207 | } |
177 | 208 | ||
178 | function rrd_options() { | 209 | function rrd_options() { |
179 | $rrdgraph[] = $this->rrdtool; | 210 | if ($this->graph_type != 'canvas') { |
180 | $rrdgraph[] = 'graph - -a PNG'; | 211 | $rrdgraph[] = $this->rrdtool; |
212 | $rrdgraph[] = 'graph - -a PNG'; | ||
213 | } | ||
181 | if ($this->rrdtool_opts != '') | 214 | if ($this->rrdtool_opts != '') |
182 | $rrdgraph[] = $this->rrdtool_opts; | 215 | $rrdgraph[] = $this->rrdtool_opts; |
216 | if ($this->graph_smooth) | ||
217 | $rrdgraph[] = '-E'; | ||
183 | $rrdgraph[] = sprintf('-w %d', is_numeric($this->width) ? $this->width : 400); | 218 | $rrdgraph[] = sprintf('-w %d', is_numeric($this->width) ? $this->width : 400); |
184 | $rrdgraph[] = sprintf('-h %d', is_numeric($this->heigth) ? $this->heigth : 175); | 219 | $rrdgraph[] = sprintf('-h %d', is_numeric($this->heigth) ? $this->heigth : 175); |
185 | $rrdgraph[] = '-l 0'; | 220 | $rrdgraph[] = '-l 0'; |
186 | $rrdgraph[] = sprintf('-t "%s on %s"', $this->rrd_title, $this->args['host']); | 221 | $rrdgraph[] = sprintf('-t "%s on %s"', $this->rrd_title, $this->args['host']); |
187 | $rrdgraph[] = sprintf('-v "%s"', $this->rrd_vertical); | 222 | $rrdgraph[] = sprintf('-v "%s"', $this->rrd_vertical); |
188 | $rrdgraph[] = sprintf('-s -%d', is_numeric($this->seconds) ? $this->seconds : 86400); | 223 | $rrdgraph[] = sprintf('-s e-%d', is_numeric($this->seconds) ? $this->seconds : 86400); |
189 | 224 | ||
190 | return $rrdgraph; | 225 | return $rrdgraph; |
191 | } | 226 | } |
@@ -256,9 +291,9 @@ class Type_Default { | |||
256 | $i=0; | 291 | $i=0; |
257 | foreach ($this->tinstances as $tinstance) { | 292 | foreach ($this->tinstances as $tinstance) { |
258 | foreach ($this->data_sources as $ds) { | 293 | foreach ($this->data_sources as $ds) { |
259 | $rrdgraph[] = sprintf('DEF:min_%s%s="%s":%s:MIN', crc32hex($sources[$i]), $raw, $this->rrd_escape($this->files[$tinstance]), $ds); | 294 | $rrdgraph[] = sprintf('DEF:min_%s%s=%s:%s:MIN', crc32hex($sources[$i]), $raw, $this->parse_filename($this->files[$tinstance]), $ds); |
260 | $rrdgraph[] = sprintf('DEF:avg_%s%s="%s":%s:AVERAGE', crc32hex($sources[$i]), $raw, $this->rrd_escape($this->files[$tinstance]), $ds); | 295 | $rrdgraph[] = sprintf('DEF:avg_%s%s=%s:%s:AVERAGE', crc32hex($sources[$i]), $raw, $this->parse_filename($this->files[$tinstance]), $ds); |
261 | $rrdgraph[] = sprintf('DEF:max_%s%s="%s":%s:MAX', crc32hex($sources[$i]), $raw, $this->rrd_escape($this->files[$tinstance]), $ds); | 296 | $rrdgraph[] = sprintf('DEF:max_%s%s=%s:%s:MAX', crc32hex($sources[$i]), $raw, $this->parse_filename($this->files[$tinstance]), $ds); |
262 | $i++; | 297 | $i++; |
263 | } | 298 | } |
264 | } | 299 | } |
@@ -288,11 +323,11 @@ class Type_Default { | |||
288 | foreach ($sources as $source) { | 323 | foreach ($sources as $source) { |
289 | $dsname = $this->ds_names[$source] != '' ? $this->ds_names[$source] : $source; | 324 | $dsname = $this->ds_names[$source] != '' ? $this->ds_names[$source] : $source; |
290 | $color = is_array($this->colors) ? (isset($this->colors[$source])?$this->colors[$source]:$this->colors[$c++]): $this->colors; | 325 | $color = is_array($this->colors) ? (isset($this->colors[$source])?$this->colors[$source]:$this->colors[$c++]): $this->colors; |
291 | $rrdgraph[] = sprintf('LINE1:avg_%s#%s:\'%s\'', crc32hex($source), $this->validate_color($color), $this->rrd_escape($dsname)); | 326 | $rrdgraph[] = sprintf('"LINE1:avg_%s#%s:%s"', crc32hex($source), $this->validate_color($color), $this->rrd_escape($dsname)); |
292 | $rrdgraph[] = sprintf('GPRINT:min_%s:MIN:\'%s Min,\'', crc32hex($source), $this->rrd_format); | 327 | $rrdgraph[] = sprintf('"GPRINT:min_%s:MIN:%s Min,"', crc32hex($source), $this->rrd_format); |
293 | $rrdgraph[] = sprintf('GPRINT:avg_%s:AVERAGE:\'%s Avg,\'', crc32hex($source), $this->rrd_format); | 328 | $rrdgraph[] = sprintf('"GPRINT:avg_%s:AVERAGE:%s Avg,"', crc32hex($source), $this->rrd_format); |
294 | $rrdgraph[] = sprintf('GPRINT:max_%s:MAX:\'%s Max,\'', crc32hex($source), $this->rrd_format); | 329 | $rrdgraph[] = sprintf('"GPRINT:max_%s:MAX:%s Max,"', crc32hex($source), $this->rrd_format); |
295 | $rrdgraph[] = sprintf('GPRINT:avg_%s:LAST:\'%s Last\\l\'', crc32hex($source), $this->rrd_format); | 330 | $rrdgraph[] = sprintf('"GPRINT:avg_%s:LAST:%s Last\\l"', crc32hex($source), $this->rrd_format); |
296 | } | 331 | } |
297 | 332 | ||
298 | return $rrdgraph; | 333 | return $rrdgraph; |
diff --git a/type/GenericIO.class.php b/type/GenericIO.class.php index 42314fd..3425f3e 100644 --- a/type/GenericIO.class.php +++ b/type/GenericIO.class.php | |||
@@ -15,9 +15,9 @@ class Type_GenericIO extends Type_Default { | |||
15 | $i=0; | 15 | $i=0; |
16 | foreach ($this->tinstances as $tinstance) { | 16 | foreach ($this->tinstances as $tinstance) { |
17 | foreach ($this->data_sources as $ds) { | 17 | foreach ($this->data_sources as $ds) { |
18 | $rrdgraph[] = sprintf('DEF:min_%s%s="%s":%s:MIN', crc32hex($sources[$i]), $raw, $this->rrd_escape($this->files[$tinstance]), $ds); | 18 | $rrdgraph[] = sprintf('DEF:min_%s%s=%s:%s:MIN', crc32hex($sources[$i]), $raw, $this->parse_filename($this->files[$tinstance]), $ds); |
19 | $rrdgraph[] = sprintf('DEF:avg_%s%s="%s":%s:AVERAGE', crc32hex($sources[$i]), $raw, $this->rrd_escape($this->files[$tinstance]), $ds); | 19 | $rrdgraph[] = sprintf('DEF:avg_%s_raw=%s:%s:AVERAGE', crc32hex($sources[$i]), $this->parse_filename($this->files[$tinstance]), $ds); |
20 | $rrdgraph[] = sprintf('DEF:max_%s%s="%s":%s:MAX', crc32hex($sources[$i]), $raw, $this->rrd_escape($this->files[$tinstance]), $ds); | 20 | $rrdgraph[] = sprintf('DEF:max_%s%s=%s:%s:MAX', crc32hex($sources[$i]), $raw, $this->parse_filename($this->files[$tinstance]), $ds); |
21 | if (!$this->scale) | 21 | if (!$this->scale) |
22 | $rrdgraph[] = sprintf('VDEF:tot_%s=avg_%1$s,TOTAL', crc32hex($sources[$i])); | 22 | $rrdgraph[] = sprintf('VDEF:tot_%s=avg_%1$s,TOTAL', crc32hex($sources[$i])); |
23 | $i++; | 23 | $i++; |
@@ -30,17 +30,21 @@ class Type_GenericIO extends Type_Default { | |||
30 | $rrdgraph[] = sprintf('CDEF:min_%s=min_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); | 30 | $rrdgraph[] = sprintf('CDEF:min_%s=min_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); |
31 | $rrdgraph[] = sprintf('CDEF:avg_%s=avg_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); | 31 | $rrdgraph[] = sprintf('CDEF:avg_%s=avg_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); |
32 | $rrdgraph[] = sprintf('CDEF:max_%s=max_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); | 32 | $rrdgraph[] = sprintf('CDEF:max_%s=max_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); |
33 | if ($i == 1) | ||
34 | $rrdgraph[] = sprintf('CDEF:avg_%s_neg=avg_%1$s_raw,%s%s,*', crc32hex($sources[$i]), $this->negative_io ? '-' : '', $this->scale); | ||
33 | $rrdgraph[] = sprintf('VDEF:tot_%1$s=avg_%1$s,TOTAL', crc32hex($sources[$i])); | 35 | $rrdgraph[] = sprintf('VDEF:tot_%1$s=avg_%1$s,TOTAL', crc32hex($sources[$i])); |
34 | $i++; | 36 | $i++; |
35 | } | 37 | } |
36 | } | 38 | } |
37 | } | 39 | } |
38 | 40 | ||
39 | $rrdgraph[] = sprintf('CDEF:overlap=avg_%s,avg_%s,LT,avg_%1$s,avg_%2$s,IF', | 41 | $rrdgraph[] = sprintf('CDEF:overlap=avg_%s,avg_%s_neg,LT,avg_%1$s,avg_%2$s_neg,IF', |
40 | crc32hex($sources[0]), crc32hex($sources[1])); | 42 | crc32hex($sources[0]), crc32hex($sources[1])); |
41 | 43 | ||
44 | $i = 0; | ||
42 | foreach($sources as $source) { | 45 | foreach($sources as $source) { |
43 | $rrdgraph[] = sprintf('AREA:avg_%s#%s', crc32hex($source), $this->get_faded_color($this->colors[$source])); | 46 | $rrdgraph[] = sprintf('AREA:avg_%s%s#%s', crc32hex($source), $i == 1 ? '_neg' : '', $this->get_faded_color($this->colors[$source])); |
47 | $i++; | ||
44 | } | 48 | } |
45 | 49 | ||
46 | $rrdgraph[] = sprintf('AREA:overlap#%s', | 50 | $rrdgraph[] = sprintf('AREA:overlap#%s', |
@@ -50,14 +54,16 @@ class Type_GenericIO extends Type_Default { | |||
50 | ) | 54 | ) |
51 | ); | 55 | ); |
52 | 56 | ||
57 | $i = 0; | ||
53 | foreach($sources as $source) { | 58 | foreach($sources as $source) { |
54 | $dsname = $this->ds_names[$source] != '' ? $this->ds_names[$source] : $source; | 59 | $dsname = $this->ds_names[$source] != '' ? $this->ds_names[$source] : $source; |
55 | $rrdgraph[] = sprintf('LINE1:avg_%s#%s:\'%s\'', crc32hex($source), $this->colors[$source], $this->rrd_escape($dsname)); | 60 | $rrdgraph[] = sprintf('"LINE1:avg_%s%s#%s:%s"', crc32hex($source), $i == 1 ? '_neg' : '', $this->colors[$source], $this->rrd_escape($dsname)); |
56 | $rrdgraph[] = sprintf('GPRINT:min_%s:MIN:\'%s Min,\'', crc32hex($source), $this->rrd_format); | 61 | $rrdgraph[] = sprintf('"GPRINT:min_%s:MIN:%s Min,"', crc32hex($source), $this->rrd_format); |
57 | $rrdgraph[] = sprintf('GPRINT:avg_%s:AVERAGE:\'%s Avg,\'', crc32hex($source), $this->rrd_format); | 62 | $rrdgraph[] = sprintf('"GPRINT:avg_%s:AVERAGE:%s Avg,"', crc32hex($source), $this->rrd_format); |
58 | $rrdgraph[] = sprintf('GPRINT:max_%s:MAX:\'%s Max,\'', crc32hex($source), $this->rrd_format); | 63 | $rrdgraph[] = sprintf('"GPRINT:max_%s:MAX:%s Max,"', crc32hex($source), $this->rrd_format); |
59 | $rrdgraph[] = sprintf('GPRINT:avg_%s:LAST:\'%s Last\'', crc32hex($source), $this->rrd_format); | 64 | $rrdgraph[] = sprintf('"GPRINT:avg_%s:LAST:%s Last"', crc32hex($source), $this->rrd_format); |
60 | $rrdgraph[] = sprintf('GPRINT:tot_%s:\'%s Total\l\'',crc32hex($source), $this->rrd_format); | 65 | $rrdgraph[] = sprintf('"GPRINT:tot_%s:%s Total\l"',crc32hex($source), $this->rrd_format); |
66 | $i++; | ||
61 | } | 67 | } |
62 | 68 | ||
63 | return $rrdgraph; | 69 | return $rrdgraph; |
diff --git a/type/GenericStacked.class.php b/type/GenericStacked.class.php index 7c65ddd..5d1a556 100644 --- a/type/GenericStacked.class.php +++ b/type/GenericStacked.class.php | |||
@@ -15,9 +15,9 @@ class Type_GenericStacked extends Type_Default { | |||
15 | $i=0; | 15 | $i=0; |
16 | foreach ($this->tinstances as $tinstance) { | 16 | foreach ($this->tinstances as $tinstance) { |
17 | foreach ($this->data_sources as $ds) { | 17 | foreach ($this->data_sources as $ds) { |
18 | $rrdgraph[] = sprintf('DEF:min_%s%s="%s":%s:MIN', crc32hex($sources[$i]), $raw, $this->rrd_escape($this->files[$tinstance]), $ds); | 18 | $rrdgraph[] = sprintf('DEF:min_%s%s=%s:%s:MIN', crc32hex($sources[$i]), $raw, $this->parse_filename($this->files[$tinstance]), $ds); |
19 | $rrdgraph[] = sprintf('DEF:avg_%s%s="%s":%s:AVERAGE', crc32hex($sources[$i]), $raw, $this->rrd_escape($this->files[$tinstance]), $ds); | 19 | $rrdgraph[] = sprintf('DEF:avg_%s%s=%s:%s:AVERAGE', crc32hex($sources[$i]), $raw, $this->parse_filename($this->files[$tinstance]), $ds); |
20 | $rrdgraph[] = sprintf('DEF:max_%s%s="%s":%s:MAX', crc32hex($sources[$i]), $raw, $this->rrd_escape($this->files[$tinstance]), $ds); | 20 | $rrdgraph[] = sprintf('DEF:max_%s%s=%s:%s:MAX', crc32hex($sources[$i]), $raw, $this->parse_filename($this->files[$tinstance]), $ds); |
21 | $i++; | 21 | $i++; |
22 | } | 22 | } |
23 | } | 23 | } |
@@ -51,11 +51,11 @@ class Type_GenericStacked extends Type_Default { | |||
51 | foreach ($sources as $source) { | 51 | foreach ($sources as $source) { |
52 | $dsname = $this->ds_names[$source] != '' ? $this->ds_names[$source] : $source; | 52 | $dsname = $this->ds_names[$source] != '' ? $this->ds_names[$source] : $source; |
53 | $color = is_array($this->colors) ? (isset($this->colors[$source])?$this->colors[$source]:$this->colors[$c++]) : $this->colors; | 53 | $color = is_array($this->colors) ? (isset($this->colors[$source])?$this->colors[$source]:$this->colors[$c++]) : $this->colors; |
54 | $rrdgraph[] = sprintf('LINE1:area_%s#%s:\'%s\'', crc32hex($source), $this->validate_color($color), $this->rrd_escape($dsname)); | 54 | $rrdgraph[] = sprintf('"LINE1:area_%s#%s:%s"', crc32hex($source), $this->validate_color($color), $this->rrd_escape($dsname)); |
55 | $rrdgraph[] = sprintf('GPRINT:min_%s:MIN:\'%s Min,\'', crc32hex($source), $this->rrd_format); | 55 | $rrdgraph[] = sprintf('"GPRINT:min_%s:MIN:%s Min,"', crc32hex($source), $this->rrd_format); |
56 | $rrdgraph[] = sprintf('GPRINT:avg_%s:AVERAGE:\'%s Avg,\'', crc32hex($source), $this->rrd_format); | 56 | $rrdgraph[] = sprintf('"GPRINT:avg_%s:AVERAGE:%s Avg,"', crc32hex($source), $this->rrd_format); |
57 | $rrdgraph[] = sprintf('GPRINT:max_%s:MAX:\'%s Max,\'', crc32hex($source), $this->rrd_format); | 57 | $rrdgraph[] = sprintf('"GPRINT:max_%s:MAX:%s Max,"', crc32hex($source), $this->rrd_format); |
58 | $rrdgraph[] = sprintf('GPRINT:avg_%s:LAST:\'%s Last\\l\'', crc32hex($source), $this->rrd_format); | 58 | $rrdgraph[] = sprintf('"GPRINT:avg_%s:LAST:%s Last\\l"', crc32hex($source), $this->rrd_format); |
59 | } | 59 | } |
60 | 60 | ||
61 | return $rrdgraph; | 61 | return $rrdgraph; |
diff --git a/type/Uptime.class.php b/type/Uptime.class.php index aa91a6e..17bcb9a 100644 --- a/type/Uptime.class.php +++ b/type/Uptime.class.php | |||
@@ -12,8 +12,8 @@ class Type_Uptime extends Type_Default { | |||
12 | $i=0; | 12 | $i=0; |
13 | foreach ($this->tinstances as $tinstance) { | 13 | foreach ($this->tinstances as $tinstance) { |
14 | foreach ($this->data_sources as $ds) { | 14 | foreach ($this->data_sources as $ds) { |
15 | $rrdgraph[] = sprintf('DEF:avg_%s="%s":%s:AVERAGE', crc32hex($sources[$i]), $this->rrd_escape($this->files[$tinstance]), $ds); | 15 | $rrdgraph[] = sprintf('DEF:avg_%s=%s:%s:AVERAGE', crc32hex($sources[$i]), $this->parse_filename($this->files[$tinstance]), $ds); |
16 | $rrdgraph[] = sprintf('DEF:max_%s="%s":%s:MAX', crc32hex($sources[$i]), $this->rrd_escape($this->files[$tinstance]), $ds); | 16 | $rrdgraph[] = sprintf('DEF:max_%s=%s:%s:MAX', crc32hex($sources[$i]), $this->parse_filename($this->files[$tinstance]), $ds); |
17 | 17 | ||
18 | $rrdgraph[] = sprintf('CDEF:c_avg_%s=avg_%1$s,86400,/', crc32hex($sources[$i])); | 18 | $rrdgraph[] = sprintf('CDEF:c_avg_%s=avg_%1$s,86400,/', crc32hex($sources[$i])); |
19 | $rrdgraph[] = sprintf('CDEF:c_max_%s=max_%1$s,86400,/', crc32hex($sources[$i])); | 19 | $rrdgraph[] = sprintf('CDEF:c_max_%s=max_%1$s,86400,/', crc32hex($sources[$i])); |
@@ -45,16 +45,16 @@ class Type_Uptime extends Type_Default { | |||
45 | $color = is_array($this->colors) ? (isset($this->colors[$source])?$this->colors[$source]:$this->colors[$c++]) : $this->colors; | 45 | $color = is_array($this->colors) ? (isset($this->colors[$source])?$this->colors[$source]:$this->colors[$c++]) : $this->colors; |
46 | 46 | ||
47 | //current value | 47 | //current value |
48 | $rrdgraph[] = sprintf('LINE1:area_%s#%s:\'%s\'', crc32hex($source), $this->validate_color($color), $this->rrd_escape($dsname)); | 48 | $rrdgraph[] = sprintf('"LINE1:area_%s#%s:%s"', crc32hex($source), $this->validate_color($color), $this->rrd_escape($dsname)); |
49 | $rrdgraph[] = sprintf('GPRINT:c_avg_%s:LAST:\'%s days\\l\'', crc32hex($source), $this->rrd_format); | 49 | $rrdgraph[] = sprintf('"GPRINT:c_avg_%s:LAST:%s days\\l"', crc32hex($source), $this->rrd_format); |
50 | 50 | ||
51 | //max value | 51 | //max value |
52 | $rrdgraph[] = sprintf('LINE1:v_max_%s#FF0000:\'Maximum\':dashes', crc32hex($source)); | 52 | $rrdgraph[] = sprintf('"LINE1:v_max_%s#FF0000:Maximum:dashes"', crc32hex($source)); |
53 | $rrdgraph[] = sprintf('GPRINT:v_max_%s:\'%s days\\l\'', crc32hex($source), $this->rrd_format); | 53 | $rrdgraph[] = sprintf('"GPRINT:v_max_%s:%s days\\l"', crc32hex($source), $this->rrd_format); |
54 | 54 | ||
55 | //avg value | 55 | //avg value |
56 | $rrdgraph[] = sprintf('LINE1:v_avg_%s#0000FF:\'Average\':dashes', crc32hex($source)); | 56 | $rrdgraph[] = sprintf('"LINE1:v_avg_%s#0000FF:Average:dashes"', crc32hex($source)); |
57 | $rrdgraph[] = sprintf('GPRINT:v_avg_%s:\'%s days\\l\'', crc32hex($source), $this->rrd_format); | 57 | $rrdgraph[] = sprintf('"GPRINT:v_avg_%s:%s days\\l"', crc32hex($source), $this->rrd_format); |
58 | } | 58 | } |
59 | 59 | ||
60 | return $rrdgraph; | 60 | return $rrdgraph; |