Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional features to SAF Tehnika #4666

Merged
merged 6 commits into from Oct 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 23 additions & 0 deletions html/includes/graphs/device/saf_modemCapacity.inc.php
@@ -0,0 +1,23 @@
<?php

require 'includes/graphs/common.inc.php';

$rrdfilename = rrd_name($device['hostname'], 'saf-modem-radio');

if (rrdtool_check_rrd_exists($rrdfilename)) {
$rrd_options .= ' COMMENT:" Now Min Max\r" ';
$rrd_options .= ' DEF:modemACMCapacity='.$rrdfilename.':modemACMCapacity:AVERAGE ';
$rrd_options .= ' DEF:modemTotalCapacity='.$rrdfilename.':modemTotalCapacity:AVERAGE ';
$rrd_options .= ' CDEF:acmCapacityMbps=modemACMCapacity,1000,* ';
$rrd_options .= ' CDEF:capacityMbps=modemTotalCapacity,1000,* ';
$rrd_options .= ' LINE1:acmCapacityMbps#00CC00:"ACM Total Capacity\l" ';
$rrd_options .= ' COMMENT:\u ';
$rrd_options .= ' GPRINT:acmCapacityMbps:LAST:"%0.2lf %sbps" ';
$rrd_options .= ' GPRINT:acmCapacityMbps:MIN:"%0.2lf %sbps" ';
$rrd_options .= ' GPRINT:acmCapacityMbps:MAX:"%0.2lf %sbps\r" ';
$rrd_options .= ' LINE1:capacityMbps#CC0000:"Total Capacity\l" ';
$rrd_options .= ' COMMENT:\u ';
$rrd_options .= ' GPRINT:capacityMbps:LAST:"%0.2lf %sbps" ';
$rrd_options .= ' GPRINT:capacityMbps:MIN:"%0.2lf %sbps" ';
$rrd_options .= ' GPRINT:capacityMbps:MAX:"%0.2lf %sbps\r" ';
}
16 changes: 16 additions & 0 deletions html/includes/graphs/device/saf_modemRadialMSE.inc.php
@@ -0,0 +1,16 @@
<?php

require 'includes/graphs/common.inc.php';

$rrdfilename = rrd_name($device['hostname'], 'saf-modem-radio');

if (rrdtool_check_rrd_exists($rrdfilename)) {
$rrd_options .= ' COMMENT:" Now Min Max\r" ';
$rrd_options .= ' DEF:modemRadialMSE='.$rrdfilename.':modemRadialMSE:AVERAGE ';
$rrd_options .= ' CDEF:dividedMSE=modemRadialMSE,10,/ ';
$rrd_options .= ' LINE1:dividedMSE#CC0000:"Radial MSE\l" ';
$rrd_options .= ' COMMENT:\u ';
$rrd_options .= ' GPRINT:dividedMSE:LAST:"%3.2lf dB" ';
$rrd_options .= ' GPRINT:dividedMSE:MIN:"%3.2lf dB" ';
$rrd_options .= ' GPRINT:dividedMSE:MAX:"%3.2lf dB\r" ';
}
15 changes: 15 additions & 0 deletions html/includes/graphs/device/saf_radioRxLevel.inc.php
@@ -0,0 +1,15 @@
<?php

require 'includes/graphs/common.inc.php';

$rrdfilename = rrd_name($device['hostname'], 'saf-modem-radio');

if (rrdtool_check_rrd_exists($rrdfilename)) {
$rrd_options .= ' COMMENT:" Now Min Max\r" ';
$rrd_options .= ' DEF:radioRxLevel='.$rrdfilename.':radioRxLevel:AVERAGE ';
$rrd_options .= ' LINE1:radioRxLevel#CC0000:"RX Level\l" ';
$rrd_options .= ' COMMENT:\u ';
$rrd_options .= ' GPRINT:radioRxLevel:LAST:"%3.2lf dBm" ';
$rrd_options .= ' GPRINT:radioRxLevel:MIN:"%3.2lf dBm" ';
$rrd_options .= ' GPRINT:radioRxLevel:MAX:"%3.2lf dBm\r" ';
}
15 changes: 15 additions & 0 deletions html/includes/graphs/device/saf_radioTxPower.inc.php
@@ -0,0 +1,15 @@
<?php

