mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
add graphing of ipsec tunnels on cisco kit
git-svn-id: http://www.observium.org/svn/observer/trunk@2450 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
if (is_numeric($id))
|
||||
{
|
||||
|
||||
$tunnel = dbFetchRow("SELECT * FROM `ipsec_tunnels` AS I, `devices` AS D WHERE I.tunnel_id = ? AND I.device_id = D.device_id", array($id));
|
||||
|
||||
if (is_numeric($tunnel['device_id']) && ($config['allow_unauth_graphs'] || device_permitted($tunnel['device_id'])))
|
||||
{
|
||||
$device = device_by_id_cache($tunnel['device_id']);
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("ipsectunnel-".$tunnel['peer_addr'].".rrd");
|
||||
|
||||
$title = generate_device_link($device);
|
||||
$title .= " :: IPSEC Tunnel :: " . htmlentities($tunnel['peer_addr']);
|
||||
$auth = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
$rra_in = "TunInOctets";
|
||||
$rra_out = "TunOutOctets";
|
||||
|
||||
include("includes/graphs/generic_bytes.inc.php");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$rra_in = "TunInPkts";
|
||||
$rra_out = "TunOutPkts";
|
||||
|
||||
$colour_area_in = "AA66AA";
|
||||
$colour_line_in = "330033";
|
||||
$colour_area_out = "FFDD88";
|
||||
$colour_line_out = "FF6600";
|
||||
|
||||
$colour_area_in_max = "cc88cc";
|
||||
$colour_area_out_max = "FFefaa";
|
||||
|
||||
$graph_max = 1;
|
||||
$unit_text = "Packets";
|
||||
|
||||
include("includes/graphs/generic_duplex.inc.php");
|
||||
|
||||
?>
|
||||
@@ -114,6 +114,9 @@ if (device_permitted($_GET['opta']) || $check_device == $_GET['opta'])
|
||||
|
||||
### $routing_tabs is used in device/routing/ to build the tabs menu. we built it here to save some queries
|
||||
|
||||
$device_routing_count['ipsec_tunnels'] = dbFetchCell("SELECT COUNT(*) FROM `ipsec_tunnels` WHERE `device_id` = ?", array($device['device_id']));
|
||||
if ($device_routing_count['ipsec_tunnels']) { $routing_tabs[] = 'ipsec_tunnels'; }
|
||||
|
||||
$device_routing_count['bgp'] = dbFetchCell("SELECT COUNT(*) FROM `bgpPeers` WHERE `device_id` = ?", array($device['device_id']));
|
||||
if ($device_routing_count['bgp']) { $routing_tabs[] = 'bgp'; }
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
#$type_text['overview'] = "Overview";
|
||||
$type_text['ipsec_tunnels'] = "IPSEC Tunnels";
|
||||
$type_text['bgp'] = "BGP";
|
||||
$type_text['cef'] = "CEF";
|
||||
$type_text['ospf'] = "OSPF";
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
print_optionbar_start();
|
||||
|
||||
echo("<span style='font-weight: bold;'>IPSEC Tunnels</span> » ");
|
||||
|
||||
$menu_options = array('basic' => 'Basic',
|
||||
);
|
||||
|
||||
if (!$_GET['opta']) { $_GET['opta'] = "basic"; }
|
||||
|
||||
$sep = "";
|
||||
foreach ($menu_options as $option => $text)
|
||||
{
|
||||
if ($_GET['optd'] == $option) { echo("<span class='pagemenu-selected'>"); }
|
||||
echo('<a href="device/' . $device['device_id'] . '/routing/ipsec_tunnels/' . $option . '/">' . $text
|
||||
. '</a>');
|
||||
if ($_GET['optd'] == $option) { echo("</span>"); }
|
||||
echo(" | ");
|
||||
}
|
||||
|
||||
unset($sep);
|
||||
|
||||
echo(' Graphs: ');
|
||||
|
||||
$graph_types = array("bits" => "Bits",
|
||||
"pkts" => "Packets",
|
||||
"errors" => "Errors");
|
||||
|
||||
foreach ($graph_types as $type => $descr)
|
||||
{
|
||||
echo("$type_sep");
|
||||
if ($_GET['opte'] == $type) { echo("<span class='pagemenu-selected'>"); }
|
||||
echo('<a href="device/' . $device['device_id'] . '/routing/ipsec_tunnels/graphs/'.$type.'/">'.$descr.'</a>');
|
||||
if ($_GET['opte'] == $type) { echo("</span>"); }
|
||||
|
||||
# echo('(');
|
||||
# if ($_GET['opte'] == $type) { echo("<span class='pagemenu-selected'>"); }
|
||||
# echo('<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/ipsec_tunnelss/'.$type.'/thumbs/">Mini</a>');
|
||||
# if ($_GET['opte'] == $type) { echo("</span>"); }
|
||||
# echo(')');
|
||||
$type_sep = " | ";
|
||||
}
|
||||
|
||||
print_optionbar_end();
|
||||
|
||||
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=0 width=100%>");
|
||||
$i = "0";
|
||||
foreach (dbFetchRows("SELECT * FROM `ipsec_tunnels` WHERE `device_id` = ? ORDER BY `peer_addr`", array($device['device_id'])) as $tunnel)
|
||||
{
|
||||
|
||||
if (is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
|
||||
|
||||
if($tunnel['tunnel_status'] == "active") { $tunnel_class="green"; } else { $tunnel_class="red"; }
|
||||
|
||||
echo("<tr bgcolor='$bg_colour'>");
|
||||
echo("<td width=320 class=list-large>" . $tunnel['local_addr'] . " » " . $tunnel['peer_addr'] . "</a></td>");
|
||||
echo("<td width=150 class=box-desc>" . $tunnel['tunnel_name'] . "</td>");
|
||||
echo("<td width=100 class=list-large><span class='".$tunnel_class."'>" . $tunnel['tunnel_status'] . "</span></td>");
|
||||
echo("</tr>");
|
||||
if ($_GET['optd'] == "graphs")
|
||||
{
|
||||
echo('<tr class="list-bold">');
|
||||
echo("<td colspan = 3>");
|
||||
$graph_type = "ipsectunnel_" . $_GET['opte'];
|
||||
|
||||
$graph_array['height'] = "100";
|
||||
$graph_array['width'] = "215";
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $tunnel['tunnel_id'];
|
||||
$graph_array['type'] = $graph_type;
|
||||
|
||||
include("includes/print-quadgraphs.inc.php");
|
||||
|
||||
|
||||
echo("
|
||||
</td>
|
||||
</tr>");
|
||||
}
|
||||
|
||||
|
||||
echo("</td>");
|
||||
echo("</tr>");
|
||||
|
||||
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
echo("</table></div>");
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user