mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 08:02:41 +02:00
accesspoint support (probably) from ethan sommer (#50)
git-svn-id: http://www.observium.org/svn/observer/trunk@3223 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -294,6 +294,7 @@ function print_graph_tag($args)
|
||||
|
||||
function generate_graph_tag($args)
|
||||
{
|
||||
|
||||
foreach ($args as $key => $arg)
|
||||
{
|
||||
$urlargs[] = $key."=".$arg;
|
||||
@@ -538,4 +539,49 @@ function foldersize($path)
|
||||
return array($total_size, $total_files);
|
||||
}
|
||||
|
||||
function generate_ap_link($args, $text = NULL, $type = NULL)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$args = ifNameDescr($args);
|
||||
if (!$text) { $text = fixIfName($args['label']); }
|
||||
if ($type) { $args['graph_type'] = $type; }
|
||||
if (!isset($args['graph_type'])) { $args['graph_type'] = 'port_bits'; }
|
||||
|
||||
if (!isset($args['hostname'])) { $args = array_merge($args, device_by_id_cache($args['device_id'])); }
|
||||
|
||||
$content = "<div class=list-large>".$args['text']." - " . fixifName($args['label']) . "</div>";
|
||||
if ($args['ifAlias']) { $content .= $args['ifAlias']."<br />"; }
|
||||
$content .= "<div style=\'width: 850px\'>";
|
||||
$graph_array['type'] = $args['graph_type'];
|
||||
$graph_array['legend'] = "yes";
|
||||
$graph_array['height'] = "100";
|
||||
$graph_array['width'] = "340";
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['from'] = $config['time']['day'];
|
||||
$graph_array['id'] = $args['accesspoint_id'];
|
||||
$content .= generate_graph_tag($graph_array);
|
||||
$graph_array['from'] = $config['time']['week'];
|
||||
$content .= generate_graph_tag($graph_array);
|
||||
$graph_array['from'] = $config['time']['month'];
|
||||
$content .= generate_graph_tag($graph_array);
|
||||
$graph_array['from'] = $config['time']['year'];
|
||||
$content .= generate_graph_tag($graph_array);
|
||||
$content .= "</div>";
|
||||
|
||||
|
||||
$url = generate_ap_url($args);
|
||||
if (port_permitted($args['interface_id'], $args['device_id'])) {
|
||||
return overlib_link($url, $text, $content, $class);
|
||||
} else {
|
||||
return fixifName($text);
|
||||
}
|
||||
}
|
||||
|
||||
function generate_ap_url($ap, $vars=array())
|
||||
{
|
||||
return generate_url(array('page' => 'device', 'device' => $ap['device_id'], 'tab' => 'accesspoint', 'ap' => $ap['accesspoint_id']), $vars);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
if (is_numeric($vars['id']))
|
||||
{
|
||||
$ap = accesspoint_by_id($id);
|
||||
|
||||
if (is_numeric($ap['device_id']) && ($auth || device_permitted($ap['device_id'])))
|
||||
{
|
||||
$device = device_by_id_cache($ap['device_id']);
|
||||
|
||||
$title = generate_device_link($device);
|
||||
$title .= " :: AP :: " . htmlentities($ap['name']);
|
||||
$auth = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] ."/". safename("arubaap-$ap[name].$ap[radio_number].rrd");
|
||||
|
||||
$rrd_list[0]['filename'] = $rrd_filename;
|
||||
$rrd_list[0]['descr'] = "Channel";
|
||||
$rrd_list[0]['ds'] = "channel";
|
||||
|
||||
$unit_text = "Channel";
|
||||
|
||||
$units='';
|
||||
$total_units='';
|
||||
$colours='mixed';
|
||||
|
||||
$scale_min = "0";
|
||||
|
||||
$nototal = 1;
|
||||
|
||||
if ($rrd_list)
|
||||
{
|
||||
include("includes/graphs/generic_multi_line.inc.php");
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
$ap=accesspoint_by_id($id);
|
||||
$device = device_by_id_cache($ap['device_id']);
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] ."/".
|
||||
safename("arubaap-$ap[name].$ap[radio_number].rrd");
|
||||
|
||||
$rrd_list[0]['filename'] = $rrd_filename;
|
||||
$rrd_list[0]['descr'] = "Interference";
|
||||
$rrd_list[0]['ds'] = "interference";
|
||||
|
||||
$unit_text = "Int";
|
||||
|
||||
$units='';
|
||||
$total_units='';
|
||||
$colours='mixed';
|
||||
|
||||
$scale_min = "0";
|
||||
|
||||
$nototal = 1;
|
||||
|
||||
if ($rrd_list)
|
||||
{
|
||||
include("includes/graphs/generic_multi_line.inc.php");
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
$ap=accesspoint_by_id($id);
|
||||
$device = device_by_id_cache($ap['device_id']);
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] ."/".
|
||||
safename("arubaap-$ap[name].$ap[radio_number].rrd");
|
||||
|
||||
$rrd_list[0]['filename'] = $rrd_filename;
|
||||
$rrd_list[0]['descr'] = "Num Clients";
|
||||
$rrd_list[0]['ds'] = "numasoclients";
|
||||
|
||||
$unit_text = "Clients";
|
||||
|
||||
$units='';
|
||||
$total_units='';
|
||||
$colours='mixed';
|
||||
|
||||
$scale_min = "0";
|
||||
|
||||
$nototal = 1;
|
||||
|
||||
if ($rrd_list)
|
||||
{
|
||||
include("includes/graphs/generic_multi_line.inc.php");
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
$ap=accesspoint_by_id($id);
|
||||
$device = device_by_id_cache($ap['device_id']);
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] ."/".
|
||||
safename("arubaap-$ap[name].$ap[radio_number].rrd");
|
||||
|
||||
$rrd_list[0]['filename'] = $rrd_filename;
|
||||
$rrd_list[0]['descr'] = "MonBSSIDs";
|
||||
$rrd_list[0]['ds'] = "nummonbssid";
|
||||
|
||||
$unit_text = "BSSIDs";
|
||||
|
||||
$units='';
|
||||
$total_units='';
|
||||
$colours='mixed';
|
||||
|
||||
$scale_min = "0";
|
||||
|
||||
$nototal = 1;
|
||||
|
||||
if ($rrd_list)
|
||||
{
|
||||
include("includes/graphs/generic_multi_line.inc.php");
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
$ap=accesspoint_by_id($id);
|
||||
$device = device_by_id_cache($ap['device_id']);
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] ."/".
|
||||
safename("arubaap-$ap[name].$ap[radio_number].rrd");
|
||||
|
||||
$rrd_list[0]['filename'] = $rrd_filename;
|
||||
$rrd_list[0]['descr'] = "Mon Clients";
|
||||
$rrd_list[0]['ds'] = "nummonclients";
|
||||
|
||||
$unit_text = "Clients";
|
||||
|
||||
$units='';
|
||||
$total_units='';
|
||||
$colours='mixed';
|
||||
|
||||
$scale_min = "0";
|
||||
|
||||
$nototal = 1;
|
||||
|
||||
if ($rrd_list)
|
||||
{
|
||||
include("includes/graphs/generic_multi_line.inc.php");
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
$ap=accesspoint_by_id($id);
|
||||
$device = device_by_id_cache($ap['device_id']);
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] ."/".
|
||||
safename("arubaap-$ap[name].$ap[radio_number].rrd");
|
||||
|
||||
$rrd_list[0]['filename'] = $rrd_filename;
|
||||
$rrd_list[0]['descr'] = "radioutil";
|
||||
$rrd_list[0]['ds'] = "radioutil";
|
||||
|
||||
$unit_text = "Percent";
|
||||
|
||||
$units='';
|
||||
$total_units='';
|
||||
$colours='mixed';
|
||||
|
||||
$scale_min = "0";
|
||||
|
||||
$nototal = 1;
|
||||
|
||||
if ($rrd_list)
|
||||
{
|
||||
include("includes/graphs/generic_multi_line.inc.php");
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
$ap=accesspoint_by_id($id);
|
||||
$device = device_by_id_cache($ap['device_id']);
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] ."/".
|
||||
safename("arubaap-$ap[name].$ap[radio_number].rrd");
|
||||
|
||||
$rrd_list[0]['filename'] = $rrd_filename;
|
||||
$rrd_list[0]['descr'] = "txpow";
|
||||
$rrd_list[0]['ds'] = "txpow";
|
||||
|
||||
$unit_text = "dBm";
|
||||
|
||||
$units='';
|
||||
$total_units='';
|
||||
$colours='mixed';
|
||||
|
||||
$scale_min = "0";
|
||||
|
||||
$nototal = 1;
|
||||
|
||||
if ($rrd_list)
|
||||
{
|
||||
include("includes/graphs/generic_multi_line.inc.php");
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -65,10 +65,11 @@ if (is_file($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.p
|
||||
{
|
||||
include($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
graph_error("Graph Template Missing");
|
||||
graph_error("$type*$subtype ");//Graph Template Missing");
|
||||
}
|
||||
|
||||
function graph_error($string)
|
||||
@@ -106,6 +107,7 @@ function graph_error($string)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($error_msg) {
|
||||
/// We have an error :(
|
||||
|
||||
@@ -141,6 +143,7 @@ if ($error_msg) {
|
||||
unlink($graphfile);
|
||||
echo("</div>");
|
||||
} else {
|
||||
|
||||
if ($rrd_options)
|
||||
{
|
||||
rrdtool_graph($graphfile, $rrd_options);
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
global $config;
|
||||
|
||||
$graph_array['height'] = "100";
|
||||
$graph_array['width'] = "215";
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['id'] = $ap['accesspoint_id'];
|
||||
$graph_array['type'] = $graph_type;
|
||||
|
||||
include("includes/print-quadgraphs.inc.php");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
if($int_colour)
|
||||
{
|
||||
$row_colour = $int_colour;
|
||||
} else {
|
||||
if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
}
|
||||
|
||||
|
||||
$text=$ap['name'] ." ".$ap['type'];
|
||||
$ap['text']=$text;
|
||||
|
||||
echo("<tr style=\"background-color: $row_colour;\" valign=top onmouseover=\"this.style.backgroundColor='$list_highlight';\" onmouseout=\"this.style.backgroundColor='$row_colour';\" onclick=\"location.href='" . generate_ap_url($ap) . "/'\" style='cursor: pointer;'>
|
||||
<td valign=top width=350>");
|
||||
echo(" <span class=list-large> " . generate_ap_link($ap, " $text </span><br />"));
|
||||
echo("<span class=interface-desc>");
|
||||
echo("$break".$ap['mac_addr']."<br>".$ap['type']. " - channel ".$ap['channel']);
|
||||
echo("<br />txpow $ap[txpow]");
|
||||
echo("</span>");
|
||||
echo("</td><td width=100>");
|
||||
|
||||
|
||||
echo("</td><td width=150>");
|
||||
$ap['graph_type'] = "accesspoints_numasoclients";
|
||||
echo(generate_ap_link($ap, "<img src='graph.php?type=$ap[graph_type]&id=".$ap['accesspoint_id']."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>"));
|
||||
echo("<br>\n");
|
||||
$ap['graph_type'] = "accesspoints_radioutil";
|
||||
echo(generate_ap_link($ap, "<img src='graph.php?type=$ap[graph_type]&id=".$ap['accesspoint_id']."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>"));
|
||||
echo("<br>\n");
|
||||
$ap['graph_type'] = "accesspoints_interference";
|
||||
echo(generate_ap_link($ap, "<img src='graph.php?type=$ap[graph_type]&id=".$ap['accesspoint_id']."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>"));
|
||||
echo("<br>\n");
|
||||
|
||||
echo("</td><td width=120>");
|
||||
|
||||
echo("<img src='images/icons/wireless.png' style='height:20px; width:20px;' align=absmiddle /> ".format_bi($ap[numasoclients])." Clients<br />");
|
||||
echo("<img src='images/icons/wireless.png' style='height:20px; width:20px;' align=absmiddle /> ".format_bi($ap[radioutil])." % busy<br />");
|
||||
echo("<img src='images/icons/wireless.png' style='height:20px; width:20px;' align=absmiddle /> ".format_bi($ap[interference])." interference index<br />");
|
||||
|
||||
echo("</td></tr>");
|
||||
|
||||
|
||||
|
||||
if ($vars['tab'] == "accesspoint") {
|
||||
|
||||
|
||||
$graph_type='accesspoints_numasoclients';
|
||||
echo("<tr style='background-color: $row_colour; padding: 0px;'><td colspan=7>");
|
||||
echo("<div class='graphhead'>Associated Clients</div>");
|
||||
include("includes/print-accesspoint-graphs.inc.php");
|
||||
echo("</td></tr>");
|
||||
|
||||
$graph_type='accesspoints_interference';
|
||||
echo("<tr style='background-color: $row_colour; padding: 0px;'><td colspan=7>");
|
||||
echo("<div class='graphhead'>Interference</div>");
|
||||
include("includes/print-accesspoint-graphs.inc.php");
|
||||
echo("</td></tr>");
|
||||
|
||||
$graph_type='accesspoints_channel';
|
||||
echo("<tr style='background-color: $row_colour; padding: 0px;'><td colspan=7>");
|
||||
echo("<div class='graphhead'>Channel</div>");
|
||||
include("includes/print-accesspoint-graphs.inc.php");
|
||||
echo("</td></tr>");
|
||||
|
||||
$graph_type='accesspoints_txpow';
|
||||
echo("<tr style='background-color: $row_colour; padding: 0px;'><td colspan=7>");
|
||||
echo("<div class='graphhead'>Transmit Power</div>");
|
||||
include("includes/print-accesspoint-graphs.inc.php");
|
||||
echo("</td></tr>");
|
||||
|
||||
$graph_type='accesspoints_radioutil';
|
||||
echo("<tr style='background-color: $row_colour; padding: 0px;'><td colspan=7>");
|
||||
echo("<div class='graphhead'>Radio Utilization</div>");
|
||||
include("includes/print-accesspoint-graphs.inc.php");
|
||||
echo("</td></tr>");
|
||||
|
||||
$graph_type='accesspoints_nummonclients';
|
||||
echo("<tr style='background-color: $row_colour; padding: 0px;'><td colspan=7>");
|
||||
echo("<div class='graphhead'>Monitored Clients</div>");
|
||||
include("includes/print-accesspoint-graphs.inc.php");
|
||||
echo("</td></tr>");
|
||||
|
||||
$graph_type='accesspoints_nummonbssid';
|
||||
echo("<tr style='background-color: $row_colour; padding: 0px;'><td colspan=7>");
|
||||
echo("<div class='graphhead'>Number of monitored BSSIDs</div>");
|
||||
include("includes/print-accesspoint-graphs.inc.php");
|
||||
echo("</td></tr>");
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -6,6 +6,7 @@ if ($vars['tab'] == "port" && is_numeric($vars['device']) && port_permitted($var
|
||||
$permit_ports = 1;
|
||||
}
|
||||
|
||||
|
||||
if (device_permitted($vars['device']) || $check_device == $vars['device'])
|
||||
{
|
||||
$selected['iface'] = "selected";
|
||||
@@ -118,6 +119,15 @@ if (device_permitted($vars['device']) || $check_device == $vars['device'])
|
||||
</li>');
|
||||
}
|
||||
|
||||
if (@dbFetchCell("SELECT COUNT(accesspoint_id) FROM accesspoint WHERE device_id = '" . $device['device_id'] . "'") > '0')
|
||||
{
|
||||
echo('<li class="' . $select['accesspoints'] . '">
|
||||
<a href="'.generate_device_url($device, array('tab' => 'accesspoints')). '">
|
||||
<img src="images/icons/wireless.png" align="absmiddle" border="0" /> Access Points
|
||||
</a>
|
||||
</li>');
|
||||
}
|
||||
|
||||
if (isset($config['smokeping']['dir']))
|
||||
{
|
||||
$smokeping_files = array();
|
||||
|
||||
@@ -8,4 +8,4 @@ if (is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/wificlients-radio1
|
||||
include("includes/print-device-graph.php");
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user