require 'includes/graphs/common.inc.php';

$rrdfilename = rrd_name($device['hostname'], 'saf-modem-radio');

if (rrdtool_check_rrd_exists($rrdfilename)) {
$rrd_options .= ' COMMENT:" Now Min Max\r" ';
$rrd_options .= ' DEF:radioTxPower='.$rrdfilename.':radioTxPower:AVERAGE ';
$rrd_options .= ' LINE1:radioTxPower#CC0000:"TX Power\l" ';
$rrd_options .= ' COMMENT:\u ';
$rrd_options .= ' GPRINT:radioTxPower:LAST:"%3.2lf dBm" ';
$rrd_options .= ' GPRINT:radioTxPower:MIN:"%3.2lf dBm" ';
$rrd_options .= ' GPRINT:radioTxPower:MAX:"%3.2lf dBm\r" ';
}
21 changes: 19 additions & 2 deletions includes/definitions.inc.php
Expand Up @@ -805,9 +805,9 @@
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
$config['os'][$os]['over'][0]['text'] = 'Traffic';

// Saf Wireless
// SAF Tehnika
$os = 'saf';
$config['os'][$os]['text'] = 'SAF Wireless';
$config['os'][$os]['text'] = 'SAF Tehnika';
$config['os'][$os]['type'] = 'wireless';
$config['os'][$os]['icon'] = 'saf';
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
Expand Down Expand Up @@ -2287,6 +2287,23 @@
$config['graph_types']['device']['siklu_rfinterfaceOtherOctets']['order'] = '6';
$config['graph_types']['device']['siklu_rfinterfaceOtherOctets']['descr'] = 'Other Octets';

// SAF support
$config['graph_types']['device']['saf_radioRxLevel']['section'] = 'wireless';
$config['graph_types']['device']['saf_radioRxLevel']['order'] = '0';
$config['graph_types']['device']['saf_radioRxLevel']['descr'] = 'RX Level';

$config['graph_types']['device']['saf_radioTxPower']['section'] = 'wireless';
$config['graph_types']['device']['saf_radioTxPower']['order'] = '1';
$config['graph_types']['device']['saf_radioTxPower']['descr'] = 'TX Power';

$config['graph_types']['device']['saf_modemRadialMSE']['section'] = 'wireless';
$config['graph_types']['device']['saf_modemRadialMSE']['order'] = '2';
$config['graph_types']['device']['saf_modemRadialMSE']['descr'] = 'Radial MSE';

$config['graph_types']['device']['saf_modemCapacity']['section'] = 'wireless';
$config['graph_types']['device']['saf_modemCapacity']['order'] = '3';
$config['graph_types']['device']['saf_modemCapacity']['descr'] = 'Capacity';

// Sub10 support
$config['graph_types']['device']['sub10_sub10RadioLclTxPower']['section'] = 'wireless';
$config['graph_types']['device']['sub10_sub10RadioLclTxPower']['order'] = '0';
Expand Down
20 changes: 20 additions & 0 deletions includes/discovery/sensors/temperatures/saf.inc.php
@@ -0,0 +1,20 @@
<?php

