add interval chooser to realtime

git-svn-id: http://www.observium.org/svn/observer/trunk@2427 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-09-08 03:52:37 +00:00
parent 9ec5bfd8b1
commit 7da9f07f8a
2 changed files with 49 additions and 3 deletions

View File

@@ -41,17 +41,19 @@ $ifname=$device['hostname']. " ". @$port['ifDescr']; //Interface name that will
/********* Other conf *******/
$scale_type="follow"; //Autoscale default setup : "up" = only increase scale; "follow" = increase and decrease scale according to current graphed datas
$nb_plot=240; //NB plot in graph
if(is_numeric($_GET['interval'])) {
$time_interval=$_GET['interval'];
} else {
$time_interval=1; //Refresh time Interval
}
$fetch_link = "data.php?id=".$_GET[id];
//SVG attributes
$attribs['axis']='fill="black" stroke="black"';
$attribs['in']='fill="#435370" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="7"';
$attribs['out']='fill="#8092B3" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="7"';
$attribs['in']='fill="green" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="7"';
$attribs['out']='fill="blue" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="7"';
$attribs['graph_in']='fill="none" stroke="green" stroke-opacity="0.8"';
$attribs['graph_out']='fill="none" stroke="blue" stroke-opacity="0.8"';
$attribs['legend']='fill="black" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="4"';

View File

@@ -1,5 +1,47 @@
<?php
print_optionbar_start();
echo("Polling Interval: ");
if ($_GET['optc'] == "0.25" || !$_GET['optc']) { echo("<span class='pagemenu-selected'>"); }
echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/port/".$interface['interface_id']."/realtime/0.25/'>0.25s</a>");
if ($_GET['optc'] == "0.25" || !$_GET['optc']) { echo("</span>"); }
echo(" | ");
if ($_GET['optc'] == "1" || !$_GET['optc']) { echo("<span class='pagemenu-selected'>"); }
echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/port/".$interface['interface_id']."/realtime/1/'>1s</a>");
if ($_GET['optc'] == "1" || !$_GET['optc']) { echo("</span>"); }
echo(" | ");
if ($_GET['optc'] == "2" || !$_GET['optc']) { echo("<span class='pagemenu-selected'>"); }
echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/port/".$interface['interface_id']."/realtime/2/'>2s</a>");
if ($_GET['optc'] == "2" || !$_GET['optc']) { echo("</span>"); }
echo(" | ");
if ($_GET['optc'] == "5" || !$_GET['optc']) { echo("<span class='pagemenu-selected'>"); }
echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/port/".$interface['interface_id']."/realtime/5/'>5s</a>");
if ($_GET['optc'] == "5" || !$_GET['optc']) { echo("</span>"); }
echo(" | ");
if ($_GET['optc'] == "15" || !$_GET['optc']) { echo("<span class='pagemenu-selected'>"); }
echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/port/".$interface['interface_id']."/realtime/15/'>15s</a>");
if ($_GET['optc'] == "15" || !$_GET['optc']) { echo("</span>"); }
echo(" | ");
if ($_GET['optc'] == "60" || !$_GET['optc']) { echo("<span class='pagemenu-selected'>"); }
echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/port/".$interface['interface_id']."/realtime/60/'>60s</a>");
if ($_GET['optc'] == "60" || !$_GET['optc']) { echo("</span>"); }
print_optionbar_end();
### FIXME - do this in a function and/or do it in graph-realtime.php
if($device['os'] == "linux") {
@@ -8,9 +50,11 @@ if($device['os'] == "linux") {
$interval = "2";
}
if($_GET['optc']) { $interval = $_GET['optc']; }
?>
<div align="center">
<div align="center" style="margin: 30px;">
<object data="graph-realtime.php?type=bits&id=<?php echo($interface['interface_id'] . "&interval=".$interval); ?>" type="image/svg+xml" width="1000" height="400">
<param name="src" value="graph.php?type=bits&id=<?php echo($interface['interface_id'] . "&interval=".$interval); ?>" />
Your browser does not support the type SVG! You need to either use Firefox or download the Adobe SVG plugin.