diff --git a/html/includes/graphs/device/ping_perf.inc.php b/html/includes/graphs/device/ping_perf.inc.php index 88ab60046f..438b45f6cd 100644 --- a/html/includes/graphs/device/ping_perf.inc.php +++ b/html/includes/graphs/device/ping_perf.inc.php @@ -19,7 +19,7 @@ require 'includes/graphs/common.inc.php'; $rrd_filename = rrd_name($device['hostname'], 'ping-perf'); $rrd_options .= ' DEF:ping='.$rrd_filename.':ping:AVERAGE'; -$rrd_options .= " 'COMMENT:Seconds Current Minimum Maximum Average\\n'"; +$rrd_options .= " 'COMMENT:Seconds Cur Min Max Avg\\n'"; $rrd_options .= ' LINE1.25:ping#36393D:Ping'; $rrd_options .= ' GPRINT:ping:LAST:%6.2lf GPRINT:ping:AVERAGE:%6.2lf'; $rrd_options .= " GPRINT:ping:MAX:%6.2lf 'GPRINT:ping:AVERAGE:%6.2lf\\n'"; diff --git a/html/includes/graphs/device/poller_perf.inc.php b/html/includes/graphs/device/poller_perf.inc.php index 03b78401e5..380695ec58 100644 --- a/html/includes/graphs/device/poller_perf.inc.php +++ b/html/includes/graphs/device/poller_perf.inc.php @@ -19,7 +19,7 @@ require 'includes/graphs/common.inc.php'; $rrd_filename = rrd_name($device['hostname'], 'poller-perf'); $rrd_options .= ' DEF:poller='.$rrd_filename.':poller:AVERAGE'; -$rrd_options .= " 'COMMENT:Seconds Current Minimum Maximum Average\\n'"; +$rrd_options .= " 'COMMENT:Seconds Cur Min Max Avg\\n'"; $rrd_options .= ' LINE1.25:poller#36393D:Poller'; $rrd_options .= ' GPRINT:poller:LAST:%6.2lf GPRINT:poller:MIN:%6.2lf'; $rrd_options .= " GPRINT:poller:MAX:%6.2lf 'GPRINT:poller:AVERAGE:%6.2lf\\n'"; diff --git a/html/includes/graphs/device/sensor.inc.php b/html/includes/graphs/device/sensor.inc.php index 13b6c98a1b..de8a5b12d8 100644 --- a/html/includes/graphs/device/sensor.inc.php +++ b/html/includes/graphs/device/sensor.inc.php @@ -2,15 +2,9 @@ require 'includes/graphs/common.inc.php'; -if ($_GET['width'] > '300') { - $descr_len = '40'; -} else { - $descr_len = '22'; -} -$rrd_options .= ' -E '; $iter = '1'; -$rrd_options .= " COMMENT:'".str_pad($unit_long, $descr_len)." Cur Min Max\\n'"; +$rrd_options .= " COMMENT:'$unit_long Cur Min Max\\n'"; foreach (dbFetchRows('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND `device_id` = ? ORDER BY `sensor_index`', array($class, $device['device_id'])) as $sensor) { // FIXME generic colour function @@ -46,7 +40,7 @@ foreach (dbFetchRows('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND `devi break; }//end switch - $sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], $descr_len), 0, $descr_len); + $sensor['sensor_descr_fixed'] = rrdtool_escape($sensor['sensor_descr'], 12); $rrd_file = get_sensor_rrd($device, $sensor); $rrd_options .= ' DEF:sensor'.$sensor['sensor_id']."=$rrd_file:sensor:AVERAGE "; $rrd_options .= ' LINE1:sensor'.$sensor['sensor_id'].'#'.$colour.":'".str_replace(':', '\:', str_replace('\*', '*', $sensor['sensor_descr_fixed']))."'"; diff --git a/html/includes/graphs/generic_multi_line.inc.php b/html/includes/graphs/generic_multi_line.inc.php index 1ef4c316a2..6366377187 100644 --- a/html/includes/graphs/generic_multi_line.inc.php +++ b/html/includes/graphs/generic_multi_line.inc.php @@ -19,28 +19,14 @@ require 'includes/graphs/common.inc.php'; -if ($width > '500') { - $descr_len = 24; -} else { - $descr_len = 12; - $descr_len += round(($width - 250) / 8); -} +$descr_len = 12; if ($nototal) { $descr_len += '2'; $unitlen += '2'; } -if ($width > '500') { - $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))."Now Min Max Avg\l'"; - if (!$nototal) { - $rrd_options .= " COMMENT:'Total '"; - } - - $rrd_options .= " COMMENT:'\l'"; -} else { - $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))."Now Min Max Avg\l'"; -} +$rrd_options .= " COMMENT:'".rrdtool_escape($unit_text, $descr_len)." Now Min Max Avg\l'"; $i = 0; $iter = 0; diff --git a/html/includes/graphs/generic_multi_simplex_seperated.inc.php b/html/includes/graphs/generic_multi_simplex_seperated.inc.php index 242156a32d..7985b3d056 100644 --- a/html/includes/graphs/generic_multi_simplex_seperated.inc.php +++ b/html/includes/graphs/generic_multi_simplex_seperated.inc.php @@ -2,31 +2,14 @@ require 'includes/graphs/common.inc.php'; -if ($width > '500') { - $descr_len = 24; - // FIXME may even be more imo? -} else { - $descr_len = 12; - $descr_len += round(($width - 250) / 8); -} +$descr_len = 12; if ($nototal) { $descr_len += '2'; $unitlen += '2'; } -$unit_text = str_pad(truncate($unit_text, $unitlen), $unitlen); - -if ($width > '500') { - $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))."Now Min Max Avg\l'"; - if (!$nototal) { - $rrd_options .= " COMMENT:'Total '"; - } - - $rrd_options .= " COMMENT:'\l'"; -} else { - $rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))."Now Min Max Avg\l'"; -} +$rrd_options .= " COMMENT:'".rrdtool_escape($unit_text, $descr_len)." Now Min Max Avg\l'"; $unitlen = '10'; if ($nototal) { diff --git a/includes/rrdtool.inc.php b/includes/rrdtool.inc.php index 9161f84ddf..8d7214d5ac 100644 --- a/includes/rrdtool.inc.php +++ b/includes/rrdtool.inc.php @@ -275,7 +275,6 @@ function rrdtool_escape($string, $length = null) { $result = shorten_interface_type($string); $result = str_replace("'", '', $result); # remove quotes - $result = str_replace('%', '%%', $result); # double percent signs if (is_numeric($length)) { $extra = substr_count($string, ':', 0, $length); $result = substr(str_pad($result, $length), 0, ($length + $extra));