From ee65ae53503a7cbeca516a8255dbccad3c53c4b9 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Fri, 20 Apr 2012 10:35:13 +0000 Subject: [PATCH] add previous period overlay to generic_bits/bytes and generic_duplex git-svn-id: http://www.observium.org/svn/observer/trunk@3063 61d68cd4-352d-0410-923a-c4978735b2b8 --- .../graphs/application/drbd_disk_bits.inc.php | 3 +- .../application/drbd_network_bits.inc.php | 2 +- .../application/mysql_network_traffic.inc.php | 2 +- .../graphs/application/shoutcast_bits.inc.php | 2 +- html/includes/graphs/atmvp/bits.inc.php | 2 +- .../graphs/device/cipsec_flow_bits.inc.php | 4 +- .../graphs/device/netscaler_tcp_bits.inc.php | 2 +- html/includes/graphs/device/ucd_io.inc.php | 4 +- .../graphs/device/ucd_swap_io.inc.php | 4 +- html/includes/graphs/diskio/bits.inc.php | 6 +- html/includes/graphs/generic_bytes.inc.php | 62 ------------------- ...eric_bits.inc.php => generic_data.inc.php} | 39 +++++++----- html/includes/graphs/generic_duplex.inc.php | 47 ++++++++++++-- html/includes/graphs/ipsectunnel/bits.inc.php | 4 +- .../graphs/macaccounting/bits.inc.php | 2 +- .../graphs/netscalervsvr/bits.inc.php | 2 +- html/includes/graphs/port/bits.inc.php | 4 +- html/includes/graphs/rserver/curr.inc.php | 15 ----- html/includes/graphs/vserver/bits.inc.php | 6 +- 19 files changed, 92 insertions(+), 120 deletions(-) delete mode 100644 html/includes/graphs/generic_bytes.inc.php rename html/includes/graphs/{generic_bits.inc.php => generic_data.inc.php} (82%) diff --git a/html/includes/graphs/application/drbd_disk_bits.inc.php b/html/includes/graphs/application/drbd_disk_bits.inc.php index a91e8241e..767246ce8 100755 --- a/html/includes/graphs/application/drbd_disk_bits.inc.php +++ b/html/includes/graphs/application/drbd_disk_bits.inc.php @@ -15,7 +15,8 @@ $ds_in = "dr"; $ds_out = "dw"; $multiplier = "8"; +$format = "bytes"; -include("includes/graphs/generic_bits.inc.php"); +include("includes/graphs/generic_data.inc.php"); ?> diff --git a/html/includes/graphs/application/drbd_network_bits.inc.php b/html/includes/graphs/application/drbd_network_bits.inc.php index 133f87645..37c1d9db0 100755 --- a/html/includes/graphs/application/drbd_network_bits.inc.php +++ b/html/includes/graphs/application/drbd_network_bits.inc.php @@ -16,6 +16,6 @@ $ds_out = "ns"; $multiplier = "8"; -include("includes/graphs/generic_bits.inc.php"); +include("includes/graphs/generic_data.inc.php"); ?> diff --git a/html/includes/graphs/application/mysql_network_traffic.inc.php b/html/includes/graphs/application/mysql_network_traffic.inc.php index 171a2d9b1..d606a1cdd 100644 --- a/html/includes/graphs/application/mysql_network_traffic.inc.php +++ b/html/includes/graphs/application/mysql_network_traffic.inc.php @@ -14,6 +14,6 @@ $multiplier = 8; $ds_in = "BRd"; $ds_out = "BSt"; -include("includes/graphs/generic_bits.inc.php"); +include("includes/graphs/generic_data.inc.php"); ?> diff --git a/html/includes/graphs/application/shoutcast_bits.inc.php b/html/includes/graphs/application/shoutcast_bits.inc.php index d695ca169..e1ac058d8 100644 --- a/html/includes/graphs/application/shoutcast_bits.inc.php +++ b/html/includes/graphs/application/shoutcast_bits.inc.php @@ -22,6 +22,6 @@ $rrddir = $config['rrd_dir']."/".$device['hostname']; $hostname = (isset($_GET['hostname']) ? $_GET['hostname'] : "unkown"); $rrd_filename = $rrddir."/app-shoutcast-".$app['app_id']."-".$hostname.".rrd"; -include("includes/graphs/generic_bits.inc.php"); +include("includes/graphs/generic_data.inc.php"); ?> diff --git a/html/includes/graphs/atmvp/bits.inc.php b/html/includes/graphs/atmvp/bits.inc.php index a0d4671b6..a571ec7ed 100644 --- a/html/includes/graphs/atmvp/bits.inc.php +++ b/html/includes/graphs/atmvp/bits.inc.php @@ -3,6 +3,6 @@ $ds_in = "inpacketoctets"; $ds_out = "outpacketoctets"; -include("includes/graphs/generic_bits.inc.php"); +include("includes/graphs/generic_data.inc.php"); ?> diff --git a/html/includes/graphs/device/cipsec_flow_bits.inc.php b/html/includes/graphs/device/cipsec_flow_bits.inc.php index e645bd556..7d19dafbb 100644 --- a/html/includes/graphs/device/cipsec_flow_bits.inc.php +++ b/html/includes/graphs/device/cipsec_flow_bits.inc.php @@ -5,6 +5,6 @@ $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/cipsec_flow.r $ds_in = "InOctets"; $ds_out = "OutOctets"; -include("includes/graphs/generic_bits.inc.php"); +include("includes/graphs/generic_data.inc.php"); -?> \ No newline at end of file +?> diff --git a/html/includes/graphs/device/netscaler_tcp_bits.inc.php b/html/includes/graphs/device/netscaler_tcp_bits.inc.php index f5696eb29..c2bfa177f 100644 --- a/html/includes/graphs/device/netscaler_tcp_bits.inc.php +++ b/html/includes/graphs/device/netscaler_tcp_bits.inc.php @@ -7,6 +7,6 @@ $ds_out = "TotTxBytes"; $multiplier = 8; -include("includes/graphs/generic_bits.inc.php"); +include("includes/graphs/generic_data.inc.php"); ?> diff --git a/html/includes/graphs/device/ucd_io.inc.php b/html/includes/graphs/device/ucd_io.inc.php index f44f6f0b4..0a733f5bb 100644 --- a/html/includes/graphs/device/ucd_io.inc.php +++ b/html/includes/graphs/device/ucd_io.inc.php @@ -7,6 +7,6 @@ $ds_out = "value"; $multiplier = 512; -include("includes/graphs/generic_bits.inc.php"); +include("includes/graphs/generic_data.inc.php"); -?> \ No newline at end of file +?> diff --git a/html/includes/graphs/device/ucd_swap_io.inc.php b/html/includes/graphs/device/ucd_swap_io.inc.php index 7fef57615..6697ac8ae 100644 --- a/html/includes/graphs/device/ucd_swap_io.inc.php +++ b/html/includes/graphs/device/ucd_swap_io.inc.php @@ -7,6 +7,6 @@ $ds_out = "value"; $multiplier = 512; -include("includes/graphs/generic_bits.inc.php"); +include("includes/graphs/generic_data.inc.php"); -?> \ No newline at end of file +?> diff --git a/html/includes/graphs/diskio/bits.inc.php b/html/includes/graphs/diskio/bits.inc.php index a38ae877f..c61bf6d89 100644 --- a/html/includes/graphs/diskio/bits.inc.php +++ b/html/includes/graphs/diskio/bits.inc.php @@ -3,6 +3,8 @@ $ds_in = "read"; $ds_out = "written"; -include("includes/graphs/generic_bytes.inc.php"); +$format = "bytes"; -?> \ No newline at end of file +include("includes/graphs/generic_data.inc.php"); + +?> diff --git a/html/includes/graphs/generic_bytes.inc.php b/html/includes/graphs/generic_bytes.inc.php deleted file mode 100644 index 86d979ea1..000000000 --- a/html/includes/graphs/generic_bytes.inc.php +++ /dev/null @@ -1,62 +0,0 @@ - diff --git a/html/includes/graphs/generic_bits.inc.php b/html/includes/graphs/generic_data.inc.php similarity index 82% rename from html/includes/graphs/generic_bits.inc.php rename to html/includes/graphs/generic_data.inc.php index c3314b2d4..5652a4e63 100644 --- a/html/includes/graphs/generic_bits.inc.php +++ b/html/includes/graphs/generic_data.inc.php @@ -6,7 +6,6 @@ include("includes/graphs/common.inc.php"); if ($rrd_filename) { $rrd_filename_out = $rrd_filename; $rrd_filename_in = $rrd_filename; } - if ($inverse) { $in = 'out'; $out = 'in'; } else { $in = 'in'; $out = 'out'; } if ($multiplier) @@ -83,22 +82,32 @@ $rrd_options .= " VDEF:95thin=inbits,95,PERCENT"; $rrd_options .= " VDEF:95thout=outbits,95,PERCENT"; $rrd_options .= " VDEF:d95thout=doutbits,5,PERCENT"; +if($format == "octets" || $format == "bytes") +{ + $units = "Bps"; + $format = "octets"; +} else { + $units = "bps"; + $format = "bits"; +} + + $rrd_options .= " COMMENT:'bps Now Ave Max 95th %\\n'"; -$rrd_options .= " AREA:inbits_max#aDEB7B:"; -$rrd_options .= " AREA:inbits#91B13C:'In '"; -#$rrd_options .= " LINE1.25:inbits#006600:'In '"; -$rrd_options .= " GPRINT:inbits:LAST:%6.2lf%s"; -$rrd_options .= " GPRINT:inbits:AVERAGE:%6.2lf%s"; -$rrd_options .= " GPRINT:inbits_max:MAX:%6.2lf%s"; +$rrd_options .= " AREA:in".$format."_max#aDEB7B:"; +$rrd_options .= " AREA:in".$format."#91B13C:'In '"; +#$rrd_options .= " LINE1.25:in".$format."#006600:'In '"; +$rrd_options .= " GPRINT:in".$format.":LAST:%6.2lf%s"; +$rrd_options .= " GPRINT:in".$format.":AVERAGE:%6.2lf%s"; +$rrd_options .= " GPRINT:in".$format."_max:MAX:%6.2lf%s"; $rrd_options .= " GPRINT:95thin:%6.2lf%s\\\\n"; -$rrd_options .= " AREA:doutbits_max#a3b9FF:"; -$rrd_options .= " AREA:doutbits#8080BD:'Out'"; -#$rrd_options .= " LINE1.25:doutbits#000099:Out"; -$rrd_options .= " GPRINT:outbits:LAST:%6.2lf%s"; -$rrd_options .= " GPRINT:outbits:AVERAGE:%6.2lf%s"; -$rrd_options .= " GPRINT:outbits_max:MAX:%6.2lf%s"; +$rrd_options .= " AREA:dout".$format."_max#a3b9FF:"; +$rrd_options .= " AREA:dout".$format."#8080BD:'Out'"; +#$rrd_options .= " LINE1.25:dout".$format."#000099:Out"; +$rrd_options .= " GPRINT:out".$format.":LAST:%6.2lf%s"; +$rrd_options .= " GPRINT:out".$format.":AVERAGE:%6.2lf%s"; +$rrd_options .= " GPRINT:out".$format."_max:MAX:%6.2lf%s"; $rrd_options .= " GPRINT:95thout:%6.2lf%s\\\\n"; if ($config['rrdgraph_real_95th']) { @@ -114,8 +123,8 @@ $rrd_options .= " LINE1:d95thout#aa0000"; if($_GET['previous'] == "yes") { - $rrd_options .= " LINE1.25:inbitsX#009900:'Prev In \\\\n'"; - $rrd_options .= " LINE1.25:doutbitsX#000099:'Prev Out'"; + $rrd_options .= " LINE1.25:in".$format."X#009900:'Prev In \\\\n'"; + $rrd_options .= " LINE1.25:dout".$format."X#000099:'Prev Out'"; } ?> diff --git a/html/includes/graphs/generic_duplex.inc.php b/html/includes/graphs/generic_duplex.inc.php index 7c9ce6fe7..0d726d01b 100644 --- a/html/includes/graphs/generic_duplex.inc.php +++ b/html/includes/graphs/generic_duplex.inc.php @@ -20,30 +20,61 @@ $rrd_options .= " DEF:".$out."=".$rrd_filename.":".$ds_out.":AVERAGE"; $rrd_options .= " DEF:".$in."=".$rrd_filename.":".$ds_in.":AVERAGE"; $rrd_options .= " DEF:".$out."_max=".$rrd_filename.":".$ds_out.":MAX"; $rrd_options .= " DEF:".$in."_max=".$rrd_filename.":".$ds_in.":MAX"; - $rrd_options .= " CDEF:dout_max=out_max,-1,*"; $rrd_options .= " CDEF:dout=out,-1,*"; $rrd_options .= " CDEF:both=in,out,+"; - if ($print_total) { $rrd_options .= " VDEF:totin=in,TOTAL"; $rrd_options .= " VDEF:totout=out,TOTAL"; $rrd_options .= " VDEF:tot=both,TOTAL"; } - if ($percentile) { $rrd_options .= " VDEF:percentile_in=in,".$percentile.",PERCENT"; $rrd_options .= " VDEF:percentile_out=out,".$percentile.",PERCENT"; $rrd_options .= " VDEF:dpercentile_out=dout,".$percentile.",PERCENT"; } - if ($graph_max) { $rrd_options .= " AREA:in_max#".$colour_area_in_max.":"; $rrd_options .= " AREA:dout_max#".$colour_area_out_max.":"; } + +if($_GET['previous'] == "yes") +{ + $rrd_options .= " DEF:".$out."X=".$rrd_filename.":".$ds_out.":AVERAGE:start=".$prev_from.":end=".$from; + $rrd_options .= " DEF:".$in."X=".$rrd_filename.":".$ds_in.":AVERAGE:start=".$prev_from.":end=".$from; + $rrd_options .= " DEF:".$out."_maxX=".$rrd_filename.":".$ds_out.":MAX:start=".$prev_from.":end=".$from; + $rrd_options .= " DEF:".$in."_maxX=".$rrd_filename.":".$ds_in.":MAX:start=".$prev_from.":end=".$from; + $rrd_options .= " SHIFT:".$out."X:$period"; + $rrd_options .= " SHIFT:".$in."X:$period"; + $rrd_options .= " SHIFT:".$out."_maxX:$period"; + $rrd_options .= " SHIFT:".$in."_maxX:$period"; + $rrd_options .= " CDEF:dout_maxX=out_maxX,-1,*"; + $rrd_options .= " CDEF:doutX=outX,-1,*"; + $rrd_options .= " CDEF:bothX=inX,outX,+"; + if ($print_total) + { + $rrd_options .= " VDEF:totinX=inX,TOTAL"; + $rrd_options .= " VDEF:totoutX=outX,TOTAL"; + $rrd_options .= " VDEF:totX=bothX,TOTAL"; + } + if ($percentile) + { + $rrd_options .= " VDEF:percentile_inX=inX,".$percentile.",PERCENT"; + $rrd_options .= " VDEF:percentile_outX=outX,".$percentile.",PERCENT"; + $rrd_options .= " VDEF:dpercentile_outX=doutX,".$percentile.",PERCENT"; + } + if ($graph_max) + { + $rrd_options .= " AREA:in_max#".$colour_area_in_max.":"; + $rrd_options .= " AREA:dout_max#".$colour_area_out_max.":"; + } +} + + + $rrd_options .= " AREA:in#".$colour_area_in.":"; $rrd_options .= " COMMENT:'".$unit_text." Now Ave Max"; @@ -90,4 +121,12 @@ if ($percentile) $rrd_options .= " LINE1:dpercentile_out#aa0000"; } +if($_GET['previous'] == "yes") +{ + $rrd_options .= " LINE1.25:in".$format."X#666666:'Prev In \\\\n'"; + $rrd_options .= " LINE1.25:dout".$format."X#666666:'Prev Out'"; +} + + + ?> diff --git a/html/includes/graphs/ipsectunnel/bits.inc.php b/html/includes/graphs/ipsectunnel/bits.inc.php index 7db9c0afc..cd0fa91fd 100644 --- a/html/includes/graphs/ipsectunnel/bits.inc.php +++ b/html/includes/graphs/ipsectunnel/bits.inc.php @@ -3,6 +3,8 @@ $ds_in = "TunInOctets"; $ds_out = "TunOutOctets"; -include("includes/graphs/generic_bytes.inc.php"); +$format = "octets"; + +include("includes/graphs/generic_data.inc.php"); ?> diff --git a/html/includes/graphs/macaccounting/bits.inc.php b/html/includes/graphs/macaccounting/bits.inc.php index 68bcebcdf..e0f0f5e0a 100644 --- a/html/includes/graphs/macaccounting/bits.inc.php +++ b/html/includes/graphs/macaccounting/bits.inc.php @@ -3,6 +3,6 @@ $ds_in = "IN"; $ds_out = "OUT"; -include("includes/graphs/generic_bits.inc.php"); +include("includes/graphs/generic_data.inc.php"); ?> diff --git a/html/includes/graphs/netscalervsvr/bits.inc.php b/html/includes/graphs/netscalervsvr/bits.inc.php index 512e0b22d..17707bbb3 100644 --- a/html/includes/graphs/netscalervsvr/bits.inc.php +++ b/html/includes/graphs/netscalervsvr/bits.inc.php @@ -3,6 +3,6 @@ $ds_in = "TotalRequestBytes"; $ds_out = "TotalResponseBytes"; -include("includes/graphs/generic_bits.inc.php"); +include("includes/graphs/generic_data.inc.php"); ?> diff --git a/html/includes/graphs/port/bits.inc.php b/html/includes/graphs/port/bits.inc.php index a586dcc18..8101cb933 100644 --- a/html/includes/graphs/port/bits.inc.php +++ b/html/includes/graphs/port/bits.inc.php @@ -3,6 +3,6 @@ $ds_in = "INOCTETS"; $ds_out = "OUTOCTETS"; -include("includes/graphs/generic_bits.inc.php"); +include("includes/graphs/generic_data.inc.php"); -?> \ No newline at end of file +?> diff --git a/html/includes/graphs/rserver/curr.inc.php b/html/includes/graphs/rserver/curr.inc.php index 048a80b68..6edc1736d 100755 --- a/html/includes/graphs/rserver/curr.inc.php +++ b/html/includes/graphs/rserver/curr.inc.php @@ -3,21 +3,6 @@ ##$ds_in = "RserverCurrentConns"; ##$ds_out = "RserverTotalConns"; -##include("includes/graphs/generic_bytes.inc.php"); - -#$ds = "RserverCurrentConns"; - -#$colour_area = "B0C4DE"; -#$colour_line = "191970"; - -#$colour_area_max = "FFEE99"; - -#$graph_max = 1; - -#$unit_text = "Conns"; - -#include("includes/graphs/generic_simplex.inc.php"); - $scale_min = 0; include("includes/graphs/common.inc.php"); diff --git a/html/includes/graphs/vserver/bits.inc.php b/html/includes/graphs/vserver/bits.inc.php index 378d3f89a..28d4ac4c9 100644 --- a/html/includes/graphs/vserver/bits.inc.php +++ b/html/includes/graphs/vserver/bits.inc.php @@ -1,12 +1,8 @@