mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
basic smokeping
git-svn-id: http://www.observium.org/svn/observer/trunk@2620 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
48
html/includes/graphs/device/smokeping_in_all.inc.php
Normal file
48
html/includes/graphs/device/smokeping_in_all.inc.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
$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));
|
||||
if($target == $device['hostname'])
|
||||
{
|
||||
$files[$slave] = $file;
|
||||
}
|
||||
} else {
|
||||
$target = str_replace(".rrd", "", $file);
|
||||
if($target == $device['hostname'])
|
||||
{
|
||||
$files['observium'] = $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$i=0;
|
||||
foreach($files as $source => $filename)
|
||||
{
|
||||
$i++;
|
||||
$rrd_list[$i]['filename'] = $config['smokeping']['dir'] . $filename;
|
||||
$rrd_list[$i]['descr'] = $source;
|
||||
$rrd_list[$i]['ds'] = "median";
|
||||
}
|
||||
|
||||
$colours='mixed';
|
||||
|
||||
$nototal = 1;
|
||||
$simple_rrd = 1;
|
||||
|
||||
include("includes/graphs/generic_multi_line.inc.php");
|
||||
|
||||
?>
|
43
html/includes/graphs/device/smokeping_out_all.inc.php
Normal file
43
html/includes/graphs/device/smokeping_out_all.inc.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
$config['smokeping']['dir'] = "/var/lib/smokeping/";
|
||||
$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));
|
||||
if($slave == $device['hostname'])
|
||||
{
|
||||
$files[$target] = $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$i=0;
|
||||
foreach($files as $source => $filename)
|
||||
{
|
||||
$i++;
|
||||
$rrd_list[$i]['filename'] = $config['smokeping']['dir'] . $filename;
|
||||
$rrd_list[$i]['descr'] = $source;
|
||||
$rrd_list[$i]['ds'] = "median";
|
||||
}
|
||||
|
||||
$colours='mixed';
|
||||
|
||||
$nototal = 1;
|
||||
$simple_rrd = 1;
|
||||
|
||||
include("includes/graphs/generic_multi_line.inc.php");
|
||||
|
||||
?>
|
@@ -2,15 +2,31 @@
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
$unit_text = str_pad($unit_text, 13);
|
||||
$unit_text = substr($unit_text,0,13);
|
||||
if($width > "500")
|
||||
{
|
||||
$descr_len=24;
|
||||
} else {
|
||||
$descr_len=12;
|
||||
$descr_len += round(($width - 250) / 8);
|
||||
}
|
||||
|
||||
|
||||
if ($nototal) { $descrlen += "2"; $unitlen += "2";}
|
||||
$unit_text = str_pad(truncate($unit_text,$unitlen),$unitlen);
|
||||
|
||||
if($width > "500")
|
||||
{
|
||||
$rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)." Current Average Maximum '";
|
||||
if (!$nototal) { $rrd_options .= " COMMENT:'Total '"; }
|
||||
$rrd_options .= " COMMENT:'\l'";
|
||||
} else {
|
||||
$rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)." Now Ave Max\l'";
|
||||
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
$iter = 0;
|
||||
|
||||
$rrd_options .= " COMMENT:'".$unit_text." Cur Min Max Avg\\n'";
|
||||
|
||||
|
||||
foreach ($rrd_list as $rrd)
|
||||
{
|
||||
if (!$config['graph_colours'][$colours][$iter]) { $iter = 0; }
|
||||
@@ -19,9 +35,8 @@ foreach ($rrd_list as $rrd)
|
||||
|
||||
$ds = $rrd['ds'];
|
||||
$filename = $rrd['filename'];
|
||||
$descr = $rrd['descr'];
|
||||
$descr = substr(str_pad($descr, 10),0,10);
|
||||
$descr = str_replace(":", "\:", $descr);
|
||||
|
||||
$descr = str_replace(":", "\:", substr(str_pad($rrd['descr'], $descr_len),0,$descr_len));
|
||||
|
||||
$id = "ds".$i;
|
||||
|
||||
@@ -40,11 +55,10 @@ foreach ($rrd_list as $rrd)
|
||||
{
|
||||
$rrd_options .= " CDEF:".$id."i=".$id.",-1,*";
|
||||
$rrd_optionsb .= " LINE1.25:".$id."i#".$colour.":'$descr'";
|
||||
$rrd_options .= " AREA:".$id."i#" . $colour . "10";
|
||||
|
||||
# $rrd_options .= " AREA:".$id."i#" . $colour . "10";
|
||||
} else {
|
||||
$rrd_optionsb .= " LINE1.25:".$id."#".$colour.":'$descr'";
|
||||
$rrd_options .= " AREA:".$id."#" . $colour . "10";
|
||||
# $rrd_options .= " AREA:".$id."#" . $colour . "10";
|
||||
|
||||
}
|
||||
|
||||
|
59
html/pages/device/latency.inc.php
Normal file
59
html/pages/device/latency.inc.php
Normal 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>");
|
||||
|
||||
|
||||
?>
|
Reference in New Issue
Block a user