smokeping basic working

git-svn-id: http://www.observium.org/svn/observer/trunk@2622 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-09-30 19:46:32 +00:00
parent 8bbd0b8ca5
commit b3a19908ab
4 changed files with 65 additions and 81 deletions

View File

@@ -1,32 +1,39 @@
<?php
#if(!$vars['view']) { $vars['view'] = "incoming"; }
if(!$vars['view']) { $vars['view'] = "outgoing"; }
$files = array();
print_optionbar_start();
if ($handle = opendir($config['smokeping']['dir'])) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (eregi(".rrd", $file)) {
if (eregi("~", $file)) {
list($target,$slave) = explode("~", str_replace(".rrd", "", $file));
$files[$target][$slave] = $file;
$files_rev[$slave][$target] = $file;
} else {
$target = str_replace(".rrd", "", $file);
$files[$target]['observium'] = $file;
}
}
}
}
}
echo("<span style='font-weight: bold;'>Latency</span> &#187; ");
$menu_options = array('incoming' => 'Incoming',
'outgoing' => 'Outgoing');
$sep = "";
foreach ($menu_options as $option => $text)
{
echo($sep);
if ($vars['view'] == $option)
{
echo("<span class='pagemenu-selected'>");
}
echo(generate_link($text,$vars,array('view'=>$option)));
if ($vars['view'] == $option)
{
echo("</span>");
}
$sep = " | ";
}
unset($sep);
print_optionbar_end();
if($vars['view'] == "incoming")
{
if(count($files_rev[$device['hostname']]))
if(count($smokeping_files['in'][$device['hostname']]))
{
$graph_array['type'] = "device_smokeping_in_all";
@@ -38,7 +45,7 @@ if($vars['view'] == "incoming")
} else {
if(count($files[$device['hostname']]))
if(count($smokeping_files['out'][$device['hostname']]))
{
$graph_array['type'] = "device_smokeping_out_all";
@@ -50,10 +57,4 @@ if($vars['view'] == "incoming")
}
echo("<pre>");
print_r($files);
echo("</pre>");
?>