if ($device['os'] == 'saf') {
$mib = 'SAF-IPRADIO::sysTemperature';
$oid = '.1.3.6.1.4.1.7571.100.1.1.5.1.1.1.5';
$oids = snmp_get($device, $mib, '-OsqnU', 'SAF-IPRADIO');
d_echo($oids."\n");

if (!empty($oids)) {
echo 'SAF Temperature ';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not move this to the next if (!empty($oids)) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed! Just based my work to much on previous files from other brands and i should have been trying to improve the code as a whole! Will arrange it ASAP. Same for other comments regarding voltage and temperature discovery files


$divisor = 1;
$type = 'saf';

list(,$current) = explode(' ', $oids);
$index = $oid;
$descr = 'System Temp';
discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When storing $oid this needs to be the numerical value like .1.3.6.1.2.3.4.5.6.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand this one. So isn't using the MIB name the right way to do it if it does exist? or when you refer to numeric oid, you mean only when calling the discover_sensor and snmp_get is ok with MIB name?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah snmp_get is ok but storing the OID needs to be numerical.

}
}
19 changes: 19 additions & 0 deletions includes/discovery/sensors/voltages/saf.inc.php
@@ -0,0 +1,19 @@
<?php

if ($device['os'] == 'saf') {
$oid = '.1.3.6.1.4.1.7571.100.1.1.5.15.1.2.0';
$oids = snmp_walk($device, "$oid", '-OsqnU', 'SAF-IPRADIO');
d_echo($oids."\n");

if (!empty($oids)) {
echo 'SAF Voltage ';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this + the other two variables into the if (!empty($oids)) { check


$divisor = 1;
$type = 'saf';

list(,$current) = explode(' ', $oids);
$index = $oid;
$descr = 'System voltage';
discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
}
}
47 changes: 47 additions & 0 deletions includes/polling/mib/saf-mib.inc.php
@@ -0,0 +1,47 @@
<?php

echo ' SAF Tehnika ';

$mib_oids = array(
'radioRxLevel' => array(
'local',
'radioRxLevel',
'RX Power',
'GAUGE',
),
'radioTxPower' => array(
'local',
'radioTxPower',
'TX Power',
'GAUGE',
),
'modemRadialMSE' => array(
'local',
'modemRadialMSE',
'Radial MSE',
'GAUGE',
),
'modemACMtotalCapacity' => array(
'local',
'modemACMCapacity',
'ACM Capacity',
'GAUGE',
),
'modemTotalCapacity' => array(
'local',
'modemTotalCapacity',
'Capacity',
'GAUGE',
),
);

$mib_graphs = array(
'saf_radioRxLevel',
'saf_radioTxPower',
'saf_modemRadialMSE',
'saf_modemCapacity',
);

unset($graph, $oids, $oid);

poll_mib_def($device, 'SAF-IPRADIO:saf-modem-radio', 'saf', $mib_oids, $mib_graphs, $graphs);
47 changes: 17 additions & 30 deletions includes/polling/wifi.inc.php
Expand Up @@ -2,53 +2,42 @@

if ($device['type'] == 'network' || $device['type'] == 'firewall' || $device['type'] == 'wireless') {
if ($device['os'] == 'airos') {
echo "It Is Airos\n";
echo 'It Is Airos' . PHP_EOL;
include 'includes/polling/mib/ubnt-airmax-mib.inc.php';
}

if ($device['os'] == 'airos-af') {
echo "It Is AirFIBER\n";
} else if ($device['os'] == 'airos-af') {
echo 'It Is AirFIBER' . PHP_EOL;
include 'includes/polling/mib/ubnt-airfiber-mib.inc.php';
}

if ($device['os'] == 'siklu') {
echo "It is Siklu\n";
} else if ($device['os'] == 'siklu') {
echo 'It is Siklu' . PHP_EOL;
include 'includes/polling/mib/siklu-mib.inc.php';
}

if ($device['os'] == 'sub10') {
echo "It is Sub10\n";
} else if ($device['os'] == 'saf') {
echo 'It is SAF Tehnika' . PHP_EOL;
include 'includes/polling/mib/saf-mib.inc.php';
} else if ($device['os'] == 'sub10') {
echo 'It is Sub10' . PHP_EOL;
include 'includes/polling/mib/sub10-mib.inc.php';
}

// # GENERIC FRAMEWORK, FILLING VARIABLES
if ($device['os'] == 'airport') {
} else if ($device['os'] == 'airport') {
// # GENERIC FRAMEWORK, FILLING VARIABLES
echo 'Checking Airport Wireless clients... ';

$wificlients1 = (snmp_get($device, 'wirelessNumber.0', '-OUqnv', 'AIRPORT-BASESTATION-3-MIB') + 0);

echo $wificlients1." clients\n";

// FIXME Also interesting to poll? dhcpNumber.0 for number of active dhcp leases
}

if ($device['os'] == 'ios' and substr($device['hardware'], 0, 4) == 'AIR-' || ($device['os'] == 'ios' && strpos($device['hardware'], 'ciscoAIR') !== false)) {
} else if ($device['os'] == 'ios' and substr($device['hardware'], 0, 4) == 'AIR-' || ($device['os'] == 'ios' && strpos($device['hardware'], 'ciscoAIR') !== false)) {
echo 'Checking Aironet Wireless clients... ';

$wificlients1 = snmp_get($device, 'cDot11ActiveWirelessClients.1', '-OUqnv', 'CISCO-DOT11-ASSOCIATION-MIB');
$wificlients2 = snmp_get($device, 'cDot11ActiveWirelessClients.2', '-OUqnv', 'CISCO-DOT11-ASSOCIATION-MIB');

echo (($wificlients1 + 0).' clients on dot11Radio0, '.($wificlients2 + 0)." clients on dot11Radio1\n");
}

if ($device['os'] == 'hpmsm') {
} else if ($device['os'] == 'hpmsm') {
echo 'Checking HP MSM Wireless clients... ';
$wificlients1 = snmp_get($device, '.1.3.6.1.4.1.8744.5.25.1.7.2.0', '-OUqnv');
echo $wificlients1." clients\n";
}

// MikroTik RouterOS
if ($device['os'] == 'routeros') {
} else if ($device['os'] == 'routeros') {
// MikroTik RouterOS
// Check inventory for wireless card in device. Valid types be here:
$wirelesscards = array(
'Wireless',
Expand All @@ -66,9 +55,7 @@

unset($wirelesscards);
}
}

if ($device['os'] == 'symbol' and (stristr($device['hardware'], 'AP'))) {
} else if ($device['os'] == 'symbol' and (stristr($device['hardware'], 'AP'))) {
echo 'Checking Symbol Wireless clients... ';

$wificlients1 = snmp_get($device, '.1.3.6.1.4.1.388.11.2.4.2.100.10.1.18.1', '-Ovq', '""');
Expand Down
35 changes: 35 additions & 0 deletions mibs/SAF-ENTERPRISE
@@ -0,0 +1,35 @@
SAF-ENTERPRISE DEFINITIONS ::= BEGIN

-- Definitions for include by other SAF Tehnika mib modules

IMPORTS
enterprises,
MODULE-IDENTITY,
OBJECT-IDENTITY FROM SNMPv2-SMI;


-- saf OBJECT IDENTIFIER ::= { enterprises 7571 }
saf MODULE-IDENTITY
LAST-UPDATED "200704030000Z" -- Apr, 04. 2007
ORGANIZATION "SAF Tehnika"
CONTACT-INFO
"SAF Tehnika technical support
<techsupport@saftehnika.com>"
DESCRIPTION
"SAF Tehnika enterprise spec."
::= { enterprises 7571 }

tehnika OBJECT-IDENTITY
STATUS current
DESCRIPTION
"Subtree to register SAF tehnika modules"
::= { saf 100 }

-- smiv1

microwaveRadio OBJECT IDENTIFIER ::= { tehnika 1}
pointToPoint OBJECT IDENTIFIER ::= { microwaveRadio 1 }
-- end smiv1

--
END