From 9d2fdf3a38e3daf34e9c80a78f5ccddc67db02a8 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Wed, 3 Sep 2008 20:04:34 +0000 Subject: [PATCH] nice fixes! :D git-svn-id: http://www.observium.org/svn/observer/trunk@247 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/graph.php | 9 +++ html/pages/device/blocks/netstats.inc.php | 17 ++++++ html/pages/device/blocks/uptime.inc.php | 8 +++ html/pages/device/dev-graphs.inc | 67 +++++++++++++---------- includes/graphing.php | 63 +++++++++++++++++++++ includes/graphing/screenos.php | 2 +- poll-device.php | 3 + 7 files changed, 138 insertions(+), 31 deletions(-) create mode 100644 html/pages/device/blocks/netstats.inc.php create mode 100644 html/pages/device/blocks/uptime.inc.php diff --git a/html/graph.php b/html/graph.php index ffd7ca997..2bbe53006 100644 --- a/html/graph.php +++ b/html/graph.php @@ -65,6 +65,15 @@ case 'multi_bits': $graph = graph_multi_bits ($_GET['interfaces'], $graphfile, $from, $to, $width, $height); break; + case 'adsl_rate': + $graph = graph_adsl_rate ($hostname. "/adsl-4.rrd", $graphfile, $from, $to, $width, $height); + break; + case 'adsl_snr': + $graph = graph_adsl_snr ($hostname. "/adsl-4.rrd", $graphfile, $from, $to, $width, $height); + break; + case 'adsl_atn': + $graph = graph_adsl_atn ($hostname. "/adsl-4.rrd", $graphfile, $from, $to, $width, $height); + break; case 'global_bits': $graph = graph_global_bits ("global_bits.png", $from, $to, $width, $height); break; diff --git a/html/pages/device/blocks/netstats.inc.php b/html/pages/device/blocks/netstats.inc.php new file mode 100644 index 000000000..633d179a7 --- /dev/null +++ b/html/pages/device/blocks/netstats.inc.php @@ -0,0 +1,17 @@ +IP Statistics"); + $graph_type = "ip_graph"; include ("includes/print-device-graph.php"); + echo("
"); + echo("
TCP Statistics
"); + $graph_type = "tcp_graph"; include ("includes/print-device-graph.php"); + echo("
"); + echo("
UDP Statistics
"); + $graph_type = "udp_graph"; include ("includes/print-device-graph.php"); + echo("
"); + echo("
ICMP Statistics
"); + $graph_type = "icmp_graph"; include ("includes/print-device-graph.php"); + echo("
"); + + +?> diff --git a/html/pages/device/blocks/uptime.inc.php b/html/pages/device/blocks/uptime.inc.php new file mode 100644 index 000000000..db16d4757 --- /dev/null +++ b/html/pages/device/blocks/uptime.inc.php @@ -0,0 +1,8 @@ +Device Uptime"); + $graph_type = "uptime"; include ("includes/print-device-graph.php"); + echo("
"); + + +?> diff --git a/html/pages/device/dev-graphs.inc b/html/pages/device/dev-graphs.inc index 8c70688b1..46b50e9cc 100644 --- a/html/pages/device/dev-graphs.inc +++ b/html/pages/device/dev-graphs.inc @@ -16,6 +16,10 @@ while($device = mysql_fetch_array($device_query)) { $graph_type = "dev_temp"; include ("includes/print-device-graph.php"); echo("
"); } + + include("blocks/netstats.inc.php"); + include("blocks/uptime.inc.php"); + break; @@ -26,6 +30,26 @@ while($device = mysql_fetch_array($device_query)) { $graph_type = "fortigate_memory"; include ("includes/print-device-graph.php"); echo("
Firewall Sessions
"); $graph_type = "fortigate_sessions"; include ("includes/print-device-graph.php"); + + include("blocks/netstats.inc.php"); + include("blocks/uptime.inc.php"); + + break; + + case "BCM96348": + echo("
ADSL Attainable Rate
"); + $graph_type = "adsl_rate"; include ("includes/print-device-graph.php"); + echo("
"); + echo("
ADSL Signal-to-Noise Margin
"); + $graph_type = "adsl_snr"; include ("includes/print-device-graph.php"); + echo("
"); + echo("
ADSL Attenuation
"); + $graph_type = "adsl_atn"; include ("includes/print-device-graph.php"); + echo("
"); + + include("blocks/netstats.inc.php"); + include("blocks/uptime.inc.php"); + break; case "ScreenOS": @@ -35,6 +59,11 @@ while($device = mysql_fetch_array($device_query)) { $graph_type = "netscreen_memory"; include ("includes/print-device-graph.php"); echo("
Firewall Sessions
"); $graph_type = "netscreen_sessions"; include ("includes/print-device-graph.php"); + + + include("blocks/netstats.inc.php"); + include("blocks/uptime.inc.php"); + break; case "ProCurve": @@ -99,18 +128,10 @@ while($device = mysql_fetch_array($device_query)) { $graph_type = "dev_temp"; include ("includes/print-device-graph.php"); echo("
"); } - echo("
IP Statistics
"); - $graph_type = "ip_graph"; include ("includes/print-device-graph.php"); - echo("
"); - echo("
TCP Statistics
"); - $graph_type = "tcp_graph"; include ("includes/print-device-graph.php"); - echo("
"); - echo("
UDP Statistics
"); - $graph_type = "udp_graph"; include ("includes/print-device-graph.php"); - echo("
"); - echo("
ICMP Statistics
"); - $graph_type = "icmp_graph"; include ("includes/print-device-graph.php"); - echo("
"); + + include("blocks/netstats.inc.php"); + include("blocks/uptime.inc.php"); + echo("
System Load
"); $graph_type = "load"; include ("includes/print-device-graph.php"); echo("
"); @@ -141,9 +162,6 @@ while($device = mysql_fetch_array($device_query)) { $graph_type = "apachebits"; include ("includes/print-device-graph.php"); echo("
"); } - echo("
Device Uptime
"); - $graph_type = "uptime"; include ("includes/print-device-graph.php"); - echo("
"); break; case "IOS": echo("
CPU Usage
"); @@ -157,21 +175,10 @@ while($device = mysql_fetch_array($device_query)) { $graph_type = "dev_temp"; include ("includes/print-device-graph.php"); echo("
"); } - echo("
IP Statistics
"); - $graph_type = "ip_graph"; include ("includes/print-device-graph.php"); - echo("
"); - echo("
TCP Statistics
"); - $graph_type = "tcp_graph"; include ("includes/print-device-graph.php"); - echo("
"); - echo("
UDP Statistics
"); - $graph_type = "udp_graph"; include ("includes/print-device-graph.php"); - echo("
"); - echo("
ICMP Statistics
"); - $graph_type = "icmp_graph"; include ("includes/print-device-graph.php"); - echo("
"); - echo("
Uptime
"); - $graph_type = "uptime"; include ("includes/print-device-graph.php"); - break; + + include("blocks/netstats.inc.php"); + include("blocks/uptime.inc.php"); + case "Snom": echo("
Calls
"); $graph_type = "calls"; include ("includes/print-device-graph.php"); diff --git a/includes/graphing.php b/includes/graphing.php index 8facc7ff7..6e058b6f4 100644 --- a/includes/graphing.php +++ b/includes/graphing.php @@ -331,6 +331,69 @@ function graph_cpu_generic_single ($rrd, $graph , $from, $to, $width, $height) { } +function graph_adsl_rate ($rrd, $graph, $from, $to, $width, $height) { + global $config, $installdir; + $database = $config['rrd_dir'] . "/" . $rrd; + $imgfile = "graphs/" . "$graph"; + $options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height "; + if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } + $options .= " DEF:adslAtucCurrAtt=$database:adslAtucCurrAtt:AVERAGE"; + $options .= " DEF:adslAturCurrAtt=$database:adslAturCurrAtt:AVERAGE"; + $options .= " CDEF:dslAtucCurrAtt=adslAtucCurrAtt,1000,/"; + $options .= " CDEF:dslAturCurrAtt=adslAturCurrAtt,1000,/"; + $options .= " COMMENT:Bytes\ \ \ \ \ Current\ \ Minimum\ \ Maximum\ \ Average\\\\n"; + $options .= " LINE1.25:adslAtucCurrAtt#aa2200:Up\ \ \ \ "; + $options .= " GPRINT:dslAtucCurrAtt:LAST:%5.0lfk\ GPRINT:dslAtucCurrAtt:AVERAGE:%5.0lfk\ "; + $options .= " GPRINT:dslAtucCurrAtt:MAX:%5.0lfk\ GPRINT:dslAtucCurrAtt:AVERAGE:%5.0lfk\\\\n"; + $options .= " LINE1.25:adslAturCurrAtt#22aa00:Down\ \ "; + $options .= " GPRINT:dslAturCurrAtt:LAST:%5.0lfk\ GPRINT:dslAturCurrAtt:AVERAGE:%5.0lfk\ "; + $options .= " GPRINT:dslAturCurrAtt:MAX:%5.0lfk\ GPRINT:dslAturCurrAtt:AVERAGE:%5.0lfk\\\\n"; + $thing = shell_exec($config['rrdtool'] . " graph $imgfile $options"); + return $imgfile; +} + +function graph_adsl_snr ($rrd, $graph, $from, $to, $width, $height) { + global $config, $installdir; + $database = $config['rrd_dir'] . "/" . $rrd; + $imgfile = "graphs/" . "$graph"; + $options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height "; + if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } + $options .= " DEF:adslAtucCurrSnr=$database:adslAtucCurrSnr:AVERAGE"; + $options .= " DEF:adslAturCurrSnr=$database:adslAturCurrSnr:AVERAGE"; + $options .= " CDEF:dslAtucCurrSnr=adslAtucCurrSnr,10,/"; + $options .= " CDEF:dslAturCurrSnr=adslAturCurrSnr,10,/"; + $options .= " COMMENT:\ \ \ \ \ \ \ \ \ \ Current\ \ Minimum\ \ Maximum\ \ Average\\\\n"; + $options .= " LINE1.25:dslAtucCurrSnr#aa2200:SNR\ Up\ \ "; + $options .= " GPRINT:dslAtucCurrSnr:LAST:%3.1lfdB GPRINT:dslAtucCurrSnr:AVERAGE:%3.1lfdB\ "; + $options .= " GPRINT:dslAtucCurrSnr:MAX:%3.1lfdB GPRINT:dslAtucCurrSnr:AVERAGE:%3.1lfdB\\\\n"; + $options .= " LINE1.25:dslAturCurrSnr#22aa00:SNR\ Down"; + $options .= " GPRINT:dslAturCurrSnr:LAST:%3.1lfdB GPRINT:dslAturCurrSnr:AVERAGE:%3.1lfdB\ "; + $options .= " GPRINT:dslAturCurrSnr:MAX:%3.1lfdB GPRINT:dslAturCurrSnr:AVERAGE:%3.1lfdB\\\\n"; + $thing = shell_exec($config['rrdtool'] . " graph $imgfile $options"); + return $imgfile; +} + +function graph_adsl_atn ($rrd, $graph, $from, $to, $width, $height) { + global $config, $installdir; + $database = $config['rrd_dir'] . "/" . $rrd; + $imgfile = "graphs/" . "$graph"; + $options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height "; + if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } + $options .= " DEF:adslAtucCurrAtn=$database:adslAtucCurrAtn:AVERAGE"; + $options .= " DEF:adslAturCurrAtn=$database:adslAturCurrAtn:AVERAGE"; + $options .= " CDEF:dslAtucCurrAtn=adslAtucCurrAtn,10,/"; + $options .= " CDEF:dslAturCurrAtn=adslAturCurrAtn,10,/"; + $options .= " COMMENT:\ \ \ \ \ \ \ \ \ \ Current\ \ Minimum\ \ Maximum\ \ Average\\\\n"; + $options .= " LINE1.25:dslAtucCurrAtn#aa2200:Atten\ Up\ \ "; + $options .= " GPRINT:dslAtucCurrAtn:LAST:%3.1lfdB GPRINT:dslAtucCurrAtn:AVERAGE:%3.1lfdb"; + $options .= " GPRINT:dslAtucCurrAtn:MAX:%3.1lfdB GPRINT:dslAtucCurrAtn:AVERAGE:%3.1lfdb\\\\n"; + $options .= " LINE1.25:dslAturCurrAtn#22aa00:Atten\ Down"; + $options .= " GPRINT:dslAturCurrAtn:LAST:%3.1lfdB GPRINT:dslAturCurrAtn:AVERAGE:%3.1lfdb"; + $options .= " GPRINT:dslAturCurrAtn:MAX:%3.1lfdB GPRINT:dslAturCurrAtn:AVERAGE:%3.1lfdb\\\\n"; + $thing = shell_exec($config['rrdtool'] . " graph $imgfile $options"); + return $imgfile; +} + function cpugraph ($rrd, $graph , $from, $to, $width, $height) { global $config, $installdir; $database = $config['rrd_dir'] . "/" . $rrd; diff --git a/includes/graphing/screenos.php b/includes/graphing/screenos.php index ae93603f6..a3ad7fda7 100644 --- a/includes/graphing/screenos.php +++ b/includes/graphing/screenos.php @@ -30,7 +30,7 @@ function graph_netscreen_cpu ($rrd, $graph, $from, $to, $width, $height, $title, $options .= " DEF:av=$database:average:AVERAGE"; $options .= " DEF:5m=$database:5min:AVERAGE"; $options .= " COMMENT:Usage\ \ \ \ \ \ \ Current\ \ \ \ \ Average\ \ \ \ Maximum\\\\n"; - $options .= " AREA:5m#ffcccc"; + $options .= " AREA:5m#ffeeaa"; $options .= " LINE1.25:5m#aa2000:5min"; $options .= " GPRINT:5m:LAST:\ \ \ \ \ %5.2lf%%"; $options .= " GPRINT:5m:AVERAGE:\ \ \ %5.2lf%%"; diff --git a/poll-device.php b/poll-device.php index 9b6b9a01b..3fa2fd27e 100755 --- a/poll-device.php +++ b/poll-device.php @@ -179,6 +179,9 @@ while ($device = mysql_fetch_array($device_query)) { } include("includes/polling/device-procurve.inc.php"); break; + case "BCM96348": + include("includes/polling/adslline.inc.php"); + break; case "Snom": include("includes/polling/device-snom.inc.php"); break;