From e1db733590f72a408d2f82debe97ca0694c9bfb4 Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Thu, 17 Mar 2011 13:25:37 +0000 Subject: [PATCH] port graphs cleanup git-svn-id: http://www.observium.org/svn/observer/trunk@1905 61d68cd4-352d-0410-923a-c4978735b2b8 --- .../graphs/port/adsl_attainable.inc.php | 5 +- .../graphs/port/adsl_attenuation.inc.php | 5 +- html/includes/graphs/port/adsl_power.inc.php | 5 +- html/includes/graphs/port/adsl_snr.inc.php | 5 +- html/includes/graphs/port/adsl_speed.inc.php | 5 +- html/includes/graphs/port/auth.inc.php | 8 +- html/includes/graphs/port/bits.inc.php | 2 +- html/includes/graphs/port/errors.inc.php | 4 +- html/includes/graphs/port/etherlike.inc.php | 17 +-- html/includes/graphs/port/fanspeed.inc.php | 20 +-- .../includes/graphs/port/mac_acc_bits.inc.php | 7 +- .../includes/graphs/port/mac_acc_pkts.inc.php | 7 +- .../graphs/port/mac_acc_total.inc.php | 134 ++++++++++-------- html/includes/graphs/port/nupkts.inc.php | 11 +- html/includes/graphs/port/pagp_bits.inc.php | 18 +-- html/includes/graphs/port/upkts.inc.php | 2 +- 16 files changed, 136 insertions(+), 119 deletions(-) diff --git a/html/includes/graphs/port/adsl_attainable.inc.php b/html/includes/graphs/port/adsl_attainable.inc.php index 684f3f21c..a8e6eb0db 100644 --- a/html/includes/graphs/port/adsl_attainable.inc.php +++ b/html/includes/graphs/port/adsl_attainable.inc.php @@ -20,8 +20,9 @@ $scale_min = "0"; $nototal = 1; -if ($rrd_list) { +if ($rrd_list) +{ include ("includes/graphs/generic_multi_line.inc.php"); } -?> +?> \ No newline at end of file diff --git a/html/includes/graphs/port/adsl_attenuation.inc.php b/html/includes/graphs/port/adsl_attenuation.inc.php index b9fddb80a..9ded41958 100644 --- a/html/includes/graphs/port/adsl_attenuation.inc.php +++ b/html/includes/graphs/port/adsl_attenuation.inc.php @@ -20,8 +20,9 @@ $scale_min = "0"; $nototal = 1; -if ($rrd_list) { +if ($rrd_list) +{ include ("includes/graphs/generic_multi_line.inc.php"); } -?> +?> \ No newline at end of file diff --git a/html/includes/graphs/port/adsl_power.inc.php b/html/includes/graphs/port/adsl_power.inc.php index 89756b14e..8385c5930 100644 --- a/html/includes/graphs/port/adsl_power.inc.php +++ b/html/includes/graphs/port/adsl_power.inc.php @@ -20,8 +20,9 @@ $scale_min = "0"; $nototal = 1; -if ($rrd_list) { +if ($rrd_list) +{ include ("includes/graphs/generic_multi_line.inc.php"); } -?> +?> \ No newline at end of file diff --git a/html/includes/graphs/port/adsl_snr.inc.php b/html/includes/graphs/port/adsl_snr.inc.php index f20364e36..c55497807 100644 --- a/html/includes/graphs/port/adsl_snr.inc.php +++ b/html/includes/graphs/port/adsl_snr.inc.php @@ -20,8 +20,9 @@ $scale_min = "0"; $nototal = 1; -if ($rrd_list) { +if ($rrd_list) +{ include ("includes/graphs/generic_multi_line.inc.php"); } -?> +?> \ No newline at end of file diff --git a/html/includes/graphs/port/adsl_speed.inc.php b/html/includes/graphs/port/adsl_speed.inc.php index 7641825a9..6f8f72889 100644 --- a/html/includes/graphs/port/adsl_speed.inc.php +++ b/html/includes/graphs/port/adsl_speed.inc.php @@ -21,8 +21,9 @@ $scale_min = "0"; $nototal = 1; -if ($rrd_list) { +if ($rrd_list) +{ include ("includes/graphs/generic_multi_line.inc.php"); } -?> +?> \ No newline at end of file diff --git a/html/includes/graphs/port/auth.inc.php b/html/includes/graphs/port/auth.inc.php index ce0322ddf..0a5ecdd30 100644 --- a/html/includes/graphs/port/auth.inc.php +++ b/html/includes/graphs/port/auth.inc.php @@ -1,14 +1,14 @@ +?> \ No newline at end of file diff --git a/html/includes/graphs/port/bits.inc.php b/html/includes/graphs/port/bits.inc.php index 17aaff5ac..8966d1882 100644 --- a/html/includes/graphs/port/bits.inc.php +++ b/html/includes/graphs/port/bits.inc.php @@ -5,4 +5,4 @@ $rra_out = "OUTOCTETS"; include("includes/graphs/generic_bits.inc.php"); -?> +?> \ No newline at end of file diff --git a/html/includes/graphs/port/errors.inc.php b/html/includes/graphs/port/errors.inc.php index 22809f623..0c8ea2e47 100644 --- a/html/includes/graphs/port/errors.inc.php +++ b/html/includes/graphs/port/errors.inc.php @@ -25,6 +25,6 @@ $colours_out = 'blues'; $nototal = 1; -include ("includes/graphs/generic_multi_seperated.inc.php"); +include("includes/graphs/generic_multi_seperated.inc.php"); -?> +?> \ No newline at end of file diff --git a/html/includes/graphs/port/etherlike.inc.php b/html/includes/graphs/port/etherlike.inc.php index 86173e268..073dae197 100644 --- a/html/includes/graphs/port/etherlike.inc.php +++ b/html/includes/graphs/port/etherlike.inc.php @@ -7,10 +7,13 @@ $oids = array('dot3StatsAlignmentErrors', 'dot3StatsFCSErrors', 'dot3StatsSingle 'dot3StatsInternalMacTransmitErrors', 'dot3StatsCarrierSenseErrors', 'dot3StatsFrameTooLongs', 'dot3StatsInternalMacReceiveErrors', 'dot3StatsSymbolErrors'); -$i=0; +$i = 0; $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("port-" . $port['ifIndex'] . "-dot3.rrd"); -if(is_file($rrd_filename)) { - foreach($oids as $oid){ + +if (is_file($rrd_filename)) +{ + foreach ($oids as $oid) + { $oid = str_replace("dot3Stats", "", $oid); $oid_rra = truncate($oid, 19, ''); $rrd_list[$i]['filename'] = $rrd_filename; @@ -18,14 +21,12 @@ if(is_file($rrd_filename)) { $rrd_list[$i]['rra'] = $oid_rra; $i++; } -} else {echo("file missing: $file"); } +} else { echo("file missing: $file"); } $colours = "mixed"; $nototal = 1; $unit_text = "Errors"; -include ("includes/graphs/generic_multi_simplex_seperated.inc.php"); +include("includes/graphs/generic_multi_simplex_seperated.inc.php"); - - -?> +?> \ No newline at end of file diff --git a/html/includes/graphs/port/fanspeed.inc.php b/html/includes/graphs/port/fanspeed.inc.php index e47194136..7f61095d8 100644 --- a/html/includes/graphs/port/fanspeed.inc.php +++ b/html/includes/graphs/port/fanspeed.inc.php @@ -4,19 +4,19 @@ $scale_min = "0"; include("includes/graphs/common.inc.php"); - $rrd_options .= " COMMENT:' Last Max\\n'"; +$rrd_options .= " COMMENT:' Last Max\\n'"; - $fanspeed = mysql_fetch_array(mysql_query("SELECT * FROM sensors WHERE sensor_class='fanspeed' AND sensor_id = '".mres($_GET['id'])."'")); +$fanspeed = mysql_fetch_array(mysql_query("SELECT * FROM sensors WHERE sensor_class='fanspeed' AND sensor_id = '".mres($_GET['id'])."'")); - $hostname = mysql_result(mysql_query("SELECT hostname FROM devices WHERE device_id = '" . $fanspeed['device_id'] . "'"),0); +$hostname = mysql_result(mysql_query("SELECT hostname FROM devices WHERE device_id = '" . $fanspeed['device_id'] . "'"),0); - $fanspeed['sensor_descr_fixed'] = substr(str_pad($fanspeed['sensor_descr'], 20),0,20); +$fanspeed['sensor_descr_fixed'] = substr(str_pad($fanspeed['sensor_descr'], 20),0,20); - $rrd_filename = $config['rrd_dir'] . "/".$hostname."/" . safename("fan-" . $fanspeed['sensor_descr'] . ".rrd"); +$rrd_filename = $config['rrd_dir'] . "/".$hostname."/" . safename("fan-" . $fanspeed['sensor_descr'] . ".rrd"); - $rrd_options .= " DEF:fan=$rrd_filename:fan:AVERAGE"; - $rrd_options .= " LINE1.5:fan#cc0000:'" . str_replace(':','\:',str_replace('\*','*',quotemeta($fanspeed['sensor_descr_fixed'])))."'"; # Ugly hack :( - $rrd_options .= " GPRINT:fan:LAST:%3.0lfrpm"; - $rrd_options .= " GPRINT:fan:MAX:%3.0lfrpm\\\\l"; +$rrd_options .= " DEF:fan=$rrd_filename:fan:AVERAGE"; +$rrd_options .= " LINE1.5:fan#cc0000:'" . str_replace(':','\:',str_replace('\*','*',quotemeta($fanspeed['sensor_descr_fixed'])))."'"; # Ugly hack :( +$rrd_options .= " GPRINT:fan:LAST:%3.0lfrpm"; +$rrd_options .= " GPRINT:fan:MAX:%3.0lfrpm\\\\l"; -?> +?> \ No newline at end of file diff --git a/html/includes/graphs/port/mac_acc_bits.inc.php b/html/includes/graphs/port/mac_acc_bits.inc.php index ab088b9ee..8ca181d0e 100644 --- a/html/includes/graphs/port/mac_acc_bits.inc.php +++ b/html/includes/graphs/port/mac_acc_bits.inc.php @@ -1,10 +1,11 @@ +?> \ No newline at end of file diff --git a/html/includes/graphs/port/mac_acc_pkts.inc.php b/html/includes/graphs/port/mac_acc_pkts.inc.php index 1648ed022..e48bba24e 100644 --- a/html/includes/graphs/port/mac_acc_pkts.inc.php +++ b/html/includes/graphs/port/mac_acc_pkts.inc.php @@ -1,10 +1,11 @@ +?> \ No newline at end of file diff --git a/html/includes/graphs/port/mac_acc_total.inc.php b/html/includes/graphs/port/mac_acc_total.inc.php index 1647d551a..8c6729507 100644 --- a/html/includes/graphs/port/mac_acc_total.inc.php +++ b/html/includes/graphs/port/mac_acc_total.inc.php @@ -1,73 +1,84 @@ +$rrd_options .= $rrd_optionsb; +$rrd_options .= " HRULE:0#999999"; + +?> \ No newline at end of file diff --git a/html/includes/graphs/port/nupkts.inc.php b/html/includes/graphs/port/nupkts.inc.php index da23fbbc9..389dbf8dd 100644 --- a/html/includes/graphs/port/nupkts.inc.php +++ b/html/includes/graphs/port/nupkts.inc.php @@ -1,8 +1,8 @@ +?> \ No newline at end of file diff --git a/html/includes/graphs/port/pagp_bits.inc.php b/html/includes/graphs/port/pagp_bits.inc.php index 249abb073..1e45b1418 100644 --- a/html/includes/graphs/port/pagp_bits.inc.php +++ b/html/includes/graphs/port/pagp_bits.inc.php @@ -5,18 +5,20 @@ $query = mysql_query("SELECT * FROM `ports` WHERE `device_id` = '".$port['device_id']."' AND `pagpGroupIfIndex` = '".$port['ifIndex']."'"); $i=0; -while($int = mysql_fetch_array($query)) { - if(is_file($config['rrd_dir'] . "/" . $hostname . "/port-" . safename($int['ifIndex'] . ".rrd"))) { +while ($int = mysql_fetch_array($query)) +{ + if (is_file($config['rrd_dir'] . "/" . $hostname . "/port-" . safename($int['ifIndex'] . ".rrd"))) + { $rrd_list[$i]['filename'] = $config['rrd_dir'] . "/" . $hostname . "/port-" . safename($int['ifIndex'] . ".rrd"); $rrd_list[$i]['descr'] = $int['ifDescr']; $i++; } } -$units='bps'; -$total_units='B'; -$colours_in='greens'; -$multiplier = "8"; +$units='bps'; +$total_units='B'; +$colours_in='greens'; +$multiplier = "8"; $colours_out = 'blues'; $nototal = 1; @@ -25,6 +27,4 @@ $rra_out = "OUTOCTETS"; include ("includes/graphs/generic_multi_bits_separated.inc.php"); - - -?> +?> \ No newline at end of file diff --git a/html/includes/graphs/port/upkts.inc.php b/html/includes/graphs/port/upkts.inc.php index 68a740595..6dddc6d46 100644 --- a/html/includes/graphs/port/upkts.inc.php +++ b/html/includes/graphs/port/upkts.inc.php @@ -16,4 +16,4 @@ $unit_text = "Packets"; include("includes/graphs/generic_duplex.inc.php"); -?> +?> \ No newline at end of file