mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix graph error for small graphs (switch to old method!)
git-svn-id: http://www.observium.org/svn/observer/trunk@2463 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -87,33 +87,32 @@ function graph_error($string)
|
|||||||
global $config, $width, $height, $debug, $graphfile, $rrd_options, $rrd_switches;
|
global $config, $width, $height, $debug, $graphfile, $rrd_options, $rrd_switches;
|
||||||
|
|
||||||
#$rrd_options .= " HRULE:0#cc0000";
|
#$rrd_options .= " HRULE:0#cc0000";
|
||||||
|
|
||||||
#$rrd_cmd = $config['rrdtool'] . " graph $graphfile $rrd_options" . $rrd_switches;
|
#$rrd_cmd = $config['rrdtool'] . " graph $graphfile $rrd_options" . $rrd_switches;
|
||||||
$rrd_cmd = $config['rrdtool'] . " graph $graphfile --title='".$string."' -l 0 -u 100 -E --start -10y --end now --width $width --height $height -c BACK#ff9999cc -c SHADEA#EEEEEE00 -c SHADEB#EEEEEE00 -c FONT#000000 -c CANVAS#FFFFFF00 -c GRID#a5a5a5 -c MGRID#FF9999 -c FRAME#5e5e5e -c ARROW#5e5e5e -R normal --font LEGEND:8:DejaVuSansMono --font AXIS:7:DejaVuSansMono --font-render-mode normal HRULE:0#cc0000" . $rrd_switches;
|
$rrd_cmd = $config['rrdtool'] . " graph $graphfile --title='".$string."' -l 0 -u 100 -E --start -10y --end now --width $width --height $height -c BACK#ff9999cc -c SHADEA#EEEEEE00 -c SHADEB#EEEEEE00 -c FONT#000000 -c CANVAS#FFFFFF00 -c GRID#a5a5a5 -c MGRID#FF9999 -c FRAME#5e5e5e -c ARROW#5e5e5e -R normal --font LEGEND:8:DejaVuSansMono --font AXIS:7:DejaVuSansMono --font-render-mode normal HRULE:0#cc0000" . $rrd_switches;
|
||||||
|
|
||||||
|
if ($height > "99") {
|
||||||
|
#$rrd_cmd .= " --only-graph"; }
|
||||||
|
|
||||||
$woo = shell_exec($rrd_cmd);
|
$woo = shell_exec($rrd_cmd);
|
||||||
if ($debug) { echo("<pre>".$rrd_cmd."</pre>"); }
|
if ($debug) { echo("<pre>".$rrd_cmd."</pre>"); }
|
||||||
if (is_file($graphfile) && !$debug)
|
if (is_file($graphfile) && !$debug)
|
||||||
{
|
{
|
||||||
header('Content-type: image/png');
|
header('Content-type: image/png');
|
||||||
$fd = fopen($graphfile,'r');fpassthru($fd);fclose($fd);
|
$fd = fopen($graphfile,'r'); fpassthru($fd); fclose($fd);
|
||||||
unlink($graphfile);
|
unlink($graphfile);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!$debug) { header('Content-type: image/png'); }
|
||||||
|
$im = imagecreate($width, $height);
|
||||||
|
$orange = imagecolorallocate($im, 255, 225, 225);
|
||||||
|
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
|
||||||
|
imagestring($im, 3, $px, $height / 2 - 8, $string, imagecolorallocate($im, 128, 0, 0));
|
||||||
|
imagepng($im);
|
||||||
|
imagedestroy($im);
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# if (!$debug) { header('Content-type: image/png'); }
|
|
||||||
# if ($height > "99") { $width +=75; }
|
|
||||||
# $im = imagecreate($width, $height);
|
|
||||||
# $orange = imagecolorallocate($im, 255, 225, 225);
|
|
||||||
# $px = (imagesx($im) - 7.5 * strlen($string)) / 2;
|
|
||||||
# imagestring($im, 3, $px, $height / 2 - 8, $string, imagecolorallocate($im, 128, 0, 0));
|
|
||||||
# imagepng($im);
|
|
||||||
# imagedestroy($im);
|
|
||||||
# exit();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error_msg) {
|
if ($error_msg) {
|
||||||
|
Reference in New Issue
Block a user