mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Added Signal Sensor
This commit is contained in:
Binary file not shown.
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 2.3 KiB |
@ -1371,6 +1371,18 @@ function load_graph_definitions($logarithmic = false, $tinylegend = false) {
|
||||
'GPRINT:temp_avg:AVERAGE:%4.1lf',
|
||||
'GPRINT:temp_max:MAX:%4.1lf',
|
||||
'GPRINT:temp_avg:LAST:%4.1lf\l');
|
||||
$GraphDefs['signal'] = array(
|
||||
'DEF:signal_avg={file}:value:AVERAGE',
|
||||
'DEF:signal_min={file}:value:MIN',
|
||||
'DEF:signal_max={file}:value:MAX',
|
||||
'CDEF:average=signal_avg,0.2,*,PREV,UN,signal_avg,PREV,IF,0.8,*,+',
|
||||
"AREA:signal_max#$HalfRed",
|
||||
"AREA:signal_min#$Canvas",
|
||||
"LINE1:signal_avg#$FullRed:Signal",
|
||||
'GPRINT:signal_min:MIN:%4.1lf',
|
||||
'GPRINT:signal_avg:AVERAGE:%4.1lf',
|
||||
'GPRINT:signal_max:MAX:%4.1lf',
|
||||
'GPRINT:signal_avg:LAST:%4.1lf\l');
|
||||
$GraphDefs['timeleft'] = array(
|
||||
#'-v', 'Minutes',
|
||||
'DEF:avg={file}:timeleft:AVERAGE',
|
||||
|
7
html/includes/graphs/device/signal.inc.php
Normal file
7
html/includes/graphs/device/signal.inc.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$class = 'signal';
|
||||
$unit = 'dBm';
|
||||
$unit_long = '';
|
||||
|
||||
require 'includes/graphs/device/sensor.inc.php';
|
22
html/includes/graphs/sensor/signal.inc.php
Normal file
22
html/includes/graphs/sensor/signal.inc.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
$scale_min = '-100';
|
||||
$scale_max = '0';
|
||||
require 'includes/graphs/common.inc.php';
|
||||
|
||||
$rrd_options .= " COMMENT:' Min Last Max\\n'";
|
||||
|
||||
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], 18), 0, 18);
|
||||
|
||||
$rrd_options .= " DEF:sensor=$rrd_filename:sensor:AVERAGE";
|
||||
$rrd_options .= " LINE1.5:sensor#cc0000:'".$sensor['sensor_descr_fixed']."'";
|
||||
$rrd_options .= " GPRINT:sensor$current_id:MIN:%5.2lfdBm";
|
||||
$rrd_options .= ' GPRINT:sensor:LAST:%5.2lfdBm';
|
||||
$rrd_options .= ' GPRINT:sensor:MAX:%5.2lfdBm\\\\l';
|
||||
|
||||
if (is_numeric($sensor['sensor_limit'])) {
|
||||
$rrd_options .= ' HRULE:'.$sensor['sensor_limit'].'#999999::dashes';
|
||||
}
|
||||
|
||||
if (is_numeric($sensor['sensor_limit_low'])) {
|
||||
$rrd_options .= ' HRULE:'.$sensor['sensor_limit_low'].'#999999::dashes';
|
||||
}
|
@ -359,8 +359,8 @@ if ($menu_sensors) {
|
||||
echo(' <li role="presentation" class="divider"></li>');
|
||||
}
|
||||
|
||||
$icons = array('fanspeed'=>'tachometer','humidity'=>'tint','temperature'=>'fire','current'=>'bolt','frequency'=>'line-chart','power'=>'power-off','voltage'=>'bolt','charge'=>'plus-square','dbm'=>'sun-o', 'load'=>'spinner','state'=>'bullseye');
|
||||
foreach (array('fanspeed','humidity','temperature') as $item) {
|
||||
$icons = array('fanspeed'=>'tachometer','humidity'=>'tint','temperature'=>'fire','current'=>'bolt','frequency'=>'line-chart','power'=>'power-off','voltage'=>'bolt','charge'=>'plus-square','dbm'=>'sun-o', 'load'=>'spinner','state'=>'bullseye','signal'=>'wifi');
|
||||
foreach (array('fanspeed','humidity','temperature','signal') as $item) {
|
||||
if (isset($menu_sensors[$item])) {
|
||||
echo(' <li><a href="health/metric='.$item.'/"><i class="fa fa-'.$icons[$item].' fa-fw fa-lg"></i> '.nicecase($item).'</a></li>');
|
||||
unset($menu_sensors[$item]);$sep++;
|
||||
|
@ -16,6 +16,7 @@ $power = dbFetchCell("select count(*) from sensors WHERE sensor_class='po
|
||||
$dBm = dbFetchCell("select count(*) from sensors WHERE sensor_class='dBm' AND device_id = ?", array($device['device_id']));
|
||||
$states = dbFetchCell("select count(*) from sensors WHERE sensor_class='state' AND device_id = ?", array($device['device_id']));
|
||||
$load = dbFetchCell("select count(*) from sensors WHERE sensor_class='load' AND device_id = ?", array($device['device_id']));
|
||||
$signal = dbFetchCell("select count(*) from sensors WHERE sensor_class='signal' AND device_id = ?", array($device['device_id']));
|
||||
|
||||
unset($datas);
|
||||
$datas[] = 'overview';
|
||||
@ -79,6 +80,10 @@ if ($load) {
|
||||
$datas[] = 'load';
|
||||
}
|
||||
|
||||
if ($signal) {
|
||||
$datas[] = 'signal';
|
||||
}
|
||||
|
||||
$type_text['overview'] = 'Overview';
|
||||
$type_text['charge'] = 'Battery Charge';
|
||||
$type_text['temperature'] = 'Temperature';
|
||||
@ -95,6 +100,7 @@ $type_text['power'] = 'Power';
|
||||
$type_text['dbm'] = 'dBm';
|
||||
$type_text['state'] = 'State';
|
||||
$type_text['load'] = 'Load';
|
||||
$type_text['signal'] = 'Signal';
|
||||
|
||||
$link_array = array(
|
||||
'page' => 'device',
|
||||
|
7
html/pages/device/health/signal.inc.php
Normal file
7
html/pages/device/health/signal.inc.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$class = 'signal';
|
||||
$unit = 'dBm';
|
||||
$graph_type = 'sensor_signal';
|
||||
|
||||
require 'sensors.inc.php';
|
@ -64,6 +64,7 @@ require 'overview/sensors/power.inc.php';
|
||||
require 'overview/sensors/frequencies.inc.php';
|
||||
require 'overview/sensors/load.inc.php';
|
||||
require 'overview/sensors/state.inc.php';
|
||||
require 'overview/sensors/signal.inc.php';
|
||||
require 'overview/eventlog.inc.php';
|
||||
require 'overview/services.inc.php';
|
||||
require 'overview/syslog.inc.php';
|
||||
|
8
html/pages/device/overview/sensors/signal.inc.php
Normal file
8
html/pages/device/overview/sensors/signal.inc.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
$graph_type = 'sensor_signal';
|
||||
$sensor_class = 'signal';
|
||||
$sensor_unit = 'dBm';
|
||||
$sensor_type = 'Wireless';
|
||||
|
||||
require 'pages/device/overview/generic/sensor.inc.php';
|
@ -12,6 +12,7 @@ if ($used_sensors['power']) $datas[] = 'power';
|
||||
if ($used_sensors['dbm']) $datas[] = 'dbm';
|
||||
if ($used_sensors['load']) $datas[] = 'load';
|
||||
if ($used_sensors['state']) $datas[] = 'state';
|
||||
if ($used_sensors['signal']) $datas[] = 'signal';
|
||||
|
||||
// FIXME generalize -> static-config ?
|
||||
$type_text['overview'] = "Overview";
|
||||
@ -31,6 +32,7 @@ $type_text['toner'] = "Toner";
|
||||
$type_text['dbm'] = "dBm";
|
||||
$type_text['load'] = "Load";
|
||||
$type_text['state'] = "State";
|
||||
$type_text['signal'] = "Signal";
|
||||
|
||||
if (!$vars['metric']) {
|
||||
$vars['metric'] = "processor";
|
||||
|
7
html/pages/health/signal.inc.php
Normal file
7
html/pages/health/signal.inc.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$graph_type = 'sensor_signal';
|
||||
$class = 'signal';
|
||||
$unit = 'dBm';
|
||||
|
||||
require 'pages/health/sensors.inc.php';
|
@ -336,6 +336,13 @@ function sensor_low_limit($class, $current) {
|
||||
case 'power':
|
||||
$limit = null;
|
||||
break;
|
||||
|
||||
case 'signal':
|
||||
$limit = ($current * 1.20);
|
||||
if ($limit < -80 && $current > -80) {
|
||||
$limit = -80;
|
||||
}
|
||||
break;
|
||||
}//end switch
|
||||
|
||||
return $limit;
|
||||
@ -378,6 +385,10 @@ function sensor_limit($class, $current) {
|
||||
case 'power':
|
||||
$limit = ($current * 1.50);
|
||||
break;
|
||||
|
||||
case 'signal';
|
||||
$limit = 0;
|
||||
break;
|
||||
}//end switch
|
||||
|
||||
return $limit;
|
||||
|
@ -27,3 +27,4 @@ require 'includes/discovery/sensors/charge.inc.php';
|
||||
require 'includes/discovery/sensors/load.inc.php';
|
||||
require 'includes/discovery/sensors/states.inc.php';
|
||||
require 'includes/discovery/sensors/dbm.inc.php';
|
||||
require 'includes/discovery/sensors/signal.inc.php';
|
73
includes/discovery/sensors/signal/cambium.inc.php
Normal file
73
includes/discovery/sensors/signal/cambium.inc.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
if ($device['os'] == 'cambium') {
|
||||
$cambium_type = snmp_get($device, 'sysDescr.0', '-Oqv', '');
|
||||
$is_epmp = snmp_get($device, 'sysObjectID.0', '-Oqv', '');
|
||||
$divisor = 1;
|
||||
if (strstr($cambium_type, 'Cambium PTP 50650')) {
|
||||
$mib = 'CAMBIUM-PTP650-MIB';
|
||||
$oid = 'receivePower.0';
|
||||
$divisor = 10;
|
||||
}
|
||||
else if (strstr($cambium_type, 'BHUL450')) {
|
||||
$masterSlaveMode = snmp_get($device, 'bhTimingMode.0', '-Oqv', 'WHISP-BOX-MIBV2-MIB');
|
||||
if ($masterSlaveMode == "timingMaster") {
|
||||
$oid = 'lastPowerLevel.2';
|
||||
$mib = 'WHISP-APS-MIB';
|
||||
}
|
||||
else {
|
||||
$oid = 'radioDbmInt.0';
|
||||
$mib = 'WHISP-SM-MIB';
|
||||
}
|
||||
}
|
||||
else if (strstr($cambium_type, 'BHUL') || strstr($cambium_type, 'BH')) {
|
||||
$masterSlaveMode = snmp_get($device, 'bhTimingMode.0', '-Oqv', 'WHISP-BOX-MIBV2-MIB');
|
||||
if ($masterSlaveMode == "timingMaster") {
|
||||
$oid = 'lastPowerLevel.2';
|
||||
$mib = 'WHISP-APS-MIB';
|
||||
}
|
||||
else {
|
||||
$oid = '1.3.6.1.4.1.161.19.3.2.2.21.0';
|
||||
$mib = 'WHISP-BOX-MIBV2-MIB';
|
||||
}
|
||||
}
|
||||
else if (strstr($cambium_type, 'PTP250')) {
|
||||
$oid = 'receivePower.0';
|
||||
$mib = 'CAMBIUM-PTP250-MIB';
|
||||
$divisor = 10;
|
||||
}
|
||||
else if (strstr($is_epmp, '.17713.21')) {
|
||||
$epmp_ap = snmp_get($device, 'wirelessInterfaceMode.0', '-Oqv', 'CAMBIUM-PMP80211-MIB');
|
||||
$epmp_number = snmp_get($device, 'cambiumSubModeType.0', '-Oqv', 'CAMBIUM-PMP80211-MIB');
|
||||
if ($epmp_ap == 1) {
|
||||
if ($epmp_number != 1) {
|
||||
$oid = 'cambiumSTADLRSSI.0';
|
||||
$mib = 'CAMBIUM-PMP80211-MIB';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$oid = 'cambiumSTADLRSSI.0';
|
||||
$mib = 'CAMBIUM-PMP80211-MIB';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$oid = '1.3.6.1.4.1.161.19.3.2.2.21.0';
|
||||
$mib = 'WHISP-BOX-MIBV2-MIB';
|
||||
}
|
||||
|
||||
$oids = trim(str_replace('"', '', snmp_get($device, "$oid", '-OsqnU', $mib)));
|
||||
d_echo($oids."\n");
|
||||
|
||||
if (!empty($oids)) {
|
||||
echo 'Cambium Signal ';
|
||||
}
|
||||
|
||||
$type = 'cambium';
|
||||
if (!empty($oids)) {
|
||||
list(,$current) = explode(' ', $oids);
|
||||
$current = $current / $divisor;
|
||||
$index = $oid;
|
||||
$descr = 'Signal';
|
||||
discover_sensor($valid['sensor'], 'signal', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
|
||||
}
|
||||
}
|
@ -44,6 +44,11 @@ function poll_sensor($device, $class, $unit) {
|
||||
}
|
||||
else if ($class == 'state') {
|
||||
$sensor_value = trim(str_replace('"', '', snmp_walk($device, $sensor['sensor_oid'], '-Oevq', 'SNMPv2-MIB')));
|
||||
}
|
||||
else if ($class == 'signal') {
|
||||
$currentOS = $device['os'];
|
||||
include "includes/polling/signal/$currentOS.inc.php";
|
||||
$sensor_value = trim(str_replace('"', '', snmp_get($device, $sensor['sensor_oid'], '-OUqnv', "SNMPv2-MIB$mib")));
|
||||
}
|
||||
else if ($class == 'dbm') {
|
||||
$sensor_value = trim(str_replace('"', '', snmp_get($device, $sensor['sensor_oid'], '-OUqnv', "SNMPv2-MIB$mib")));
|
||||
|
@ -25,6 +25,7 @@ $supported_sensors = array(
|
||||
'charge' => '%',
|
||||
'load' => '%',
|
||||
'state' => '#',
|
||||
'signal' => 'dBm',
|
||||
);
|
||||
|
||||
foreach ($supported_sensors as $sensor_type => $sensor_unit) {
|
||||
|
51
includes/polling/signal/cambium.inc.php
Normal file
51
includes/polling/signal/cambium.inc.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
$cambium_type = snmp_get($device, 'sysDescr.0', '-Oqv', '');
|
||||
$is_epmp = snmp_get($device, 'sysObjectID.0', '-Oqv', '');
|
||||
if (strstr($cambium_type, 'Cambium PTP 50650')) {
|
||||
$mib = ':CAMBIUM-PTP650-MIB';
|
||||
}
|
||||
else if (strstr($cambium_type, 'BHUL450-DES') || stristr($cambium_type, 'BHUL450-AES')) {
|
||||
$masterSlaveMode = snmp_get($device, 'bhTimingMode.0', '-Oqv', 'WHISP-BOX-MIBV2-MIB');
|
||||
if ($masterSlaveMode == "timingMaster") {
|
||||
$mib = ':WHISP-APS-MIB';
|
||||
}
|
||||
else {
|
||||
$mib = ':WHISP-SM-MIB';
|
||||
}
|
||||
}
|
||||
else if (strstr($cambium_type, 'PTP250')) {
|
||||
$mib = ':CAMBIUM-PTP250-MIB';
|
||||
}
|
||||
else if (strstr($cambium_type, 'BHUL') || stristr($cambium_type, 'BH')) {
|
||||
$masterSlaveMode = snmp_get($device, 'bhTimingMode.0', '-Oqv', 'WHISP-BOX-MIBV2-MIB');
|
||||
if ($masterSlaveMode == "timingMaster") {
|
||||
$mib = ':WHISP-APS-MIB';
|
||||
}
|
||||
else {
|
||||
$mib = ':WHISP-BOX-MIBV2-MIB';
|
||||
}
|
||||
}
|
||||
else if (strstr($is_epmp, '.17713.21')) {
|
||||
$epmp_ap = snmp_get($device, 'wirelessInterfaceMode.0', '-Oqv', 'CAMBIUM-PMP80211-MIB');
|
||||
$epmp_number = snmp_get($device, 'cambiumSubModeType.0', '-Oqv', 'CAMBIUM-PMP80211-MIB');
|
||||
if ($epmp_ap == 1) {
|
||||
if ($epmp_number != 1) {
|
||||
$mib = ':CAMBIUM-PMP80211-MIB';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$mib = ':CAMBIUM-PMP80211-MIB';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$mib = ':WHISP-BOX-MIBV2-MIB';
|
||||
}
|
Reference in New Issue
Block a user