basic smokeping

git-svn-id: http://www.observium.org/svn/observer/trunk@2620 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-09-30 19:15:58 +00:00
parent 9f5ab8ec16
commit 9df4b3bc0b
4 changed files with 175 additions and 11 deletions

View File

@@ -0,0 +1,59 @@
<?php
#if(!$vars['view']) { $vars['view'] = "incoming"; }
if(!$vars['view']) { $vars['view'] = "outgoing"; }
$files = array();
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;
}
}
}
}
}
if($vars['view'] == "incoming")
{
if(count($files_rev[$device['hostname']]))
{
$graph_array['type'] = "device_smokeping_in_all";
$graph_array['id'] = $device['device_id'];
include("includes/print-quadgraphs.inc.php");
}
} else {
if(count($files[$device['hostname']]))
{
$graph_array['type'] = "device_smokeping_out_all";
$graph_array['id'] = $device['device_id'];
include("includes/print-quadgraphs.inc.php");
}
}
echo("<pre>");
print_r($files);
echo("</pre>");
?>