Polling cleanup, fix PHP warnings (#13460)

* Fix warnings up to Arbos

* fixes a-c

* a-r

* a-vrp

* There and back again

* Update test data, couple fixes

* PHPSStan fixes

* style fixes, and fix Asyncos, whoops

* flip serial back.......

* less bogus data

* Poweralert sysName during polling too

* make sure things are calculated in the correct order

* fix style and bad nullables

* update test data

* A comple more conversions

* cambium ptp, misc, and hardware_mib

* remaining except vmware-esxi

* Fixes

* Update baseline

* fixes and fix up baseline

* adjust SnmpQueryMock to upstream options change

* data corrections

* restore slashes

* correctly handle all options input in SnmpQueryMock

* undo ftos changes

* restore vccodec sysDescr
This commit is contained in:
Tony Murray
2021-11-14 14:58:13 -06:00
committed by GitHub
parent bef021b158
commit 7e98e03338
374 changed files with 2313 additions and 3638 deletions

View File

@@ -85,7 +85,7 @@ interface SnmpQueryInterface
* This will override other options set such as setting numeric. Call with no options to reset to default.
* Try to avoid setting options this way to keep the API generic.
*
* @param array|string $options
* @param array|string|null $options
* @return $this
*/
public function options($options = []): SnmpQueryInterface;

View File

@@ -211,7 +211,7 @@ class YamlDiscovery
$name = $discovery_data[$name];
}
if (! is_array($discovery_data['oid']) && isset($pre_cache[$discovery_data['oid']][$index]) && isset($pre_cache[$discovery_data['oid']][$index][$name])) {
if (isset($discovery_data['oid']) && ! is_array($discovery_data['oid']) && isset($pre_cache[$discovery_data['oid']][$index]) && isset($pre_cache[$discovery_data['oid']][$index][$name])) {
return $pre_cache[$discovery_data['oid']][$index][$name];
}

View File

@@ -31,5 +31,5 @@ interface OSPolling
* Poll additional OS data.
* Data must be manually saved within this method.
*/
public function pollOS();
public function pollOS(): void;
}

View File

@@ -234,8 +234,8 @@ class Core implements Module
$uptime = max(
round($sysUpTime / 100),
Config::get("os.$device->os.bad_snmpEngineTime") ? 0 : $uptime_data['SNMP-FRAMEWORK-MIB::snmpEngineTime.0'],
Config::get("os.$device->os.bad_hrSystemUptime") ? 0 : round($uptime_data['HOST-RESOURCES-MIB::hrSystemUptime.0'] / 100)
Config::get("os.$device->os.bad_snmpEngineTime") ? 0 : $uptime_data['SNMP-FRAMEWORK-MIB::snmpEngineTime.0'] ?? 0,
Config::get("os.$device->os.bad_hrSystemUptime") ? 0 : round(($uptime_data['HOST-RESOURCES-MIB::hrSystemUptime.0'] ?? 0) / 100)
);
Log::debug("Uptime seconds: $uptime\n");
}

View File

@@ -63,7 +63,7 @@ class OS implements Module
if (is_file(base_path('/includes/polling/os/' . $device['os'] . '.inc.php'))) {
// OS Specific
include base_path('/includes/polling/os/' . $device['os'] . '.inc.php');
} elseif ($device['os_group'] && is_file(base_path('/includes/polling/os/' . $device['os_group'] . '.inc.php'))) {
} elseif (! empty($device['os_group']) && is_file(base_path('/includes/polling/os/' . $device['os_group'] . '.inc.php'))) {
// OS Group Specific
include base_path('/includes/polling/os/' . $device['os_group'] . '.inc.php');
} else {

View File

@@ -70,8 +70,8 @@ class PrinterSupplies implements Module
foreach ($toner_data as $toner) {
echo 'Checking toner ' . $toner['supply_descr'] . '... ';
$raw_toner = $toner_snmp[$toner['supply_oid']];
$tonerperc = self::getTonerLevel($device, $raw_toner, $toner['supply_capacity']);
$raw_toner = $toner_snmp[$toner['supply_oid']] ?? null;
$tonerperc = self::getTonerLevel($device, $raw_toner, $toner['supply_capacity'] ?? null);
echo $tonerperc . " %\n";
$tags = [
@@ -179,7 +179,7 @@ class PrinterSupplies implements Module
'supply_oid' => $supply_oid,
'supply_capacity_oid' => $capacity_oid,
'supply_index' => $last_index,
'supply_type' => $data['prtMarkerSuppliesType'] ?: 'markerSupply',
'supply_type' => $data['prtMarkerSuppliesType'] ?? 'markerSupply',
'supply_descr' => $descr,
'supply_capacity' => $capacity,
'supply_current' => $current,

View File

@@ -35,7 +35,7 @@ class Aix extends OS implements OSDiscovery
{
$aix_descr = explode("\n", $device->sysDescr);
// AIX standard snmp deamon
if ($aix_descr[1]) {
if (! empty($aix_descr[1])) {
$device->serial = explode('Processor id: ', $aix_descr[1])[1];
$aix_long_version = explode(' version: ', $aix_descr[2])[1];
[$device->version, $aix_version_min] = array_map('intval', explode('.', $aix_long_version));

View File

@@ -37,9 +37,9 @@ class Allied extends OS implements OSDiscovery
//Legacy products: at8024, at8024GB, at8024M, at8016F, at8026FC
$data = snmp_get_multi_oid($this->getDeviceArray(), ['atiswitchProductType.0', 'atiswitchSwVersion.0', 'atiswitchSw.0'], '-OsvQU', 'AtiSwitch-MIB');
$hardware = $data['atiswitchProductType.0'];
$version = $data['atiswitchSwVersion.0'];
$software = $data['atiswitchSw.0'];
$hardware = $data['atiswitchProductType.0'] ?? null;
$version = $data['atiswitchSwVersion.0'] ?? null;
$software = $data['atiswitchSw.0'] ?? null;
if ($software && $version) {
$version = $software . ' ' . $version;
@@ -59,9 +59,9 @@ class Allied extends OS implements OSDiscovery
if (! $hardware && ! $version) {
$data = snmp_get_multi_oid($this->getDeviceArray(), ['.1.3.6.1.4.1.207.8.17.1.3.1.6.1', '.1.3.6.1.4.1.207.8.17.1.3.1.5.1', '.1.3.6.1.4.1.207.8.17.1.3.1.8.1']);
$hardware = $data['.1.3.6.1.4.1.207.8.17.1.3.1.6.1'];
$version = $data['.1.3.6.1.4.1.207.8.17.1.3.1.5.1'];
$serial = $data['.1.3.6.1.4.1.207.8.17.1.3.1.8.1'];
$hardware = $data['.1.3.6.1.4.1.207.8.17.1.3.1.6.1'] ?? null;
$version = $data['.1.3.6.1.4.1.207.8.17.1.3.1.5.1'] ?? null;
$serial = $data['.1.3.6.1.4.1.207.8.17.1.3.1.8.1'] ?? null;
}
//Gets OS outputting "Alliedware Plus" instead of just Alliedware.
@@ -73,7 +73,7 @@ class Allied extends OS implements OSDiscovery
sysDescr.0 = STRING: "Allied Telesyn AT-8948 version 2.7.4-02 22-Aug-2005"
sysDescr.0 = STRING: "Allied Telesis AT-8624T/2M version 2.9.1-13 11-Dec-2007"
Use sysDescr to get Hardware, SW version, and Serial*/
[$a, $b, $c, $d, $e, $f] = explode(' ', $this->getDeviceArray()['sysDescr']);
[$a, $b, $c, $d, $e, $f] = array_pad(explode(' ', $this->getDeviceArray()['sysDescr']), 6, null);
if (! $hardware && ! $version) {
if ($a == 'Allied' && $d == 'version') {
$version = $e;

View File

@@ -1,8 +1,8 @@
<?php
/**
* zebra.inc.php
* Arbos.php
*
* Detect print server information
* -Description-
*
* 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
@@ -19,29 +19,31 @@
*
* @link https://www.librenms.org
*
* @copyright 2017 Tony Murray
* @copyright 2021 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
// ESI-MIB::genProductNumber.0 .1.3.6.1.4.1.683.1.4.0
// ESI-MIB::genSerialNumber.0 .1.3.6.1.4.1.683.1.5.0
// ESI-MIB::genVersion.0 .1.3.6.1.4.1.683.1.9.0
use Illuminate\Support\Str;
namespace LibreNMS\OS;
if (Str::startsWith($device['sysObjectID'], '.1.3.6.1.4.1.683')) {
$oids = [
'hardware' => '.1.3.6.1.4.1.683.1.4.0',
'serial' => '.1.3.6.1.4.1.683.1.5.0',
'version' => '.1.3.6.1.4.1.683.1.9.0',
];
$os_data = snmp_get_multi_oid($device, $oids);
foreach ($oids as $var => $oid) {
$$var = trim($os_data[$oid], '"');
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\OS;
use LibreNMS\RRD\RrdDefinition;
use SnmpQuery;
class Arbos extends OS implements OSPolling
{
public function pollOS(): void
{
$flows = SnmpQuery::get('PEAKFLOW-SP-MIB::deviceTotalFlows.0')->value();
if (is_numeric($flows)) {
app('Datastore')->put($this->getDeviceArray(), 'arbos_flows', [
'rrd_def' => RrdDefinition::make()->addDataset('flows', 'GAUGE', 0, 3000000),
], [
'flows' => $flows,
]);
$this->enableGraph('arbos_flows');
}
}
}
if (Str::contains($device['sysDescr'], 'Wireless')) {
$features = 'wireless';
} else {
$features = 'wired';
}

View File

@@ -1,8 +1,8 @@
<?php
/**
* etherwan.inc.php
* Areca.php
*
* LibreNMS os poller module for Etherwan 6TX + 2G Managed Switch
* -Description-
*
* 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
@@ -19,15 +19,25 @@
*
* @link https://www.librenms.org
*
* @copyright 2017 Lorenzo Zafra
* @author Lorenzo Zafra<zafra@ualberta.ca>
* @copyright 2021 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
preg_match('~(?\'hardware\'.*?),\sFirmware\srev:\s(?\'version\'.*) \d\d\/\d\d\/\d\d~', $device['sysDescr'], $matches);
if ($matches['hardware']) {
$hardware = $matches['hardware'];
}
namespace LibreNMS\OS;
if ($matches['version']) {
$version = $matches['version'];
use App\Models\Device;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\OS;
class Areca extends OS implements OSDiscovery
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); //yaml
// Sometimes firmware outputs serial as hex-string
if (isHexString($device->serial)) {
$device->serial = snmp_hexstring($device->serial);
}
}
}

41
LibreNMS/OS/ArrisCm.php Normal file
View File

@@ -0,0 +1,41 @@
<?php
/**
* ArrisCm.php
*
* -Description-
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* @link https://www.librenms.org
*
* @copyright 2021 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\OS;
class ArrisCm extends OS implements OSDiscovery
{
public function discoverOS(Device $device): void
{
preg_match('/<<HW_REV: (?<rev>.+); VENDOR:.*SW_REV: (?<version>.+); MODEL: (?<hardware>.+)>>/', $device->sysDescr, $matches);
$device->hardware = "{$matches['hardware']} (Rev: {$matches['rev']})";
$device->version = $matches['version'];
}
}

View File

@@ -50,14 +50,14 @@ class Arubaos extends OS implements
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
$aruba_info = snmp_get_multi($this->getDeviceArray(), [
'wlsxSwitchRole.0',
'wlsxSwitchMasterIp.0',
'wlsxSwitchLicenseSerialNumber.0',
], '-OQUs', 'WLSX-SWITCH-MIB');
$aruba_info = \SnmpQuery::get([
'WLSX-SWITCH-MIB::wlsxSwitchRole.0',
'WLSX-SWITCH-MIB::wlsxSwitchMasterIp.0',
'WLSX-SWITCH-MIB::wlsxSwitchLicenseSerialNumber.0',
])->values();
$device->features = $aruba_info[0]['wlsxSwitchRole'] == 'master' ? 'Master Controller' : "Local Controller for {$aruba_info[0]['wlsxSwitchMasterIp']}";
$device->serial = $aruba_info[0]['wlsxSwitchLicenseSerialNumber'];
$device->features = ($aruba_info['WLSX-SWITCH-MIB::wlsxSwitchRole.0'] ?? null) == 'master' ? 'Master Controller' : 'Local Controller for ' . ($aruba_info['WLSX-SWITCH-MIB::wlsxSwitchMasterIp.0'] ?? null);
$device->serial = $aruba_info['WLSX-SWITCH-MIB::wlsxSwitchLicenseSerialNumber.0'] ?? null;
}
/**

51
LibreNMS/OS/Asyncos.php Normal file
View File

@@ -0,0 +1,51 @@
<?php
/**
* Asyncos.php
*
* -Description-
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* @link https://www.librenms.org
*
* @copyright 2021 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\OS;
use LibreNMS\RRD\RrdDefinition;
class Asyncos extends OS implements OSPolling
{
public function pollOS(): void
{
// Get stats only if device is web proxy
if ($this->getDevice()->sysObjectID == '.1.3.6.1.4.1.15497.1.2') {
$connections = \SnmpQuery::get('TCP-MIB::tcpCurrEstab.0')->value();
if (is_numeric($connections)) {
data_update($this->getDeviceArray(), 'asyncos_conns', [
'rrd_def' => RrdDefinition::make()->addDataset('connections', 'GAUGE', 0, 50000),
], [
'connections' => $connections,
]);
$this->enableGraph('asyncos_conns');
}
}
}
}

View File

@@ -40,7 +40,7 @@ class Barracudangfirewall extends OS implements OSDiscovery, OSPolling
}
}
public function pollOS()
public function pollOS(): void
{
// TODO move to count sensor
$sessions = snmp_get($this->getDeviceArray(), 'firewallSessions64.8.102.119.83.116.97.116.115.0', '-OQv', 'PHION-MIB');

View File

@@ -41,10 +41,10 @@ class Boss extends OS implements OSDiscovery, ProcessorDiscovery
$version = $version_matches[1] ?? null;
if (empty($version)) {
$version = explode(' on', snmp_get($this->getDeviceArray(), '.1.3.6.1.4.1.2272.1.1.7.0', '-Oqvn'))[0] ?? null;
$version = explode(' on', snmp_get($this->getDeviceArray(), '.1.3.6.1.4.1.2272.1.1.7.0', '-Oqvn'))[0] ?: null;
}
if (empty($version)) {
$version = snmp_get($this->getDeviceArray(), '.1.3.6.1.4.1.45.1.6.4.2.1.10.0', '-Oqvn') ?? null;
$version = snmp_get($this->getDeviceArray(), '.1.3.6.1.4.1.45.1.6.4.2.1.10.0', '-Oqvn') ?: null;
}
$device->version = $version;
@@ -54,7 +54,7 @@ class Boss extends OS implements OSDiscovery, ProcessorDiscovery
// Make boss devices hardware string compact
$details = str_replace('Ethernet Routing Switch ', 'ERS-', $details);
$details = str_replace('Virtual Services Platform ', 'VSP-', $details);
$device->hardware = explode(' ', $details, 2)[0] ?? null;
$device->hardware = explode(' ', $details, 2)[0] ?: null;
// Is this a 5500 series or 5600 series stack?
$stack = snmp_walk($this->getDeviceArray(), '.1.3.6.1.4.1.45.1.6.3.3.1.1.6.8', '-OsqnU');

View File

@@ -43,7 +43,7 @@ class Ciscosb extends OS implements OSDiscovery
} elseif ($device->sysObjectID == '.1.3.6.1.4.1.9.6.1.89.26.1') {
$hardware = 'SG220-26';
} else {
$hardware = str_replace(' ', '', $data['1']['rlPhdUnitGenParamModelName']);
$hardware = str_replace(' ', '', $data['1']['rlPhdUnitGenParamModelName'] ?? '');
}
$device->hardware = $hardware;
}
@@ -54,8 +54,8 @@ class Ciscosb extends OS implements OSDiscovery
}
$device->version = isset($data['1']['rlPhdUnitGenParamSoftwareVersion']) ? ('Software ' . $data['1']['rlPhdUnitGenParamSoftwareVersion']) : null;
$boot = $data['0']['rndBaseBootVersion'];
$firmware = $data['1']['rlPhdUnitGenParamFirmwareVersion'];
$boot = $data['0']['rndBaseBootVersion'] ?? null;
$firmware = $data['1']['rlPhdUnitGenParamFirmwareVersion'] ?? null;
if ($boot) {
$device->version .= ", Bootldr $boot";
}

View File

@@ -25,15 +25,111 @@
namespace LibreNMS\OS;
use App\Models\AccessPoint;
use Illuminate\Support\Arr;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessApCountDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessClientsDiscovery;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\OS\Shared\Cisco;
use LibreNMS\RRD\RrdDefinition;
class Ciscowlc extends Cisco implements
OSPolling,
WirelessClientsDiscovery,
WirelessApCountDiscovery
{
public function pollOS(): void
{
$device = $this->getDeviceArray();
$stats = snmpwalk_cache_oid($device, 'bsnAPEntry', [], 'AIRESPACE-WIRELESS-MIB', null, '-OQUsb');
$radios = snmpwalk_cache_oid($device, 'bsnAPIfEntry', [], 'AIRESPACE-WIRELESS-MIB', null, '-OQUsb');
$APstats = snmpwalk_cache_oid($device, 'bsnApIfNoOfUsers', [], 'AIRESPACE-WIRELESS-MIB', null, '-OQUsxb');
$loadParams = snmpwalk_cache_oid($device, 'bsnAPIfLoadChannelUtilization', [], 'AIRESPACE-WIRELESS-MIB', null, '-OQUsb');
$interferences = snmpwalk_cache_oid($device, 'bsnAPIfInterferencePower', [], 'AIRESPACE-WIRELESS-MIB', null, '-OQUsb');
$numAccessPoints = is_countable($stats) ? count($stats) : 0;
$numClients = 0;
foreach (Arr::wrap($APstats) as $value) {
$numClients += $value['bsnApIfNoOfUsers'];
}
$rrd_def = RrdDefinition::make()
->addDataset('NUMAPS', 'GAUGE', 0, 12500000000)
->addDataset('NUMCLIENTS', 'GAUGE', 0, 12500000000);
$fields = [
'NUMAPS' => $numAccessPoints,
'NUMCLIENTS' => $numClients,
];
$tags = compact('rrd_def');
data_update($device, 'ciscowlc', $tags, $fields);
$db_aps = $this->getDevice()->accessPoints->keyBy->getCompositeKey();
foreach ($radios as $key => $value) {
$indexName = substr($key, 0, -2);
$channel = str_replace('ch', '', $value['bsnAPIfPhyChannelNumber'] ?? '');
$ap = new AccessPoint([
'name' => $stats[$indexName]['bsnAPName'] ?? '',
'radio_number' => Arr::first(explode('.', $key)),
'type' => $value['bsnAPIfType'] ?? '',
'mac_addr' => str_replace(' ', ':', $stats[$indexName]['bsnAPDot3MacAddress'] ?? ''),
'channel' => $channel,
'txpow' => $value['bsnAPIfPhyTxPowerLevel'] ?? 0,
'radioutil' => $loadParams[$key]['bsnAPIfLoadChannelUtilization'] ?? 0,
'numasoclients' => $value['bsnApIfNoOfUsers'] ?? 0,
'nummonclients' => 0,
'nummonbssid' => 0,
'interference' => 128 + ($interferences[$key . '.' . $channel]['bsnAPIfInterferencePower'] ?? -128),
]);
d_echo($ap->toArray());
// if there is a numeric channel, assume the rest of the data is valid, I guess
if (! is_numeric($ap->channel)) {
continue;
}
$rrd_def = RrdDefinition::make()
->addDataset('channel', 'GAUGE', 0, 200)
->addDataset('txpow', 'GAUGE', 0, 200)
->addDataset('radioutil', 'GAUGE', 0, 100)
->addDataset('nummonclients', 'GAUGE', 0, 500)
->addDataset('nummonbssid', 'GAUGE', 0, 200)
->addDataset('numasoclients', 'GAUGE', 0, 500)
->addDataset('interference', 'GAUGE', 0, 2000);
data_update($device, 'arubaap', [
'name' => $ap->name,
'radionum' => $ap->radio_number,
'rrd_name' => ['arubaap', $ap->name . $ap->radio_number],
'rrd_dev' => $rrd_def,
], $ap->only([
'channel',
'txpow',
'radioutil',
'nummonclients',
'nummonbssid',
'numasoclients',
'interference',
]));
/** @var AccessPoint $db_ap */
if ($db_ap = $db_aps->get($ap->getCompositeKey())) {
$db_aps->forget($ap->getCompositeKey());
$ap = $db_ap->fill($ap->getAttributes());
}
$ap->save(); // persist ap
}
$db_aps->each->delete(); // delete those not removed
}
/**
* Discover wireless client counts. Type is clients.
* Returns an array of LibreNMS\Device\Sensor objects that have been discovered

View File

@@ -100,7 +100,7 @@ class Comware extends OS implements MempoolsDiscovery, ProcessorDiscovery
'mempool_descr' => $entity_name[$index],
'mempool_precision' => 1,
'mempool_perc_oid' => ".1.3.6.1.4.1.25506.2.6.1.1.1.1.8.$index",
]))->fillUsage(null, $entry['hh3cEntityExtMemSize'], null, $entry['hh3cEntityExtMemUsage']));
]))->fillUsage(null, $entry['hh3cEntityExtMemSize'] ?? null, null, $entry['hh3cEntityExtMemUsage'] ?? null));
}
}

View File

@@ -32,7 +32,7 @@ use Log;
class Coriant extends \LibreNMS\OS implements OSPolling
{
public function pollOS()
public function pollOS(): void
{
echo 'TNMS-NBI-MIB: enmsNETable';

View File

@@ -26,29 +26,26 @@
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\OS\Shared\Printer;
class DellLaser extends \LibreNMS\OS
class DellLaser extends Printer
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
parent::discoverOS($device); // printer + yaml
// SNMPv2-SMI::enterprises.253.8.51.10.2.1.7.2.28110202 = STRING: "MFG:Dell;CMD:PJL,RASTER,DOWNLOAD,PCLXL,PCL,POSTSCRIPT;MDL:Laser Printer
// 3100cn;DES:Dell Laser Printer 3100cn;CLS:PRINTER;STS:AAAMAwAAAAAAAgJ/HgMKBigDCgY8AwAzcJqwggAAwAAACAAAAAAA/w==;"
$modelinfo = explode(';', snmp_get($this->getDeviceArray(), '1.3.6.1.4.1.253.8.51.10.2.1.7.2.28110202', '-OQv'));
// SNMPv2-SMI::enterprises.674.10898.100.2.1.2.1.3.1 = STRING: "COMMAND SET:;MODEL:Dell Laser Printer 5310n"
$modelinfo = array_merge($modelinfo, explode(';', snmp_get($this->getDeviceArray(), '1.3.6.1.4.1.674.10898.100.2.1.2.1.3.1', '-OQv', '', '')));
// SNMPv2-SMI::enterprises.641.2.1.2.1.3.1 = STRING: "COMMAND SET:;MODEL:Dell Laser Printer 1700n"
$modelinfo = array_merge($modelinfo, explode(';', snmp_get($this->getDeviceArray(), '1.3.6.1.4.1.641.2.1.2.1.3.1', '-OQv', '', '')));
$data = \SnmpQuery::get([
'1.3.6.1.4.1.253.8.51.10.2.1.7.2.28110202',
'1.3.6.1.4.1.674.10898.100.2.1.2.1.3.1',
'1.3.6.1.4.1.641.2.1.2.1.3.1',
])->values();
$dell_laser = [];
foreach ($modelinfo as $line) {
[$key, $value] = explode(':', $line);
$dell_laser[$key] = $value;
}
$dell_laser = $this->parseDeviceId(implode(PHP_EOL, $data));
$device->hardware = $dell_laser['MDL'] ?: $dell_laser['MODEL'];
$device->hardware = $dell_laser['MDL'] ?? $dell_laser['MODEL'] ?? null;
}
}

View File

@@ -54,13 +54,13 @@ class Edgecos extends OS implements MempoolsDiscovery, ProcessorDiscovery
'mempool_perc_warn' => 90,
]);
if ($data['memoryAllocated.0']) {
if (! empty($data['memoryAllocated.0'])) {
$mempool->mempool_used_oid = YamlDiscovery::oidToNumeric('memoryAllocated.0', $this->getDeviceArray(), $mib);
} else {
$mempool->mempool_free_oid = YamlDiscovery::oidToNumeric('memoryFreed.0', $this->getDeviceArray(), $mib);
}
$mempool->fillUsage($data['memoryAllocated.0'], $data['memoryTotal.0'], $data['memoryFreed.0']);
$mempool->fillUsage($data['memoryAllocated.0'] ?? null, $data['memoryTotal.0'] ?? null, $data['memoryFreed.0']);
return collect([$mempool]);
}
@@ -70,7 +70,7 @@ class Edgecos extends OS implements MempoolsDiscovery, ProcessorDiscovery
$mib = $this->findMib();
$data = snmp_get_multi($this->getDeviceArray(), ['swOpCodeVer.1', 'swProdName.0', 'swSerialNumber.1', 'swHardwareVer.1'], '-OQUs', $mib);
$device->version = trim($data[1]['swHardwareVer'] . ' ' . $data[1]['swOpCodeVer']) ?: null;
$device->version = isset($data[1]['swHardwareVer'], $data[1]['swOpCodeVer']) ? trim($data[1]['swHardwareVer'] . ' ' . $data[1]['swOpCodeVer']) : null;
$device->hardware = $data[0]['swProdName'] ?? null;
$device->serial = $data[1]['swSerialNumber'] ?? null;
}

84
LibreNMS/OS/Engenius.php Normal file
View File

@@ -0,0 +1,84 @@
<?php
/*
* Engenius.php
*
* -Description-
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2021 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\OS;
class Engenius extends OS
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
// SENAO-ENTERPRISE-INDOOR-AP-CB-MIB::entSysMode.0
$data = \SnmpQuery::numeric()->get([
'.1.3.6.1.4.1.14125.2.1.1.5.0',
'.1.3.6.1.4.1.14125.3.1.1.5.0',
'.1.3.6.1.4.1.14125.100.1.4.0',
'.1.3.6.1.4.1.14125.100.1.6.0',
'.1.3.6.1.4.1.14125.100.1.7.0',
'.1.3.6.1.4.1.14125.100.1.8.0',
'.1.3.6.1.4.1.14125.100.1.9.0',
])->values();
// Sorry about the OIDs but there doesn't seem to be a matching MIB available... :-/
if (! empty($data['.1.3.6.1.4.1.14125.100.1.8.0']) && ! empty($data['.1.3.6.1.4.1.14125.100.1.9.0'])) {
$device->version = 'Kernel ' . $data['.1.3.6.1.4.1.14125.100.1.8.0'] . ' / Apps ' . $data['.1.3.6.1.4.1.14125.100.1.9.0'];
} else {
$device->version = isset($data['.1.3.6.1.4.1.14125.2.1.1.5.0']) ? 'Firmware ' . $data['.1.3.6.1.4.1.14125.2.1.1.5.0'] : null;
}
$device->serial = $data['.1.3.6.1.4.1.14125.100.1.7.0'] ?? null;
// There doesn't seem to be a real hardware identification.. sysName will have to do?
if (! empty($data['.1.3.6.1.4.1.14125.100.1.6.0'])) {
$device->hardware = str_replace('EnGenius ', '', $device->sysName) . ' v' . $data['.1.3.6.1.4.1.14125.100.1.6.0'];
} else {
$device->hardware = $device->sysName . ($data['.1.3.6.1.4.1.14125.3.1.1.5.0'] ?? '');
}
switch ($data['.1.3.6.1.4.1.14125.100.1.4.0'] ?? null) {
case 0:
$device->features = 'Router mode';
break;
case 1:
$device->features = 'Universal repeater mode';
break;
case 2:
$device->features = 'Access Point mode';
break;
case 3:
$device->features = 'Client Bridge mode';
break;
case 4:
$device->features = 'Client router mode';
break;
case 5:
$device->features = 'WDS Bridge mode';
break;
}
}
}

View File

@@ -36,7 +36,7 @@ class Enterasys extends \LibreNMS\OS implements MempoolsDiscovery
$mem = snmpwalk_group($this->getDeviceArray(), 'etsysResourceStorageTable', 'ENTERASYS-RESOURCE-UTILIZATION-MIB', 3);
foreach ($mem as $index => $mem_data) {
foreach ($mem_data['ram'] as $mem_id => $ram) {
foreach ($mem_data['ram'] ?? [] as $mem_id => $ram) {
$descr = $ram['etsysResourceStorageDescr'];
if ($index > 1000) {
$descr = 'Slot #' . substr($index, -1) . " $descr";
@@ -50,7 +50,7 @@ class Enterasys extends \LibreNMS\OS implements MempoolsDiscovery
'mempool_precision' => 1024,
'mempool_free_oid' => ".1.3.6.1.4.1.5624.1.2.49.1.3.1.1.5.$index.2.$mem_id",
'mempool_perc_warn' => 90,
]))->fillUsage(null, $ram['etsysResourceStorageSize'], $ram['etsysResourceStorageAvailable']));
]))->fillUsage(null, $ram['etsysResourceStorageSize'] ?? null, $ram['etsysResourceStorageAvailable'] ?? null));
}
}

View File

@@ -25,19 +25,119 @@
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessClientsDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessFrequencyDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRssiDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessSnrDiscovery;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\OS;
use LibreNMS\RRD\RrdDefinition;
class Epmp extends OS implements
OSPolling,
WirelessRssiDiscovery,
WirelessSnrDiscovery,
WirelessFrequencyDiscovery,
WirelessClientsDiscovery
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
$data = \SnmpQuery::get([
'CAMBIUM-PMP80211-MIB::wirelessInterfaceMode.0',
'CAMBIUM-PMP80211-MIB::cambiumSubModeType.0',
])->values();
$epmp_ap = $data['CAMBIUM-PMP80211-MIB::wirelessInterfaceMode.0'] ?? null;
$epmp_number = $data['CAMBIUM-PMP80211-MIB::cambiumSubModeType.0'] ?? null;
if ($epmp_ap == 1) {
$device->hardware = $epmp_number == 5 ? 'ePTP Master' : 'ePMP AP';
} elseif ($epmp_ap == 2) {
$device->hardware = $epmp_number == 4 ? 'ePTP Slave' : 'ePMP SM';
}
}
public function pollOS(): void
{
$device = $this->getDeviceArray();
$cambiumGPSNumTrackedSat = snmp_get($device, 'cambiumGPSNumTrackedSat.0', '-Ovqn', 'CAMBIUM-PMP80211-MIB');
$cambiumGPSNumVisibleSat = snmp_get($device, 'cambiumGPSNumVisibleSat.0', '-Ovqn', 'CAMBIUM-PMP80211-MIB');
if (is_numeric($cambiumGPSNumTrackedSat) && is_numeric($cambiumGPSNumVisibleSat)) {
$rrd_def = RrdDefinition::make()
->addDataset('numTracked', 'GAUGE', 0, 100000)
->addDataset('numVisible', 'GAUGE', 0, 100000);
$fields = [
'numTracked' => $cambiumGPSNumTrackedSat,
'numVisible' => $cambiumGPSNumVisibleSat,
];
$tags = compact('rrd_def');
data_update($device, 'cambium-epmp-gps', $tags, $fields);
$this->enableGraph('cambium_epmp_gps');
}
$cambiumSTAUplinkMCSMode = snmp_get($device, 'cambiumSTAUplinkMCSMode.0', '-Ovqn', 'CAMBIUM-PMP80211-MIB');
$cambiumSTADownlinkMCSMode = snmp_get($device, 'cambiumSTADownlinkMCSMode.0', '-Ovqn', 'CAMBIUM-PMP80211-MIB');
if (is_numeric($cambiumSTAUplinkMCSMode) && is_numeric($cambiumSTADownlinkMCSMode)) {
$rrd_def = RrdDefinition::make()
->addDataset('uplinkMCSMode', 'GAUGE', -30, 30)
->addDataset('downlinkMCSMode', 'GAUGE', -30, 30);
$fields = [
'uplinkMCSMode' => $cambiumSTAUplinkMCSMode,
'downlinkMCSMode' => $cambiumSTADownlinkMCSMode,
];
$tags = compact('rrd_def');
data_update($device, 'cambium-epmp-modulation', $tags, $fields);
$this->enableGraph('cambium_epmp_modulation');
}
$sysNetworkEntryAttempt = snmp_get($device, 'sysNetworkEntryAttempt.0', '-Ovqn', 'CAMBIUM-PMP80211-MIB');
$sysNetworkEntrySuccess = snmp_get($device, 'sysNetworkEntrySuccess.0', '-Ovqn', 'CAMBIUM-PMP80211-MIB');
$sysNetworkEntryAuthenticationFailure = snmp_get($device, 'sysNetworkEntryAuthenticationFailure.0', '-Ovqn', 'CAMBIUM-PMP80211-MIB');
if (is_numeric($sysNetworkEntryAttempt) && is_numeric($sysNetworkEntrySuccess) && is_numeric($sysNetworkEntryAuthenticationFailure)) {
$rrd_def = RrdDefinition::make()
->addDataset('entryAttempt', 'GAUGE', 0, 100000)
->addDataset('entryAccess', 'GAUGE', 0, 100000)
->addDataset('authFailure', 'GAUGE', 0, 100000);
$fields = [
'entryAttempt' => $sysNetworkEntryAttempt,
'entryAccess' => $sysNetworkEntrySuccess,
'authFailure' => $sysNetworkEntryAuthenticationFailure,
];
$tags = compact('rrd_def');
data_update($device, 'cambium-epmp-access', $tags, $fields);
$this->enableGraph('cambium_epmp_access');
}
$multi_get_array = snmp_get_multi($device, ['ulWLanTotalAvailableFrameTimePerSecond.0', 'ulWLanTotalUsedFrameTimePerSecond.0', 'dlWLanTotalAvailableFrameTimePerSecond.0', 'dlWLanTotalUsedFrameTimePerSecond.0'], '-OQU', 'CAMBIUM-PMP80211-MIB');
$ulWLanTotalAvailableFrameTimePerSecond = $multi_get_array[0]['CAMBIUM-PMP80211-MIB::ulWLanTotalAvailableFrameTimePerSecond'] ?? null;
$ulWLanTotalUsedFrameTimePerSecond = $multi_get_array[0]['CAMBIUM-PMP80211-MIB::ulWLanTotalUsedFrameTimePerSecond'] ?? null;
$dlWLanTotalAvailableFrameTimePerSecond = $multi_get_array[0]['CAMBIUM-PMP80211-MIB::dlWLanTotalAvailableFrameTimePerSecond'] ?? null;
$dlWLanTotalUsedFrameTimePerSecond = $multi_get_array[0]['CAMBIUM-PMP80211-MIB::dlWLanTotalUsedFrameTimePerSecond'] ?? null;
if (is_numeric($ulWLanTotalAvailableFrameTimePerSecond) && is_numeric($ulWLanTotalUsedFrameTimePerSecond) && $ulWLanTotalAvailableFrameTimePerSecond && $ulWLanTotalUsedFrameTimePerSecond) {
$ulWlanFrameUtilization = round(($ulWLanTotalUsedFrameTimePerSecond / $ulWLanTotalAvailableFrameTimePerSecond) * 100, 2);
$dlWlanFrameUtilization = round(($dlWLanTotalUsedFrameTimePerSecond / $dlWLanTotalAvailableFrameTimePerSecond) * 100, 2);
d_echo($dlWlanFrameUtilization);
d_echo($ulWlanFrameUtilization);
$rrd_def = RrdDefinition::make()
->addDataset('ulwlanfrut', 'GAUGE', 0, 100000)
->addDataset('dlwlanfrut', 'GAUGE', 0, 100000);
$fields = [
'ulwlanframeutilization' => $ulWlanFrameUtilization,
'dlwlanframeutilization' => $dlWlanFrameUtilization,
];
$tags = compact('rrd_def');
data_update($device, 'cambium-epmp-frameUtilization', $tags, $fields);
$this->enableGraph('cambium-epmp-frameUtilization');
}
}
/**
* Discover wireless bit/packet error ratio. This is in percent. Type is error-ratio.
* Returns an array of LibreNMS\Device\Sensor objects that have been discovered

View File

@@ -34,8 +34,8 @@ class Exa extends OS implements OSDiscovery
public function discoverOS(Device $device): void
{
$info = snmp_getnext_multi($this->getDeviceArray(), ['e7CardSoftwareVersion', 'e7CardSerialNumber'], '-OQUs', 'E7-Calix-MIB');
$device->version = $info['e7CardSoftwareVersion'];
$device->serial = $info['e7CardSerialNumber'];
$device->version = $info['e7CardSoftwareVersion'] ?? null;
$device->serial = $info['e7CardSerialNumber'] ?? null;
$device->hardware = 'Calix ' . $device->sysDescr;
$cards = explode("\n", snmp_walk($this->getDeviceArray(), 'e7CardProvType', '-OQv', 'E7-Calix-MIB'));

97
LibreNMS/OS/F5.php Normal file
View File

@@ -0,0 +1,97 @@
<?php
/**
* F5.php
*
* -Description-
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* @link https://www.librenms.org
*
* @copyright 2021 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\OS;
use LibreNMS\RRD\RrdDefinition;
class F5 extends OS implements OSPolling
{
public function pollOS(): void
{
$metadata = [
'F5-BIGIP-APM-MIB::apmAccessStatCurrentActiveSessions.0' => [
'dataset' => 'sessions',
'type' => 'GAUGE',
'name' => 'bigip_apm_sessions',
],
'F5-BIGIP-SYSTEM-MIB::sysStatClientTotConns.0' => [
'dataset' => 'ClientTotConns',
'type' => 'COUNTER',
'name' => 'bigip_system_client_connection_rate',
],
'F5-BIGIP-SYSTEM-MIB::sysStatServerTotConns.0' => [
'dataset' => 'ServerTotConns',
'type' => 'COUNTER',
'name' => 'bigip_system_server_connection_rate',
],
'F5-BIGIP-SYSTEM-MIB::sysStatClientCurConns.0' => [
'dataset' => 'ClientCurConns',
'type' => 'GAUGE',
'name' => 'bigip_system_client_concurrent_connections',
],
'F5-BIGIP-SYSTEM-MIB::sysStatServerCurConns.0' => [
'dataset' => 'ServerCurConns',
'type' => 'GAUGE',
'name' => 'bigip_system_server_concurrent_connections',
],
];
// fetch data
$data = \SnmpQuery::get(array_keys($metadata) + [
'F5-BIGIP-SYSTEM-MIB::sysClientsslStatTotNativeConns.0',
'F5-BIGIP-SYSTEM-MIB::sysClientsslStatTotCompatConns.0',
])->values();
// connections
foreach ($metadata as $key => $info) {
if (isset($data[$key]) && is_numeric($data[$key])) {
$rrd_def = RrdDefinition::make()->addDataset($info['dataset'], $info['type'], 0);
$fields = [
$info['dataset'] => $data[$key],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), $info['name'], $tags, $fields);
$this->enableGraph($info['name']);
}
}
// SSL TPS
if (isset($data['F5-BIGIP-SYSTEM-MIB::sysClientsslStatTotNativeConns.0'], $data['F5-BIGIP-SYSTEM-MIB::sysClientsslStatTotCompatConns.0'])) {
$rrd_def = RrdDefinition::make()
->addDataset('TotNativeConns', 'COUNTER', 0)
->addDataset('TotCompatConns', 'COUNTER', 0);
$fields = [
'TotNativeConns' => $data['F5-BIGIP-SYSTEM-MIB::sysClientsslStatTotNativeConns.0'],
'TotCompatConns' => $data['F5-BIGIP-SYSTEM-MIB::sysClientsslStatTotCompatConns.0'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'bigip_system_tps', $tags, $fields);
$this->enableGraph('bigip_system_tps');
}
}
}

View File

@@ -45,7 +45,7 @@ class Fortigate extends Fortinet implements
$device->hardware = $device->hardware ?: $this->getHardwareName();
}
public function pollOS()
public function pollOS(): void
{
$sessions = snmp_get($this->getDeviceArray(), 'FORTINET-FORTIGATE-MIB::fgSysSesCount.0', '-Ovq');
if (is_numeric($sessions)) {

View File

@@ -40,7 +40,7 @@ class Fortios extends Fortinet implements OSPolling
$device->features = snmp_get($this->getDeviceArray(), 'fmDeviceEntMode.1', '-OQv', 'FORTINET-FORTIMANAGER-FORTIANALYZER-MIB') == 'fmg-faz' ? 'with Analyzer features' : null;
}
public function pollOS()
public function pollOS(): void
{
// Log rate only for FortiAnalyzer features enabled FortiManagers
if ($this->getDevice()->features == 'with Analyzer features') {

View File

@@ -7,7 +7,7 @@ use LibreNMS\RRD\RrdDefinition;
class Gaia extends \LibreNMS\OS implements OSPolling
{
public function pollOS()
public function pollOS(): void
{
$oids = ['fwLoggingHandlingRate.0', 'mgLSLogReceiveRate.0', 'fwNumConn.0', 'fwAccepted.0', 'fwRejected.0', 'fwDropped.0', 'fwLogged.0'];
@@ -16,7 +16,7 @@ class Gaia extends \LibreNMS\OS implements OSPolling
//#############
// Create firewall lograte/handlingrate rrd
//#############
if (is_numeric($data[0]['fwLoggingHandlingRate'])) {
if (is_numeric($data[0]['fwLoggingHandlingRate'] ?? null)) {
$rrd_def = RrdDefinition::make()->addDataset('fwlograte', 'GAUGE', 0);
$fields = [
@@ -31,7 +31,7 @@ class Gaia extends \LibreNMS\OS implements OSPolling
//#############
// Create MGMT logserver lograte rrd
//#############
if (is_numeric($data[0]['mgLSLogReceiveRate'])) {
if (is_numeric($data[0]['mgLSLogReceiveRate'] ?? null)) {
$rrd_def = RrdDefinition::make()->addDataset('LogReceiveRate', 'GAUGE', 0);
$fields = [
@@ -46,7 +46,7 @@ class Gaia extends \LibreNMS\OS implements OSPolling
//#############
// Create firewall active connections rrd
//#############
if (is_numeric($data[0]['fwNumConn'])) {
if (is_numeric($data[0]['fwNumConn'] ?? null)) {
$rrd_def = RrdDefinition::make()->addDataset('NumConn', 'GAUGE', 0);
$fields = [
@@ -61,7 +61,7 @@ class Gaia extends \LibreNMS\OS implements OSPolling
//#############
// Create firewall packets rrd
//#############
if (is_numeric($data[0]['fwAccepted']) && is_numeric($data[0]['fwRejected']) && is_numeric($data[0]['fwDropped']) && is_numeric($data[0]['fwLogged'])) {
if (is_numeric($data[0]['fwAccepted'] ?? null) && is_numeric($data[0]['fwRejected'] ?? null) && is_numeric($data[0]['fwDropped'] ?? null) && is_numeric($data[0]['fwLogged'] ?? null)) {
$rrd_def = RrdDefinition::make()
->addDataset('accepted', 'DERIVE', 0)
->addDataset('rejected', 'DERIVE', 0)

View File

@@ -1,8 +1,8 @@
<?php
/**
* arris-cm.inc.php
* Hpvc.php
*
* LibreNMS os polling module for Arris Cable Modem (DOCSIS)
* -Description-
*
* 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
@@ -19,10 +19,22 @@
*
* @link https://www.librenms.org
*
* @copyright 2017 Tony Murray
* @copyright 2021 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
preg_match('/<<HW_REV: (.+); VENDOR:.*SW_REV: (.+); MODEL: (.+)>>/', $device['sysDescr'], $matches);
$hardware = $matches[3] . ' (Rev: ' . $matches[1] . ')';
$version = $matches[2];
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\OS;
class Hpvc extends OS
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
// Serial number is in sysName after string "VCEX"
$device->serial = substr($device->sysName, 4);
}
}

View File

@@ -1,8 +1,8 @@
<?php
/**
* ipolis.inc.php
* Ipolis.php
*
* LibreNMS os poller module for Hanwha Techwin devices
* -Description-
*
* 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
@@ -22,15 +22,23 @@
* @copyright 2018 Priit Mustasaar
* @author Priit Mustasaar <priit.mustasaar@gmail.com>
*/
$oids = [
'hardware' => $device['sysObjectID'] . '.1.0',
'version' => $device['sysObjectID'] . '.2.1.1.0',
];
$os_data = snmp_get_multi_oid($device, $oids);
namespace LibreNMS\OS;
foreach ($oids as $var => $oid) {
$$var = trim($os_data[$oid], '"');
use App\Models\Device;
class Ipolis extends \LibreNMS\OS
{
public function discoverOS(Device $device): void
{
$oids = [
'hardware' => $device->sysObjectID . '.1.0',
'version' => $device->sysObjectID . '.2.1.1.0',
];
$os_data = \SnmpQuery::get($oids)->values();
$device->hardware = $os_data[$oids['hardware']] ?? null;
$device->version = $os_data[$oids['version']] ?? null;
}
}
unset($oids, $os_data);

View File

@@ -35,7 +35,7 @@ class Jetdirect extends \LibreNMS\OS\Shared\Printer
$device = $this->getDevice();
$info = $this->parseDeviceId(snmp_get($this->getDeviceArray(), '.1.3.6.1.4.1.11.2.3.9.1.1.7.0', '-OQv'));
$hardware = $info['MDL'] ?? $info['MODEL'] ?? $info['DES'] ?? $info['DESCRIPTION'];
$hardware = $info['MDL'] ?? $info['MODEL'] ?? $info['DES'] ?? $info['DESCRIPTION'] ?? null;
if (! empty($hardware)) {
$hardware = str_ireplace([
'HP ',

View File

@@ -54,11 +54,11 @@ class Junos extends \LibreNMS\OS implements SlaDiscovery, OSPolling, SlaPolling
$device->version = $data[0]['jnxVirtualChassisMemberSWVersion'] ?? $parsedVersion[1] ?? $parsed['version'] ?? null;
}
public function pollOS()
public function pollOS(): void
{
$data = snmp_get_multi($this->getDeviceArray(), 'jnxJsSPUMonitoringCurrentFlowSession.0', '-OUQs', 'JUNIPER-SRX5000-SPU-MONITORING-MIB');
if (is_numeric($data[0]['jnxJsSPUMonitoringCurrentFlowSession'])) {
if (is_numeric($data[0]['jnxJsSPUMonitoringCurrentFlowSession'] ?? null)) {
data_update($this->getDeviceArray(), 'junos_jsrx_spu_sessions', [
'rrd_def' => RrdDefinition::make()->addDataset('spu_flow_sessions', 'GAUGE', 0),
], [
@@ -115,8 +115,8 @@ class Junos extends \LibreNMS\OS implements SlaDiscovery, OSPolling, SlaPolling
// Use DISMAN-PING Status codes. 0=Good 2=Critical
$sla->opstatus = $data[$owner][$test]['pingCtlRowStatus'] == '1' ? 0 : 2;
$sla->rtt = $data[$owner][$test]['jnxPingLastTestResultAvgRttUs'] / 1000;
$time = Carbon::parse($data[$owner][$test]['jnxPingLastTestResultTime'])->toDateTimeString();
$sla->rtt = ($data[$owner][$test]['jnxPingLastTestResultAvgRttUs'] ?? 0) / 1000;
$time = Carbon::parse($data[$owner][$test]['jnxPingLastTestResultTime'] ?? null)->toDateTimeString();
echo 'SLA : ' . $rtt_type . ' ' . $owner . ' ' . $test . '... ' . $sla->rtt . 'ms at ' . $time . "\n";
$fields = [
@@ -138,11 +138,11 @@ class Junos extends \LibreNMS\OS implements SlaDiscovery, OSPolling, SlaPolling
case 'IcmpEcho':
case 'IcmpTimeStamp':
$icmp = [
'MinRttUs' => $data[$owner][$test]['jnxPingLastTestResultMinRttUs'] / 1000,
'MaxRttUs' => $data[$owner][$test]['jnxPingLastTestResultMaxRttUs'] / 1000,
'StdDevRttUs' => $data[$owner][$test]['jnxPingLastTestResultStdDevRttUs'] / 1000,
'ProbeResponses' => $data[$owner][$test]['jnxPingLastTestResultProbeResponses'],
'ProbeLoss' => (int) $data[$owner][$test]['jnxPingLastTestResultSentProbes'] - (int) $data[$owner][$test]['jnxPingLastTestResultProbeResponses'],
'MinRttUs' => ($data[$owner][$test]['jnxPingLastTestResultMinRttUs'] ?? 0) / 1000,
'MaxRttUs' => ($data[$owner][$test]['jnxPingLastTestResultMaxRttUs'] ?? 0) / 1000,
'StdDevRttUs' => ($data[$owner][$test]['jnxPingLastTestResultStdDevRttUs'] ?? 0) / 1000,
'ProbeResponses' => $data[$owner][$test]['jnxPingLastTestResultProbeResponses'] ?? null,
'ProbeLoss' => (int) ($data[$owner][$test]['jnxPingLastTestResultSentProbes'] ?? 0) - (int) ($data[$owner][$test]['jnxPingLastTestResultProbeResponses'] ?? 0),
];
$rrd_name = ['sla', $sla_nr, $rtt_type];
$rrd_def = RrdDefinition::make()

70
LibreNMS/OS/Junose.php Normal file
View File

@@ -0,0 +1,70 @@
<?php
/**
* Junose.php
*
* -Description-
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* @link https://www.librenms.org
*
* @copyright 2021 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
class Junose extends \LibreNMS\OS
{
public function discoverOS(Device $device): void
{
if (strpos($device->sysDescr, 'olive')) {
$device->hardware = 'Olive';
return;
}
$junose_hardware = \SnmpQuery::translate($device->sysObjectID, 'Juniper-Products-MIB')->value();
$device->hardware = $this->rewriteHardware($junose_hardware) ?: null;
$junose_version = \SnmpQuery::get('Juniper-System-MIB::juniSystemSwVersion.0')->value();
preg_match('/\((.*)\)/', $junose_version, $matches);
$device->version = $matches[1] ?? null;
preg_match('/\[(.*)]/', $junose_version, $matches);
$device->features = $matches[1] ?? null;
}
private function rewriteHardware(string $hardware): string
{
$rewrite_junose_hardware = [
'Juniper-Products-MIB::' => 'Juniper ',
'juniErx1400' => 'ERX-1400',
'juniErx700' => 'ERX-700',
'juniErx1440' => 'ERX-1440',
'juniErx705' => 'ERX-705',
'juniErx310' => 'ERX-310',
'juniE320' => 'E320',
'juniE120' => 'E120',
'juniSsx1400' => 'SSX-1400',
'juniSsx700' => 'SSX-700',
'juniSsx1440' => 'SSX-1440',
];
$hardware = str_replace(array_keys($rewrite_junose_hardware), array_values($rewrite_junose_hardware), $hardware);
return $hardware;
}
}

View File

@@ -30,7 +30,7 @@ use LibreNMS\RRD\RrdDefinition;
class Netscaler extends \LibreNMS\OS implements OSPolling
{
public function pollOS()
public function pollOS(): void
{
echo ' IP';
@@ -153,7 +153,7 @@ class Netscaler extends \LibreNMS\OS implements OSPolling
$fields = [];
foreach ($oids as $oid) {
$fields[$oid] = is_numeric($data[0][$oid]) ? ':' . $data[0][$oid] : 'U';
$fields[$oid] = $data[0][$oid] ?? null;
}
$tags = compact('rrd_def');

View File

@@ -30,7 +30,7 @@ use LibreNMS\RRD\RrdDefinition;
class Nios extends \LibreNMS\OS implements OSPolling
{
public function pollOS()
public function pollOS(): void
{
//#############
// Create ddns update rrd
@@ -52,10 +52,10 @@ class Nios extends \LibreNMS\OS implements OSPolling
->addDataset('prereq_reject', 'DERIVE', 0);
$fields = [
'success' => $data[0]['ibDDNSUpdateSuccess'],
'failure' => $data[0]['ibDDNSUpdateFailure'],
'reject' => $data[0]['ibDDNSUpdateReject'],
'prereq_reject' => $data[0]['ibDDNSUpdatePrerequisiteReject'],
'success' => $data[0]['ibDDNSUpdateSuccess'] ?? null,
'failure' => $data[0]['ibDDNSUpdateFailure'] ?? null,
'reject' => $data[0]['ibDDNSUpdateReject'] ?? null,
'prereq_reject' => $data[0]['ibDDNSUpdatePrerequisiteReject'] ?? null,
];
$tags = compact('rrd_def');
@@ -78,8 +78,8 @@ class Nios extends \LibreNMS\OS implements OSPolling
->addDataset('PerfnonAA', 'GAUGE', 0);
$fields = [
'PerfAA' => $data[0]['ibNetworkMonitorDNSAAT1AvgLatency'],
'PerfnonAA' => $data[0]['ibNetworkMonitorDNSNonAAT1AvgLatency'],
'PerfAA' => $data[0]['ibNetworkMonitorDNSAAT1AvgLatency'] ?? null,
'PerfnonAA' => $data[0]['ibNetworkMonitorDNSNonAAT1AvgLatency'] ?? null,
];
$tags = compact('rrd_def');
@@ -106,10 +106,10 @@ class Nios extends \LibreNMS\OS implements OSPolling
->addDataset('nxrrset', 'DERIVE', 0);
$fields = [
'success' => $data['"summary"']['ibBindZoneSuccess'],
'failure' => $data['"summary"']['ibBindZoneFailure'],
'nxdomain' => $data['"summary"']['ibBindZoneNxDomain'],
'nxrrset' => $data['"summary"']['ibBindZoneNxRRset'],
'success' => $data['"summary"']['ibBindZoneSuccess'] ?? null,
'failure' => $data['"summary"']['ibBindZoneFailure'] ?? null,
'nxdomain' => $data['"summary"']['ibBindZoneNxDomain'] ?? null,
'nxrrset' => $data['"summary"']['ibBindZoneNxRRset'] ?? null,
];
$tags = compact('rrd_def');
@@ -146,15 +146,15 @@ class Nios extends \LibreNMS\OS implements OSPolling
->addDataset('request', 'DERIVE', 0);
$fields = [
'ack' => $data[0]['ibDhcpTotalNoOfAcks'],
'decline' => $data[0]['ibDhcpTotalNoOfDeclines'],
'discover' => $data[0]['ibDhcpTotalNoOfDiscovers'],
'inform' => $data[0]['ibDhcpTotalNoOfInforms'],
'nack' => $data[0]['ibDhcpTotalNoOfNacks'],
'offer' => $data[0]['ibDhcpTotalNoOfOffers'],
'other' => $data[0]['ibDhcpTotalNoOfOthers'],
'release' => $data[0]['ibDhcpTotalNoOfReleases'],
'request' => $data[0]['ibDhcpTotalNoOfRequests'],
'ack' => $data[0]['ibDhcpTotalNoOfAcks'] ?? null,
'decline' => $data[0]['ibDhcpTotalNoOfDeclines'] ?? null,
'discover' => $data[0]['ibDhcpTotalNoOfDiscovers'] ?? null,
'inform' => $data[0]['ibDhcpTotalNoOfInforms'] ?? null,
'nack' => $data[0]['ibDhcpTotalNoOfNacks'] ?? null,
'offer' => $data[0]['ibDhcpTotalNoOfOffers'] ?? null,
'other' => $data[0]['ibDhcpTotalNoOfOthers'] ?? null,
'release' => $data[0]['ibDhcpTotalNoOfReleases'] ?? null,
'request' => $data[0]['ibDhcpTotalNoOfRequests'] ?? null,
];
$tags = compact('rrd_def');

49
LibreNMS/OS/Nitro.php Normal file
View File

@@ -0,0 +1,49 @@
<?php
/*
* Nitro.php
*
* -Description-
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2021 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\OS;
class Nitro extends OS
{
public function discoverOS(Device $device): void
{
$this->discoverOS($device); // yaml
if ($device->sysObjectID == '.1.3.6.1.4.1.23128.1000.1.1') {
$device->features = 'Enterprise Security Manager';
} elseif ($device->sysObjectID == '.1.3.6.1.4.1.23128.1000.3.1') {
$device->features = 'Event Receiver';
} elseif ($device->sysObjectID == '.1.3.6.1.4.1.23128.1000.7.1') {
$device->features = 'Enterprise Log Manager';
} elseif ($device->sysObjectID == '.1.3.6.1.4.1.23128.1000.11.1') {
$device->features = 'Advanced Correlation Engine';
} else {
$device->features = 'Unknown';
}
}
}

View File

@@ -1,6 +1,6 @@
<?php
/**
* savin.inc.php
* NsBsd.php
*
* -Description-
*
@@ -19,9 +19,20 @@
*
* @link https://www.librenms.org
*
* @copyright 2017 Tony Murray
* @copyright 2021 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
$hardware = trim(snmp_get($device, '1.3.6.1.4.1.367.3.2.1.1.1.1.0', '-OQv', '', ''), '" ');
$version = trim(snmp_get($device, '1.3.6.1.4.1.367.3.2.1.1.1.2.0', '-OQv', '', ''), '" ');
$serial = trim(snmp_get($device, '1.3.6.1.4.1.367.3.2.1.2.1.4.0', '-OQv', '', ''), '" ');
namespace LibreNMS\OS;
use App\Models\Device;
class NsBsd extends \LibreNMS\OS
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
$device->sysName = \SnmpQuery::get('STORMSHIELD-PROPERTY-MIB::nsSystemName.0')->value() ?: $device->sysName;
}
}

View File

@@ -31,11 +31,11 @@ use LibreNMS\RRD\RrdDefinition;
class Openbsd extends Unix implements OSPolling
{
public function pollOS()
public function pollOS(): void
{
$oids = snmp_get_multi($this->getDeviceArray(), ['pfStateCount.0', 'pfStateSearches.0', 'pfStateInserts.0', 'pfStateRemovals.0'], '-OQUs', 'OPENBSD-PF-MIB');
if (is_numeric($oids[0]['pfStateCount'])) {
if (is_numeric($oids[0]['pfStateCount'] ?? null)) {
$rrd_def = RrdDefinition::make()->addDataset('states', 'GAUGE', 0);
$fields = [
@@ -48,7 +48,7 @@ class Openbsd extends Unix implements OSPolling
$this->enableGraph('pf_states');
}
if (is_numeric($oids[0]['pfStateSearches'])) {
if (is_numeric($oids[0]['pfStateSearches'] ?? null)) {
$rrd_def = RrdDefinition::make()->addDataset('searches', 'COUNTER', 0);
$fields = [
@@ -61,7 +61,7 @@ class Openbsd extends Unix implements OSPolling
$this->enableGraph('pf_searches');
}
if (is_numeric($oids[0]['pfStateInserts'])) {
if (is_numeric($oids[0]['pfStateInserts'] ?? null)) {
$rrd_def = RrdDefinition::make()->addDataset('inserts', 'COUNTER', 0);
$fields = [
@@ -74,7 +74,7 @@ class Openbsd extends Unix implements OSPolling
$this->enableGraph('pf_inserts');
}
if (is_numeric($oids[0]['pfStateCount'])) {
if (is_numeric($oids[0]['pfStateCount'] ?? null)) {
$rrd_def = RrdDefinition::make()->addDataset('removals', 'COUNTER', 0);
$fields = [

View File

@@ -36,7 +36,7 @@ class Panos extends \LibreNMS\OS implements OSPolling
'Packet Buffers',
];
public function pollOS()
public function pollOS(): void
{
$data = snmp_get_multi($this->getDeviceArray(), [
'panSessionActive.0',

View File

@@ -1,8 +1,8 @@
<?php
/*
* LibreNMS
* PbnCp.php
*
* ptp800.inc.php
* -Description-
*
* 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
@@ -15,13 +15,26 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link https://www.librenms.org
* @copyright 2018 Paul Heinrichs
* @author Paul Heinrichs<pdheinrichs@gmail.com>
* @link http://librenms.org
* @copyright 2021 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
$version = $device['sysDescr'];
$hardware = 'PTP 800';
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\OS;
class PbnCp extends OS
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
// normalize MAC address (serial)
$device->serial = str_replace([' ', ':', '-', '"'], '', $device->serial);
}
}

View File

@@ -31,7 +31,7 @@ use LibreNMS\RRD\RrdDefinition;
class Pfsense extends Unix implements OSPolling
{
public function pollOS()
public function pollOS(): void
{
$oids = snmp_get_multi($this->getDeviceArray(), [
'pfStateTableCount.0',
@@ -46,7 +46,7 @@ class Pfsense extends Unix implements OSPolling
'pfCounterMemDrop.0',
], '-OQUs', 'BEGEMOT-PF-MIB');
if (is_numeric($oids[0]['pfStateTableCount'])) {
if (is_numeric($oids[0]['pfStateTableCount'] ?? null)) {
$rrd_def = RrdDefinition::make()->addDataset('states', 'GAUGE', 0);
$fields = [
@@ -59,7 +59,7 @@ class Pfsense extends Unix implements OSPolling
$this->enableGraph('pf_states');
}
if (is_numeric($oids[0]['pfStateTableSearches'])) {
if (is_numeric($oids[0]['pfStateTableSearches'] ?? null)) {
$rrd_def = RrdDefinition::make()->addDataset('searches', 'COUNTER', 0);
$fields = [
@@ -72,7 +72,7 @@ class Pfsense extends Unix implements OSPolling
$this->enableGraph('pf_searches');
}
if (is_numeric($oids[0]['pfStateTableInserts'])) {
if (is_numeric($oids[0]['pfStateTableInserts'] ?? null)) {
$rrd_def = RrdDefinition::make()->addDataset('inserts', 'COUNTER', 0);
$fields = [
@@ -85,7 +85,7 @@ class Pfsense extends Unix implements OSPolling
$this->enableGraph('pf_inserts');
}
if (is_numeric($oids[0]['pfStateTableCount'])) {
if (is_numeric($oids[0]['pfStateTableCount'] ?? null)) {
$rrd_def = RrdDefinition::make()->addDataset('removals', 'COUNTER', 0);
$fields = [
@@ -98,7 +98,7 @@ class Pfsense extends Unix implements OSPolling
$this->enableGraph('pf_removals');
}
if (is_numeric($oids[0]['pfCounterMatch'])) {
if (is_numeric($oids[0]['pfCounterMatch'] ?? null)) {
$rrd_def = RrdDefinition::make()->addDataset('matches', 'COUNTER', 0);
$fields = [
@@ -111,7 +111,7 @@ class Pfsense extends Unix implements OSPolling
$this->enableGraph('pf_matches');
}
if (is_numeric($oids[0]['pfCounterBadOffset'])) {
if (is_numeric($oids[0]['pfCounterBadOffset'] ?? null)) {
$rrd_def = RrdDefinition::make()->addDataset('badoffset', 'COUNTER', 0);
$fields = [
@@ -124,7 +124,7 @@ class Pfsense extends Unix implements OSPolling
$this->enableGraph('pf_badoffset');
}
if (is_numeric($oids[0]['pfCounterFragment'])) {
if (is_numeric($oids[0]['pfCounterFragment'] ?? null)) {
$rrd_def = RrdDefinition::make()->addDataset('fragmented', 'COUNTER', 0);
$fields = [
@@ -137,7 +137,7 @@ class Pfsense extends Unix implements OSPolling
$this->enableGraph('pf_fragmented');
}
if (is_numeric($oids[0]['pfCounterShort'])) {
if (is_numeric($oids[0]['pfCounterShort'] ?? null)) {
$rrd_def = RrdDefinition::make()->addDataset('short', 'COUNTER', 0);
$fields = [
@@ -150,7 +150,7 @@ class Pfsense extends Unix implements OSPolling
$this->enableGraph('pf_short');
}
if (is_numeric($oids[0]['pfCounterNormalize'])) {
if (is_numeric($oids[0]['pfCounterNormalize'] ?? null)) {
$rrd_def = RrdDefinition::make()->addDataset('normalized', 'COUNTER', 0);
$fields = [
@@ -163,7 +163,7 @@ class Pfsense extends Unix implements OSPolling
$this->enableGraph('pf_normalized');
}
if (is_numeric($oids[0]['pfCounterMemDrop'])) {
if (is_numeric($oids[0]['pfCounterMemDrop'] ?? null)) {
$rrd_def = RrdDefinition::make()->addDataset('memdropped', 'COUNTER', 0);
$fields = [

View File

@@ -93,11 +93,11 @@ class Pmp extends OS implements
$device->hardware = $hardware;
}
public function pollOS()
public function pollOS(): void
{
// Migrated to Wireless Sensor
$fec = snmp_get_multi_oid($this->getDeviceArray(), ['fecInErrorsCount.0', 'fecOutErrorsCount.0', 'fecCRCError.0'], '-OQUs', 'WHISP-BOX-MIBV2-MIB');
if (is_numeric($fec['fecInErrorsCount.0']) && is_numeric($fec['fecOutErrorsCount.0'])) {
if (is_numeric($fec['fecInErrorsCount.0'] ?? null) && is_numeric($fec['fecOutErrorsCount.0'] ?? null)) {
$rrd_def = RrdDefinition::make()
->addDataset('fecInErrorsCount', 'GAUGE', 0, 100000)
->addDataset('fecOutErrorsCount', 'GAUGE', 0, 100000);
@@ -112,7 +112,7 @@ class Pmp extends OS implements
}
// Migrated to Wireless Sensor
if (is_numeric($fec['fecCRCError.0'])) {
if (is_numeric($fec['fecCRCError.0'] ?? null)) {
$rrd_def = RrdDefinition::make()->addDataset('crcErrors', 'GAUGE', 0, 100000);
$fields = [
'crcErrors' => $fec['fecCRCError.0'],
@@ -136,8 +136,8 @@ class Pmp extends OS implements
$multi_get_array = snmp_get_multi($this->getDeviceArray(), ['regCount.0', 'regFailureCount.0'], '-OQU', 'WHISP-APS-MIB');
d_echo($multi_get_array);
$registered = $multi_get_array[0]['WHISP-APS-MIB::regCount'];
$failed = $multi_get_array[0]['WHISP-APS-MIB::regFailureCount'];
$registered = $multi_get_array[0]['WHISP-APS-MIB::regCount'] ?? null;
$failed = $multi_get_array[0]['WHISP-APS-MIB::regFailureCount'] ?? null;
if (is_numeric($registered) && is_numeric($failed)) {
$rrd_def = RrdDefinition::make()
@@ -169,7 +169,7 @@ class Pmp extends OS implements
}
$radio = snmp_get_multi_oid($this->getDeviceArray(), ['radioDbmInt.0', 'minRadioDbm.0', 'maxRadioDbm.0', 'radioDbmAvg.0'], '-OQUs', 'WHISP-SM-MIB');
if (is_numeric($radio['radioDbmInt.0']) && is_numeric($radio['minRadioDbm.0']) && is_numeric($radio['maxRadioDbm.0']) && is_numeric($radio['radioDbmAvg.0'])) {
if (is_numeric($radio['radioDbmInt.0'] ?? null) && is_numeric($radio['minRadioDbm.0'] ?? null) && is_numeric($radio['maxRadioDbm.0'] ?? null) && is_numeric($radio['radioDbmAvg.0'] ?? null)) {
$rrd_def = RrdDefinition::make()
->addDataset('dbm', 'GAUGE', -100, 0)
->addDataset('min', 'GAUGE', -100, 0)
@@ -188,7 +188,7 @@ class Pmp extends OS implements
}
$dbm = snmp_get_multi_oid($this->getDeviceArray(), ['linkRadioDbmHorizontal.2', 'linkRadioDbmVertical.2'], '-OQUs', 'WHISP-APS-MIB');
if (is_numeric($dbm['linkRadioDbmHorizontal.2']) && is_numeric($dbm['linkRadioDbmVertical.2'])) {
if (is_numeric($dbm['linkRadioDbmHorizontal.2'] ?? null) && is_numeric($dbm['linkRadioDbmVertical.2'] ?? null)) {
$rrd_def = RrdDefinition::make()
->addDataset('horizontal', 'GAUGE', -100, 0)
->addDataset('vertical', 'GAUGE', -100, 0);

View File

@@ -0,0 +1,52 @@
<?php
/**
* Poweralert.php
*
* -Description-
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* @link https://www.librenms.org
*
* @copyright 2021 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Interfaces\Polling\OSPolling;
class Poweralert extends \LibreNMS\OS implements OSPolling
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
$this->customSysName($device);
}
public function pollOs(): void
{
$this->customSysName($this->getDevice());
}
/**
* @param \App\Models\Device $device
*/
private function customSysName(Device $device): void
{
$device->sysName = \SnmpQuery::get('.1.3.6.1.2.1.33.1.1.5.0')->value() ?: $device->sysName;
}
}

View File

@@ -30,7 +30,7 @@ use LibreNMS\RRD\RrdDefinition;
class Procurve extends \LibreNMS\OS implements OSPolling
{
public function pollOS()
public function pollOS(): void
{
$FdbAddressCount = snmp_get($this->getDeviceArray(), 'hpSwitchFdbAddressCount.0', '-Ovqn', 'STATISTICS-MIB');

View File

@@ -30,7 +30,7 @@ use LibreNMS\RRD\RrdDefinition;
class Pulse extends \LibreNMS\OS implements OSPolling
{
public function pollOS()
public function pollOS(): void
{
$users = snmp_get($this->getDeviceArray(), 'iveConcurrentUsers.0', '-OQv', 'PULSESECURE-PSG-MIB');

View File

@@ -34,7 +34,7 @@ class Qnap extends OS implements OSDiscovery
public function discoverOS(Device $device): void
{
$info = snmp_getnext_multi($this->getDeviceArray(), ['enclosureModel', 'enclosureSerialNum', 'entPhysicalFirmwareRev'], '-OQUs', 'NAS-MIB:ENTITY-MIB');
$device->version = trim($info['entPhysicalFirmwareRev'], '\"');
$device->version = trim($info['entPhysicalFirmwareRev'] ?? '', '\"');
$device->hardware = $info['enclosureModel'];
$device->serial = $info['enclosureSerialNum'];
}

184
LibreNMS/OS/Riverbed.php Normal file
View File

@@ -0,0 +1,184 @@
<?php
/**
* Riverbed.php
*
* -Description-
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* @link https://www.librenms.org
*
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
* Copyright (c) 2017 Cercel Valentin <crc@nuamchefazi.ro>
*/
namespace LibreNMS\OS;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\OS;
use LibreNMS\RRD\RrdDefinition;
class Riverbed extends OS implements OSPolling
{
public function pollOS(): void
{
/* optimisation oids
*
* half-open .1.3.6.1.4.1.17163.1.1.5.2.3.0
* half-closed .1.3.6.1.4.1.17163.1.1.5.2.4.0
* establised .1.3.6.1.4.1.17163.1.1.5.2.5.0
* active .1.3.6.1.4.1.17163.1.1.5.2.6.0
* total .1.3.6.1.4.1.17163.1.1.5.2.7.0
*
*/
$conn_array = [
'.1.3.6.1.4.1.17163.1.1.5.2.3.0',
'.1.3.6.1.4.1.17163.1.1.5.2.4.0',
'.1.3.6.1.4.1.17163.1.1.5.2.5.0',
'.1.3.6.1.4.1.17163.1.1.5.2.6.0',
'.1.3.6.1.4.1.17163.1.1.5.2.7.0',
];
$connections = snmp_get_multi_oid($this->getDeviceArray(), $conn_array);
$conn_half_open = $connections['.1.3.6.1.4.1.17163.1.1.5.2.3.0'] ?? null;
$conn_half_closed = $connections['.1.3.6.1.4.1.17163.1.1.5.2.4.0'] ?? null;
$conn_established = $connections['.1.3.6.1.4.1.17163.1.1.5.2.5.0'] ?? null;
$conn_active = $connections['.1.3.6.1.4.1.17163.1.1.5.2.6.0'] ?? null;
$conn_total = $connections['.1.3.6.1.4.1.17163.1.1.5.2.7.0'] ?? null;
if ($conn_half_open >= 0 && $conn_half_closed >= 0 && $conn_established >= 0 && $conn_active >= 0 && $conn_total >= 0) {
$rrd_def = RrdDefinition::make()
->addDataset('half_open', 'GAUGE', 0)
->addDataset('half_closed', 'GAUGE', 0)
->addDataset('established', 'GAUGE', 0)
->addDataset('active', 'GAUGE', 0)
->addDataset('total', 'GAUGE', 0);
$fields = [
'half_open' => $conn_half_open,
'half_closed' => $conn_half_closed,
'established' => $conn_established,
'active' => $conn_active,
'total' => $conn_total,
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'riverbed_connections', $tags, $fields);
$this->enableGraph('riverbed_connections');
}
/* datastore oids
*
* hits .1.3.6.1.4.1.17163.1.1.5.4.1.0
* miss .1.3.6.1.4.1.17163.1.1.5.4.2.0
*
*/
$datastore_array = [
'.1.3.6.1.4.1.17163.1.1.5.4.1.0',
'.1.3.6.1.4.1.17163.1.1.5.4.2.0',
];
$datastore = snmp_get_multi_oid($this->getDeviceArray(), $datastore_array);
$datastore_hits = $datastore['.1.3.6.1.4.1.17163.1.1.5.4.1.0'] ?? null;
$datastore_miss = $datastore['.1.3.6.1.4.1.17163.1.1.5.4.2.0'] ?? null;
if ($datastore_hits >= 0 && $datastore_miss >= 0) {
$rrd_def = RrdDefinition::make()
->addDataset('datastore_hits', 'GAUGE', 0)
->addDataset('datastore_miss', 'GAUGE', 0);
$fields = [
'datastore_hits' => $datastore_hits,
'datastore_miss' => $datastore_miss,
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'riverbed_datastore', $tags, $fields);
$this->enableGraph('riverbed_datastore');
}
/* optimization oids
*
* optimized .1.3.6.1.4.1.17163.1.1.5.2.1.0
* passthrough .1.3.6.1.4.1.17163.1.1.5.2.2.0
*
*/
$optimization_array = [
'.1.3.6.1.4.1.17163.1.1.5.2.1.0',
'.1.3.6.1.4.1.17163.1.1.5.2.2.0',
];
$optimizations = snmp_get_multi_oid($this->getDeviceArray(), $optimization_array);
$conn_optimized = $optimizations['.1.3.6.1.4.1.17163.1.1.5.2.1.0'] ?? null;
$conn_passthrough = $optimizations['.1.3.6.1.4.1.17163.1.1.5.2.2.0'] ?? null;
if ($conn_optimized >= 0 && $conn_passthrough >= 0) {
$rrd_def = RrdDefinition::make()
->addDataset('conn_optimized', 'GAUGE', 0)
->addDataset('conn_passthrough', 'GAUGE', 0);
$fields = [
'conn_optimized' => $conn_optimized,
'conn_passthrough' => $conn_passthrough,
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'riverbed_optimization', $tags, $fields);
$this->enableGraph('riverbed_optimization');
}
/* bandwidth passthrough
*
* in .1.3.6.1.4.1.17163.1.1.5.3.3.1.0
* out .1.3.6.1.4.1.17163.1.1.5.3.3.2.0
* total .1.3.6.1.4.1.17163.1.1.5.3.3.3.0
*
*/
$bandwidth_array = [
'.1.3.6.1.4.1.17163.1.1.5.3.3.1.0',
'.1.3.6.1.4.1.17163.1.1.5.3.3.2.0',
'.1.3.6.1.4.1.17163.1.1.5.3.3.3.0',
];
$bandwidth = snmp_get_multi_oid($this->getDeviceArray(), $bandwidth_array);
$bw_in = $bandwidth['.1.3.6.1.4.1.17163.1.1.5.3.3.1.0'] ?? null;
$bw_out = $bandwidth['.1.3.6.1.4.1.17163.1.1.5.3.3.2.0'] ?? null;
$bw_total = $bandwidth['.1.3.6.1.4.1.17163.1.1.5.3.3.3.0'] ?? null;
if ($bw_in >= 0 && $bw_out >= 0 && $bw_total >= 0) {
$rrd_def = RrdDefinition::make()
->addDataset('bw_in', 'COUNTER', 0)
->addDataset('bw_out', 'COUNTER', 0)
->addDataset('bw_total', 'COUNTER', 0);
$fields = [
'bw_in' => $bw_in,
'bw_out' => $bw_out,
'bw_total' => $bw_total,
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'riverbed_passthrough', $tags, $fields);
$this->enableGraph('riverbed_passthrough');
}
}
}

View File

@@ -396,7 +396,7 @@ class Routeros extends OS implements
return $sensors;
}
public function pollOS()
public function pollOS(): void
{
$leases = snmp_get($this->getDeviceArray(), 'mtxrDHCPLeaseCount.0', '-OQv', 'MIKROTIK-MIB');

View File

@@ -37,7 +37,7 @@ class Rutos2xx extends OS implements
WirelessSnrDiscovery,
WirelessRssiDiscovery
{
public function pollOS()
public function pollOS(): void
{
// Mobile Data Usage
$usage = snmp_get_multi_oid($this->getDeviceArray(), [

View File

@@ -30,29 +30,32 @@ use LibreNMS\RRD\RrdDefinition;
class Screenos extends \LibreNMS\OS implements OSPolling
{
public function pollOS()
public function pollOS(): void
{
$sess_data = snmp_get_multi_oid($this->getDeviceArray(), [
'.1.3.6.1.4.1.3224.16.3.2.0',
'.1.3.6.1.4.1.3224.16.3.3.0',
'.1.3.6.1.4.1.3224.16.3.4.0',
]);
[$sessalloc, $sessmax, $sessfailed] = array_values($sess_data);
$rrd_def = RrdDefinition::make()
->addDataset('allocate', 'GAUGE', 0, 3000000)
->addDataset('max', 'GAUGE', 0, 3000000)
->addDataset('failed', 'GAUGE', 0, 1000);
if (! empty($sess_data)) {
[$sessalloc, $sessmax, $sessfailed] = array_values($sess_data);
$fields = [
'allocate' => $sessalloc,
'max' => $sessmax,
'failed' => $sessfailed,
];
$rrd_def = RrdDefinition::make()
->addDataset('allocate', 'GAUGE', 0, 3000000)
->addDataset('max', 'GAUGE', 0, 3000000)
->addDataset('failed', 'GAUGE', 0, 1000);
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'screenos_sessions', $tags, $fields);
$fields = [
'allocate' => $sessalloc,
'max' => $sessmax,
'failed' => $sessfailed,
];
$this->enableGraph('screenos_sessions');
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'screenos_sessions', $tags, $fields);
$this->enableGraph('screenos_sessions');
}
}
}

View File

@@ -30,7 +30,7 @@ use LibreNMS\RRD\RrdDefinition;
class Secureplatform extends \LibreNMS\OS implements OSPolling
{
public function pollOS()
public function pollOS(): void
{
$connections = snmp_get($this->getDeviceArray(), 'fwNumConn.0', '-OQv', 'CHECKPOINT-MIB');

View File

@@ -27,10 +27,125 @@ namespace LibreNMS\OS;
use LibreNMS\Device\Processor;
use LibreNMS\Interfaces\Discovery\ProcessorDiscovery;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\OS;
use LibreNMS\RRD\RrdDefinition;
class Sgos extends OS implements ProcessorDiscovery
class Sgos extends OS implements ProcessorDiscovery, OSPolling
{
public function pollOS(): void
{
$oid_list = [
'sgProxyHttpClientRequestRate.0',
'sgProxyHttpClientConnections.0',
'sgProxyHttpClientConnectionsActive.0',
'sgProxyHttpClientConnectionsIdle.0',
'sgProxyHttpServerConnections.0',
'sgProxyHttpServerConnectionsActive.0',
'sgProxyHttpServerConnectionsIdle.0',
];
$sgos = snmp_get_multi($this->getDeviceArray(), $oid_list, '-OUQs', 'BLUECOAT-SG-PROXY-MIB');
if (is_numeric($sgos[0]['sgProxyHttpClientRequestRate'] ?? null)) {
$tags = [
'rrd_def' => RrdDefinition::make()->addDataset('requests', 'GAUGE', 0),
];
$fields = [
'requests' => $sgos[0]['sgProxyHttpClientRequestRate'],
];
data_update($this->getDeviceArray(), 'sgos_average_requests', $tags, $fields);
$this->enableGraph('sgos_average_requests');
echo ' HTTP Req Rate';
}
if (is_numeric($sgos[0]['sgProxyHttpClientConnections'] ?? null)) {
$tags = [
'rrd_def' => RrdDefinition::make()->addDataset('client_conn', 'GAUGE', 0),
];
$fields = [
'client_conn' => $sgos[0]['sgProxyHttpClientConnections'],
];
data_update($this->getDeviceArray(), 'sgos_client_connections', $tags, $fields);
$this->enableGraph('sgos_client_connections');
echo ' Client Conn';
}
if (is_numeric($sgos[0]['sgProxyHttpServerConnections'] ?? null)) {
$tags = [
'rrd_def' => RrdDefinition::make()->addDataset('server_conn', 'GAUGE', 0),
];
$fields = [
'server_conn' => $sgos[0]['sgProxyHttpServerConnections'],
];
data_update($this->getDeviceArray(), 'sgos_server_connections', $tags, $fields);
$this->enableGraph('sgos_server_connections');
echo ' Server Conn';
}
if (is_numeric($sgos[0]['sgProxyHttpClientConnectionsActive'] ?? null)) {
$tags = [
'rrd_def' => RrdDefinition::make()->addDataset('client_conn_active', 'GAUGE', 0),
];
$fields = [
'client_conn_active' => $sgos[0]['sgProxyHttpClientConnectionsActive'],
];
data_update($this->getDeviceArray(), 'sgos_client_connections_active', $tags, $fields);
$this->enableGraph('sgos_client_connections_active');
echo ' Client Conn Active';
}
if (is_numeric($sgos[0]['sgProxyHttpServerConnectionsActive'] ?? null)) {
$tags = [
'rrd_def' => RrdDefinition::make()->addDataset('server_conn_active', 'GAUGE', 0),
];
$fields = [
'server_conn_active' => $sgos[0]['sgProxyHttpServerConnectionsActive'],
];
data_update($this->getDeviceArray(), 'sgos_server_connections_active', $tags, $fields);
$this->enableGraph('sgos_server_connections_active');
echo ' Server Conn Active';
}
if (is_numeric($sgos[0]['sgProxyHttpClientConnectionsIdle'] ?? null)) {
$tags = [
'rrd_def' => RrdDefinition::make()->addDataset('client_idle', 'GAUGE', 0),
];
$fields = [
'client_idle' => $sgos[0]['sgProxyHttpClientConnectionsIdle'],
];
data_update($this->getDeviceArray(), 'sgos_client_connections_idle', $tags, $fields);
$this->enableGraph('sgos_client_connections_idle');
echo ' Client Conne Idle';
}
if (is_numeric($sgos[0]['sgProxyHttpServerConnectionsIdle'] ?? null)) {
$tags = [
'rrd_def' => RrdDefinition::make()->addDataset('server_idle', 'GAUGE', 0),
];
$fields = [
'server_idle' => $sgos[0]['sgProxyHttpServerConnectionsIdle'],
];
data_update($this->getDeviceArray(), 'sgos_server_connections_idle', $tags, $fields);
$this->enableGraph('sgos_server_connections_idle');
echo ' Server Conn Idle';
}
}
/**
* Discover processors.
* Returns an array of LibreNMS\Device\Processor objects that have been discovered

View File

@@ -130,8 +130,8 @@ class Cisco extends OS implements OSDiscovery, SlaDiscovery, ProcessorDiscovery,
foreach (Arr::wrap($cemp) as $index => $entry) {
if (is_numeric($entry['cempMemPoolUsed']) && $entry['cempMemPoolValid'] == 'true') {
[$entPhysicalIndex] = explode('.', $index);
$entPhysicalName = $this->getCacheByIndex('entPhysicalName', 'ENTITY-MIB')[$entPhysicalIndex];
$descr = ucwords($entPhysicalName . ' - ' . $entry['cempMemPoolName']);
$entPhysicalName = $this->getCacheByIndex('entPhysicalName', 'ENTITY-MIB');
$descr = ucwords((isset($entPhysicalName[$entPhysicalIndex]) ? "{$entPhysicalName[$entPhysicalIndex]} - " : '') . $entry['cempMemPoolName']);
$descr = trim(str_replace(['Cisco ', 'Network Processing Engine'], '', $descr), ' -');
$mempools->push((new Mempool([
@@ -180,7 +180,7 @@ class Cisco extends OS implements OSDiscovery, SlaDiscovery, ProcessorDiscovery,
$count = 0;
foreach (Arr::wrap($cpm) as $index => $entry) {
$count++;
if (is_numeric($entry['cpmCPUMemoryFree']) && is_numeric($entry['cpmCPUMemoryFree'])) {
if (isset($entry['cpmCPUMemoryFree']) && is_numeric($entry['cpmCPUMemoryFree'])) {
$cpu = $this->getCacheByIndex('entPhysicalName', 'ENTITY-MIB')[$entry['cpmCPUTotalPhysicalIndex'] ?? 'none'] ?? "Processor $index";
$mempools->push((new Mempool([

View File

@@ -26,6 +26,7 @@
namespace LibreNMS\OS\Shared;
use App\Models\Device;
use Illuminate\Support\Str;
class Printer extends \LibreNMS\OS
{
@@ -45,6 +46,10 @@ class Printer extends \LibreNMS\OS
{
$vars = [];
foreach (explode(';', $data) as $pair) {
if (! Str::contains($pair, ':')) {
continue;
}
[$key, $value] = explode(':', $pair);
$vars[trim($key)] = $value;
}

View File

@@ -54,8 +54,8 @@ class Zyxel extends OS
];
$data = snmp_get_multi_oid($this->getDeviceArray(), $oids, '-OUQnt');
$device->hardware = $data['.1.3.6.1.4.1.890.1.15.3.1.11.0'];
[$device->version,] = explode(' | ', $data['.1.3.6.1.4.1.890.1.15.3.1.6.0']);
$device->serial = $data['.1.3.6.1.4.1.890.1.15.3.1.12.0'];
$device->hardware = $data['.1.3.6.1.4.1.890.1.15.3.1.11.0'] ?? null;
[$device->version,] = explode(' | ', $data['.1.3.6.1.4.1.890.1.15.3.1.6.0'] ?? null);
$device->serial = $data['.1.3.6.1.4.1.890.1.15.3.1.12.0'] ?? null;
}
}

View File

@@ -26,7 +26,7 @@ use LibreNMS\RRD\RrdDefinition;
class Sonicwall extends OS implements OSPolling, ProcessorDiscovery
{
public function pollOS()
public function pollOS(): void
{
$data = snmp_get_multi($this->getDeviceArray(), [
'sonicCurrentConnCacheEntries.0',

View File

@@ -0,0 +1,45 @@
<?php
/*
* Speedtouch.php
*
* -Description-
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2021 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\OS;
class Speedtouch extends OS
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
// Filthy hack to get software version. may not work on anything but 585v7 :)
$loop = \SnmpQuery::get('IF-MIB::ifDescr.101')->value();
if ($loop) {
preg_match('@([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)@i', $loop, $matches);
$device->version = $matches[1];
}
}
}

53
LibreNMS/OS/Svos.php Normal file
View File

@@ -0,0 +1,53 @@
<?php
/*
* Svos.php
*
* -Description-
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2021 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\OS;
class Svos extends OS
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
$data = snmpwalk_cache_oid($this->getDeviceArray(), 'raidExMibRaidListTable', [], 'HM800MIB');
foreach ($data as $serialnum => $oid) {
if (! empty($data[$serialnum]['raidlistSerialNumber'])) {
$device->serial = $data[$serialnum]['raidlistSerialNumber'];
}
if (! empty($data[$serialnum]['raidlistDKCProductName'])) {
$device->hardware = $data[$serialnum]['raidlistDKCProductName'];
}
if (! empty($data[$serialnum]['raidlistDKCMainVersion'])) {
$device->version = $data[$serialnum]['raidlistDKCMainVersion'];
}
}
}
}

View File

@@ -47,10 +47,10 @@ class ThreeCom extends OS implements OSDiscovery
if (Str::startsWith($device->sysObjectID, '.1.3.6.1.4.1.43.10.27.4.1.')) {
$oids = ['stackUnitDesc.1', 'stackUnitPromVersion.1', 'stackUnitSWVersion.1', 'stackUnitSerialNumber.1', 'stackUnitCapabilities.1'];
$data = snmp_get_multi($this->getDeviceArray(), $oids, ['-OQUs', '--hexOutputLength=0'], 'A3COM0352-STACK-CONFIG');
$device->hardware = trim($device->hardware . ' ' . $data[1]['stackUnitDesc']);
$device->version = $data[1]['stackUnitSWVersion'];
$device->serial = $data[1]['stackUnitSerialNumber'];
$device->features = $data[1]['stackUnitCapabilities'];
$device->hardware = trim($device->hardware . ' ' . ($data[1]['stackUnitDesc'] ?? ''));
$device->version = $data[1]['stackUnitSWVersion'] ?? null;
$device->serial = $data[1]['stackUnitSerialNumber'] ?? null;
$device->features = $data[1]['stackUnitCapabilities'] ?? null;
}
}
}

View File

@@ -59,7 +59,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
$device->hardware = snmp_get($this->getDeviceArray(), "tmnxChassisTypeName.$hardware_index", '-Ovq', 'TIMETRA-CHASSIS-MIB');
$hw = snmpwalk_group($this->getDeviceArray(), 'tmnxHwClass', 'TIMETRA-CHASSIS-MIB');
foreach ($hw[1]['tmnxHwClass'] as $unitID => $class) {
foreach ($hw[1]['tmnxHwClass'] ?? [] as $unitID => $class) {
if ($class == 3) {
$device->serial = snmp_get($this->getDeviceArray(), "1.3.6.1.4.1.6527.3.1.2.2.1.8.1.5.1.$unitID", '-OQv', 'TIMETRA-CHASSIS-MIB');
@@ -181,20 +181,20 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
'lsp_id' => $lsp_id,
'path_oid' => $path_oid,
'device_id' => $this->getDeviceId(),
'mplsLspPathRowStatus' => $value['vRtrMplsLspPathRowStatus'],
'mplsLspPathLastChange' => round($value['vRtrMplsLspPathLastChange'] / 100),
'mplsLspPathType' => $value['vRtrMplsLspPathType'],
'mplsLspPathBandwidth' => $value['vRtrMplsLspPathBandwidth'],
'mplsLspPathOperBandwidth' => $value['vRtrMplsLspPathOperBandwidth'],
'mplsLspPathAdminState' => $value['vRtrMplsLspPathAdminState'],
'mplsLspPathOperState' => $value['vRtrMplsLspPathOperState'],
'mplsLspPathState' => $value['vRtrMplsLspPathState'],
'mplsLspPathFailCode' => $value['vRtrMplsLspPathFailCode'],
'mplsLspPathFailNodeAddr' => $value['vRtrMplsLspPathFailNodeAddr'],
'mplsLspPathMetric' => $value['vRtrMplsLspPathMetric'],
'mplsLspPathOperMetric' => $value['vRtrMplsLspPathOperMetric'],
'mplsLspPathTunnelARHopListIndex' => $value['vRtrMplsLspPathTunnelARHopListIndex'],
'mplsLspPathTunnelCHopListIndex' => $value['vRtrMplsLspPathTunnelCRHopListIndex'],
'mplsLspPathRowStatus' => $value['vRtrMplsLspPathRowStatus'] ?? null,
'mplsLspPathLastChange' => round(($value['vRtrMplsLspPathLastChange'] ?? 0) / 100),
'mplsLspPathType' => $value['vRtrMplsLspPathType'] ?? null,
'mplsLspPathBandwidth' => $value['vRtrMplsLspPathBandwidth'] ?? null,
'mplsLspPathOperBandwidth' => $value['vRtrMplsLspPathOperBandwidth'] ?? null,
'mplsLspPathAdminState' => $value['vRtrMplsLspPathAdminState'] ?? null,
'mplsLspPathOperState' => $value['vRtrMplsLspPathOperState'] ?? null,
'mplsLspPathState' => $value['vRtrMplsLspPathState'] ?? null,
'mplsLspPathFailCode' => $value['vRtrMplsLspPathFailCode'] ?? null,
'mplsLspPathFailNodeAddr' => $value['vRtrMplsLspPathFailNodeAddr'] ?? null,
'mplsLspPathMetric' => $value['vRtrMplsLspPathMetric'] ?? null,
'mplsLspPathOperMetric' => $value['vRtrMplsLspPathOperMetric'] ?? null,
'mplsLspPathTunnelARHopListIndex' => $value['vRtrMplsLspPathTunnelARHopListIndex'] ?? null,
'mplsLspPathTunnelCHopListIndex' => $value['vRtrMplsLspPathTunnelCRHopListIndex'] ?? null,
]));
}
@@ -260,23 +260,23 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
$svcs->push(new MplsService([
'svc_oid' => $value['svcId'],
'device_id' => $this->getDeviceId(),
'svcRowStatus' => $value['svcRowStatus'],
'svcType' => $value['svcType'],
'svcCustId' => $value['svcCustId'],
'svcAdminStatus' => $value['svcAdminStatus'],
'svcOperStatus' => $value['svcOperStatus'],
'svcDescription' => $value['svcDescription'],
'svcMtu' => $value['svcMtu'],
'svcNumSaps' => $value['svcNumSaps'],
'svcNumSdps' => $value['svcNumSdps'],
'svcLastMgmtChange' => round($value['svcLastMgmtChange'] / 100),
'svcLastStatusChange' => round($value['svcLastStatusChange'] / 100),
'svcVRouterId' => $value['svcVRouterId'],
'svcTlsMacLearning' => $value['svcTlsMacLearning'],
'svcTlsStpAdminStatus' => $value['svcTlsStpAdminStatus'],
'svcTlsStpOperStatus' => $value['svcTlsStpOperStatus'],
'svcTlsFdbTableSize' => $value['svcTlsFdbTableSize'],
'svcTlsFdbNumEntries' => $value['svcTlsFdbNumEntries'],
'svcRowStatus' => $value['svcRowStatus'] ?? null,
'svcType' => $value['svcType'] ?? null,
'svcCustId' => $value['svcCustId'] ?? null,
'svcAdminStatus' => $value['svcAdminStatus'] ?? null,
'svcOperStatus' => $value['svcOperStatus'] ?? null,
'svcDescription' => $value['svcDescription'] ?? null,
'svcMtu' => $value['svcMtu'] ?? null,
'svcNumSaps' => $value['svcNumSaps'] ?? null,
'svcNumSdps' => $value['svcNumSdps'] ?? null,
'svcLastMgmtChange' => round(($value['svcLastMgmtChange'] ?? 0) / 100),
'svcLastStatusChange' => round(($value['svcLastStatusChange'] ?? 0) / 100),
'svcVRouterId' => $value['svcVRouterId'] ?? null,
'svcTlsMacLearning' => $value['svcTlsMacLearning'] ?? null,
'svcTlsStpAdminStatus' => $value['svcTlsStpAdminStatus'] ?? null,
'svcTlsStpOperStatus' => $value['svcTlsStpOperStatus'] ?? null,
'svcTlsFdbTableSize' => $value['svcTlsFdbTableSize'] ?? null,
'svcTlsFdbNumEntries' => $value['svcTlsFdbNumEntries'] ?? null,
]));
}
@@ -319,12 +319,12 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
'sapDescription' => $value['sapDescription'],
'sapAdminStatus' => $value['sapAdminStatus'],
'sapOperStatus' => $value['sapOperStatus'],
'sapLastMgmtChange' => round($value['sapLastMgmtChange'] / 100),
'sapLastStatusChange' => round($value['sapLastStatusChange'] / 100),
'sapIngressBytes' => $mplsSapTrafficCache[$traffic_id]['sapBaseStatsIngressPchipOfferedLoPrioOctets'],
'sapEgressBytes' => $mplsSapTrafficCache[$traffic_id]['sapBaseStatsEgressQchipForwardedOutProfOctets'],
'sapIngressDroppedBytes' => $mplsSapTrafficCache[$traffic_id]['sapBaseStatsIngressQchipDroppedLoPrioOctets'],
'sapEgressDroppedBytes' => $mplsSapTrafficCache[$traffic_id]['sapBaseStatsEgressQchipDroppedOutProfOctets'],
'sapLastMgmtChange' => round(($value['sapLastMgmtChange'] ?? 0) / 100),
'sapLastStatusChange' => round(($value['sapLastStatusChange'] ?? 0) / 100),
'sapIngressBytes' => $mplsSapTrafficCache[$traffic_id]['sapBaseStatsIngressPchipOfferedLoPrioOctets'] ?? null,
'sapEgressBytes' => $mplsSapTrafficCache[$traffic_id]['sapBaseStatsEgressQchipForwardedOutProfOctets'] ?? null,
'sapIngressDroppedBytes' => $mplsSapTrafficCache[$traffic_id]['sapBaseStatsIngressQchipDroppedLoPrioOctets'] ?? null,
'sapEgressDroppedBytes' => $mplsSapTrafficCache[$traffic_id]['sapBaseStatsEgressQchipDroppedOutProfOctets'] ?? null,
]));
}
@@ -410,11 +410,11 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
'mplsTunnelARHopIndex' => $mplsTunnelARHopIndex,
'lsp_path_id' => $lsp_path_id,
'device_id' => $this->getDeviceId(),
'mplsTunnelARHopAddrType' => $value['mplsTunnelARHopAddrType'],
'mplsTunnelARHopIpv4Addr' => $value['mplsTunnelARHopIpv4Addr'],
'mplsTunnelARHopIpv6Addr' => $value['mplsTunnelARHopIpv6Addr'],
'mplsTunnelARHopAsNumber' => $value['mplsTunnelARHopAsNumber'],
'mplsTunnelARHopStrictOrLoose' => $value['mplsTunnelARHopStrictOrLoose'],
'mplsTunnelARHopAddrType' => $value['mplsTunnelARHopAddrType'] ?? null,
'mplsTunnelARHopIpv4Addr' => $value['mplsTunnelARHopIpv4Addr'] ?? null,
'mplsTunnelARHopIpv6Addr' => $value['mplsTunnelARHopIpv6Addr'] ?? null,
'mplsTunnelARHopAsNumber' => $value['mplsTunnelARHopAsNumber'] ?? null,
'mplsTunnelARHopStrictOrLoose' => $value['mplsTunnelARHopStrictOrLoose'] ?? null,
'mplsTunnelARHopRouterId' => $ARHopRouterId,
'localProtected' => $localLinkProtection,
'linkProtectionInUse' => $linkProtectionInUse,
@@ -434,10 +434,11 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
{
$mplsTunnelCHopCache = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'vRtrMplsTunnelCHopTable', [], 'TIMETRA-MPLS-MIB', 'nokia', '-OQUsb');
$lsp_ids = $paths->pluck('lsp_path_id', 'mplsLspPathTunnelCHopListIndex');
$chops = collect();
foreach ($mplsTunnelCHopCache as $key => $value) {
[$mplsTunnelCHopListIndex, $mplsTunnelCHopIndex] = explode('.', $key);
$lsp_path_id = $paths->firstWhere('mplsLspPathTunnelCHopListIndex', $mplsTunnelCHopListIndex)->lsp_path_id;
$lsp_path_id = $lsp_ids->get($mplsTunnelCHopListIndex);
$chops->push(new MplsTunnelCHop([
'mplsTunnelCHopListIndex' => $mplsTunnelCHopListIndex,
@@ -484,24 +485,24 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
'vrf_oid' => $vrf_oid,
'lsp_oid' => $lsp_oid,
'device_id' => $this->getDeviceId(),
'mplsLspRowStatus' => $value['vRtrMplsLspRowStatus'],
'mplsLspLastChange' => round($value['vRtrMplsLspLastChange'] / 100),
'mplsLspName' => $value['vRtrMplsLspName'],
'mplsLspAdminState' => $value['vRtrMplsLspAdminState'],
'mplsLspOperState' => $value['vRtrMplsLspOperState'],
'mplsLspRowStatus' => $value['vRtrMplsLspRowStatus'] ?? null,
'mplsLspLastChange' => round(($value['vRtrMplsLspLastChange'] ?? 0) / 100),
'mplsLspName' => $value['vRtrMplsLspName'] ?? null,
'mplsLspAdminState' => $value['vRtrMplsLspAdminState'] ?? null,
'mplsLspOperState' => $value['vRtrMplsLspOperState'] ?? null,
'mplsLspFromAddr' => $mplsLspFromAddr,
'mplsLspToAddr' => $mplsLspToAddr,
'mplsLspType' => $value['vRtrMplsLspType'],
'mplsLspFastReroute' => $value['vRtrMplsLspFastReroute'],
'mplsLspAge' => abs($value['vRtrMplsLspAge']),
'mplsLspTimeUp' => abs($value['vRtrMplsLspTimeUp']),
'mplsLspTimeDown' => abs($value['vRtrMplsLspTimeDown']),
'mplsLspPrimaryTimeUp' => abs($value['vRtrMplsLspPrimaryTimeUp']),
'mplsLspTransitions' => $value['vRtrMplsLspTransitions'],
'mplsLspLastTransition' => abs(round($value['vRtrMplsLspLastTransition'] / 100)),
'mplsLspConfiguredPaths' => $value['vRtrMplsLspConfiguredPaths'],
'mplsLspStandbyPaths' => $value['vRtrMplsLspStandbyPaths'],
'mplsLspOperationalPaths' => $value['vRtrMplsLspOperationalPaths'],
'mplsLspType' => $value['vRtrMplsLspType'] ?? null,
'mplsLspFastReroute' => $value['vRtrMplsLspFastReroute'] ?? null,
'mplsLspAge' => abs($value['vRtrMplsLspAge'] ?? 0),
'mplsLspTimeUp' => abs($value['vRtrMplsLspTimeUp'] ?? 0),
'mplsLspTimeDown' => abs($value['vRtrMplsLspTimeDown'] ?? 0),
'mplsLspPrimaryTimeUp' => abs($value['vRtrMplsLspPrimaryTimeUp'] ?? 0),
'mplsLspTransitions' => $value['vRtrMplsLspTransitions'] ?? null,
'mplsLspLastTransition' => abs(round(($value['vRtrMplsLspLastTransition'] ?? 0) / 100)),
'mplsLspConfiguredPaths' => $value['vRtrMplsLspConfiguredPaths'] ?? null,
'mplsLspStandbyPaths' => $value['vRtrMplsLspStandbyPaths'] ?? null,
'mplsLspOperationalPaths' => $value['vRtrMplsLspOperationalPaths'] ?? null,
]));
}
@@ -528,23 +529,23 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
'lsp_id' => $lsp_id,
'path_oid' => $path_oid,
'device_id' => $this->getDeviceId(),
'mplsLspPathRowStatus' => $value['vRtrMplsLspPathRowStatus'],
'mplsLspPathLastChange' => round($value['vRtrMplsLspPathLastChange'] / 100),
'mplsLspPathType' => $value['vRtrMplsLspPathType'],
'mplsLspPathBandwidth' => $value['vRtrMplsLspPathBandwidth'],
'mplsLspPathOperBandwidth' => $value['vRtrMplsLspPathOperBandwidth'],
'mplsLspPathAdminState' => $value['vRtrMplsLspPathAdminState'],
'mplsLspPathOperState' => $value['vRtrMplsLspPathOperState'],
'mplsLspPathState' => $value['vRtrMplsLspPathState'],
'mplsLspPathFailCode' => $value['vRtrMplsLspPathFailCode'],
'mplsLspPathFailNodeAddr' => $value['vRtrMplsLspPathFailNodeAddr'],
'mplsLspPathMetric' => $value['vRtrMplsLspPathMetric'],
'mplsLspPathOperMetric' => $value['vRtrMplsLspPathOperMetric'],
'mplsLspPathTimeUp' => abs($value['vRtrMplsLspPathTimeUp']),
'mplsLspPathTimeDown' => abs($value['vRtrMplsLspPathTimeDown']),
'mplsLspPathTransitionCount' => $value['vRtrMplsLspPathTransitionCount'],
'mplsLspPathTunnelARHopListIndex' => $value['vRtrMplsLspPathTunnelARHopListIndex'],
'mplsLspPathTunnelCHopListIndex' => $value['vRtrMplsLspPathTunnelCRHopListIndex'],
'mplsLspPathRowStatus' => $value['vRtrMplsLspPathRowStatus'] ?? null,
'mplsLspPathLastChange' => round(($value['vRtrMplsLspPathLastChange'] ?? 0) / 100),
'mplsLspPathType' => $value['vRtrMplsLspPathType'] ?? null,
'mplsLspPathBandwidth' => $value['vRtrMplsLspPathBandwidth'] ?? null,
'mplsLspPathOperBandwidth' => $value['vRtrMplsLspPathOperBandwidth'] ?? null,
'mplsLspPathAdminState' => $value['vRtrMplsLspPathAdminState'] ?? null,
'mplsLspPathOperState' => $value['vRtrMplsLspPathOperState'] ?? null,
'mplsLspPathState' => $value['vRtrMplsLspPathState'] ?? null,
'mplsLspPathFailCode' => $value['vRtrMplsLspPathFailCode'] ?? null,
'mplsLspPathFailNodeAddr' => $value['vRtrMplsLspPathFailNodeAddr'] ?? null,
'mplsLspPathMetric' => $value['vRtrMplsLspPathMetric'] ?? null,
'mplsLspPathOperMetric' => $value['vRtrMplsLspPathOperMetric'] ?? null,
'mplsLspPathTimeUp' => abs($value['vRtrMplsLspPathTimeUp'] ?? 0),
'mplsLspPathTimeDown' => abs($value['vRtrMplsLspPathTimeDown'] ?? 0),
'mplsLspPathTransitionCount' => $value['vRtrMplsLspPathTransitionCount'] ?? null,
'mplsLspPathTunnelARHopListIndex' => $value['vRtrMplsLspPathTunnelARHopListIndex'] ?? null,
'mplsLspPathTunnelCHopListIndex' => $value['vRtrMplsLspPathTunnelCRHopListIndex'] ?? null,
]));
}
@@ -609,23 +610,23 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
$svcs->push(new MplsService([
'svc_oid' => $value['svcId'],
'device_id' => $this->getDeviceId(),
'svcRowStatus' => $value['svcRowStatus'],
'svcType' => $value['svcType'],
'svcCustId' => $value['svcCustId'],
'svcAdminStatus' => $value['svcAdminStatus'],
'svcOperStatus' => $value['svcOperStatus'],
'svcDescription' => $value['svcDescription'],
'svcMtu' => $value['svcMtu'],
'svcNumSaps' => $value['svcNumSaps'],
'svcNumSdps' => $value['svcNumSdps'],
'svcLastMgmtChange' => round($value['svcLastMgmtChange'] / 100),
'svcLastStatusChange' => round($value['svcLastStatusChange'] / 100),
'svcVRouterId' => $value['svcVRouterId'],
'svcTlsMacLearning' => $value['svcTlsMacLearning'],
'svcTlsStpAdminStatus' => $value['svcTlsStpAdminStatus'],
'svcTlsStpOperStatus' => $value['svcTlsStpOperStatus'],
'svcTlsFdbTableSize' => $value['svcTlsFdbTableSize'],
'svcTlsFdbNumEntries' => $value['svcTlsFdbNumEntries'],
'svcRowStatus' => $value['svcRowStatus'] ?? null,
'svcType' => $value['svcType'] ?? null,
'svcCustId' => $value['svcCustId'] ?? null,
'svcAdminStatus' => $value['svcAdminStatus'] ?? null,
'svcOperStatus' => $value['svcOperStatus'] ?? null,
'svcDescription' => $value['svcDescription'] ?? null,
'svcMtu' => $value['svcMtu'] ?? null,
'svcNumSaps' => $value['svcNumSaps'] ?? null,
'svcNumSdps' => $value['svcNumSdps'] ?? null,
'svcLastMgmtChange' => round(($value['svcLastMgmtChange'] ?? 0) / 100),
'svcLastStatusChange' => round(($value['svcLastStatusChange'] ?? 0) / 100),
'svcVRouterId' => $value['svcVRouterId'] ?? null,
'svcTlsMacLearning' => $value['svcTlsMacLearning'] ?? null,
'svcTlsStpAdminStatus' => $value['svcTlsStpAdminStatus'] ?? null,
'svcTlsStpOperStatus' => $value['svcTlsStpOperStatus'] ?? null,
'svcTlsFdbTableSize' => $value['svcTlsFdbTableSize'] ?? null,
'svcTlsFdbNumEntries' => $value['svcTlsFdbNumEntries'] ?? null,
]));
}
@@ -684,10 +685,10 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
->addDataset('sapEgressDroppedBits', 'COUNTER', 0);
$fields = [
'sapIngressBits' => $mplsSapTrafficCache[$traffic_id]['sapBaseStatsIngressPchipOfferedLoPrioOctets'] * 8,
'sapEgressBits' => $mplsSapTrafficCache[$traffic_id]['sapBaseStatsEgressQchipForwardedOutProfOctets'] * 8,
'sapIngressDroppedBits' => $mplsSapTrafficCache[$traffic_id]['sapBaseStatsIngressQchipDroppedLoPrioOctets'] * 8,
'sapEgressDroppedBits' => $mplsSapTrafficCache[$traffic_id]['sapBaseStatsEgressQchipDroppedOutProfOctets'] * 8,
'sapIngressBits' => ($mplsSapTrafficCache[$traffic_id]['sapBaseStatsIngressPchipOfferedLoPrioOctets'] ?? 0) * 8,
'sapEgressBits' => ($mplsSapTrafficCache[$traffic_id]['sapBaseStatsEgressQchipForwardedOutProfOctets'] ?? 0) * 8,
'sapIngressDroppedBits' => ($mplsSapTrafficCache[$traffic_id]['sapBaseStatsIngressQchipDroppedLoPrioOctets'] ?? 0) * 8,
'sapEgressDroppedBits' => ($mplsSapTrafficCache[$traffic_id]['sapBaseStatsEgressQchipDroppedOutProfOctets'] ?? 0) * 8,
];
$tags = [
@@ -782,11 +783,11 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
'mplsTunnelARHopIndex' => $mplsTunnelARHopIndex,
'lsp_path_id' => $lsp_path_id,
'device_id' => $this->getDeviceId(),
'mplsTunnelARHopAddrType' => $value['mplsTunnelARHopAddrType'],
'mplsTunnelARHopIpv4Addr' => $value['mplsTunnelARHopIpv4Addr'],
'mplsTunnelARHopIpv6Addr' => $value['mplsTunnelARHopIpv6Addr'],
'mplsTunnelARHopAsNumber' => $value['mplsTunnelARHopAsNumber'],
'mplsTunnelARHopStrictOrLoose' => $value['mplsTunnelARHopStrictOrLoose'],
'mplsTunnelARHopAddrType' => $value['mplsTunnelARHopAddrType'] ?? null,
'mplsTunnelARHopIpv4Addr' => $value['mplsTunnelARHopIpv4Addr'] ?? null,
'mplsTunnelARHopIpv6Addr' => $value['mplsTunnelARHopIpv6Addr'] ?? null,
'mplsTunnelARHopAsNumber' => $value['mplsTunnelARHopAsNumber'] ?? null,
'mplsTunnelARHopStrictOrLoose' => $value['mplsTunnelARHopStrictOrLoose'] ?? null,
'mplsTunnelARHopRouterId' => $ARHopRouterId,
'localProtected' => $localLinkProtection,
'linkProtectionInUse' => $linkProtectionInUse,
@@ -805,11 +806,12 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
public function pollMplsTunnelCHops($paths)
{
$mplsTunnelCHopCache = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'vRtrMplsTunnelCHopTable', [], 'TIMETRA-MPLS-MIB', 'nokia', '-OQUsb');
$path_ids = $paths->pluck('lsp_path_id', 'mplsLspPathTunnelCHopListIndex');
$chops = collect();
foreach ($mplsTunnelCHopCache as $key => $value) {
[$mplsTunnelCHopListIndex, $mplsTunnelCHopIndex] = explode('.', $key);
$lsp_path_id = $paths->firstWhere('mplsLspPathTunnelCHopListIndex', $mplsTunnelCHopListIndex)->lsp_path_id;
$lsp_path_id = $path_ids[$mplsTunnelCHopListIndex] ?? null;
$chops->push(new MplsTunnelCHop([
'mplsTunnelCHopListIndex' => $mplsTunnelCHopListIndex,

View File

@@ -34,13 +34,13 @@ class Topvision extends \LibreNMS\OS implements OSPolling
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
$device->serial = snmp_getnext($this->getDeviceArray(), '.1.3.6.1.4.1.32285.11.1.1.2.1.1.1.16', '-OQv') ?? null;
$device->serial = snmp_getnext($this->getDeviceArray(), '.1.3.6.1.4.1.32285.11.1.1.2.1.1.1.16', '-OQv') ?: null;
if (empty($device->hardware)) {
$device->hardware = snmp_getnext($this->getDeviceArray(), '.1.3.6.1.4.1.32285.11.1.1.2.1.1.1.18', '-OQv') ?? null;
$device->hardware = snmp_getnext($this->getDeviceArray(), '.1.3.6.1.4.1.32285.11.1.1.2.1.1.1.18', '-OQv') ?: null;
}
}
public function pollOS()
public function pollOS(): void
{
$cmstats = snmp_get_multi_oid($this->getDeviceArray(), ['.1.3.6.1.4.1.32285.11.1.1.2.2.3.1.0', '.1.3.6.1.4.1.32285.11.1.1.2.2.3.6.0', '.1.3.6.1.4.1.32285.11.1.1.2.2.3.5.0']);
if (is_numeric($cmstats['.1.3.6.1.4.1.32285.11.1.1.2.2.3.1.0'])) {

View File

@@ -172,12 +172,16 @@ trait HostResources
'mempool_used_oid' => ".1.3.6.1.2.1.25.2.3.1.6.$index",
'mempool_total_oid' => null,
]))->setClass(null, $storage['hrStorageType'] == 'hrStorageVirtualMemory' ? 'virtual' : 'system')
->fillUsage($storage['hrStorageUsed'], $total);
->fillUsage($storage['hrStorageUsed'] ?? null, $total);
});
}
protected function memValid($storage)
{
if (empty($storage['hrStorageType']) || empty($storage['hrStorageDescr'])) {
return false;
}
if (! in_array($storage['hrStorageType'], $this->memoryStorageTypes)) {
return false;
}

View File

@@ -73,7 +73,7 @@ trait UcdResources
'mempool_precision' => 1024,
'mempool_descr' => 'Physical memory',
'mempool_free_oid' => '.1.3.6.1.4.1.2021.4.6.0',
]))->fillUsage(null, $data[0]['memTotalReal'], $data[0]['memAvailReal'] + $data[0]['memBuffer'] + $data[0]['memCached']));
]))->fillUsage(null, $data[0]['memTotalReal'] ?? null, ($data[0]['memAvailReal'] ?? 0) + ($data[0]['memBuffer'] ?? 0) + ($data[0]['memCached'] ?? 0)));
}
if ($this->oidValid($data, 'memTotalSwap') && $this->oidValid($data, 'memAvailSwap')) {

View File

@@ -92,21 +92,21 @@ trait YamlMempoolsDiscovery
private function getData($field, $index, $yaml)
{
$oid = $yaml[$field];
if (isset($this->mempoolsData[$index][$oid])) {
return $this->mempoolsData[$index][$oid];
$data = $yaml[$field] ?? null;
if (isset($this->mempoolsData[$index][$data])) {
return $this->mempoolsData[$index][$data];
}
if (isset($this->mempoolsPrefetch[$index][$oid])) {
return $this->mempoolsPrefetch[$index][$oid];
if (isset($this->mempoolsPrefetch[$index][$data])) {
return $this->mempoolsPrefetch[$index][$data];
}
return is_numeric($yaml[$field]) ? $yaml[$field] : null; // hard coded number
return is_numeric($data) ? $data : null; // hard coded number
}
private function getOid($field, $index, $yaml)
{
if (YamlDiscovery::oidIsNumeric($yaml[$field])) {
if (YamlDiscovery::oidIsNumeric($yaml[$field] ?? '')) {
return $yaml[$field];
}
@@ -134,8 +134,8 @@ trait YamlMempoolsDiscovery
}
foreach ($this->mempoolsFields as $field) {
$oid = $yaml[$field];
if (isset($oid) && ! is_numeric($oid)) { // allow for hard-coded values
if (isset($yaml[$field]) && ! is_numeric($yaml[$field])) { // allow for hard-coded values
$oid = $yaml[$field];
if (YamlDiscovery::oidIsNumeric($oid)) { // if numeric oid, it is not a table, just fetch it
$this->mempoolsData[0][$oid] = snmp_get($this->getDeviceArray(), $oid, '-Oqv');
continue;

View File

@@ -67,6 +67,7 @@ trait YamlOSDiscovery
Log::debug('Yaml OS data:', $data);
$template_data = array_merge($this->getDevice()->only($this->osFields), $data);
foreach ($oids as $field => $oid_list) {
if ($value = $this->findFirst($data, $oid_list, $numeric)) {
// extract via regex if requested
@@ -76,7 +77,7 @@ trait YamlOSDiscovery
}
$device->$field = isset($os_yaml["{$field}_template"])
? trim(SimpleTemplate::parse($os_yaml["{$field}_template"], $data))
? trim(SimpleTemplate::parse($os_yaml["{$field}_template"], $template_data))
: $value;
}
}

View File

@@ -67,8 +67,8 @@ class Vrp extends OS implements
$mempools_array = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'entPhysicalName', $mempools_array, 'HUAWEI-ENTITY-EXTENT-MIB', 'huawei');
foreach (Arr::wrap($mempools_array) as $index => $entry) {
$size = empty($entry['hwEntityMemSizeMega']) ? $entry['hwEntityMemSize'] : $entry['hwEntityMemSizeMega'];
$descr = empty($entry['entPhysicalName']) ? $entry['hwEntityBomEnDesc'] : $entry['entPhysicalName'];
$size = empty($entry['hwEntityMemSizeMega']) ? ($entry['hwEntityMemSize'] ?? null) : $entry['hwEntityMemSizeMega'];
$descr = empty($entry['entPhysicalName']) ? ($entry['hwEntityBomEnDesc'] ?? null) : $entry['entPhysicalName'];
if ($size != 0 && $descr && ! Str::contains($descr, 'No') && ! Str::contains($entry['hwEntityMemUsage'], 'No')) {
$mempools->push((new Mempool([
@@ -106,7 +106,7 @@ class Vrp extends OS implements
}
}
public function pollOS()
public function pollOS(): void
{
// Polling the Wireless data TODO port to module
$apTable = snmpwalk_group($this->getDeviceArray(), 'hwWlanApName', 'HUAWEI-WLAN-AP-MIB', 2);
@@ -143,8 +143,8 @@ class Vrp extends OS implements
//$a_index_oid = implode(".", array_map("hexdec", explode(":", $ap_id)));
foreach ($ap as $r_id => $radio) {
foreach ($radio as $s_index => $ssid) {
$clientPerRadio[$ap_id][$r_id] += $ssid['hwWlanVapStaOnlineCnt'];
$numClients += $ssid['hwWlanVapStaOnlineCnt'];
$clientPerRadio[$ap_id][$r_id] = ($clientPerRadio[$ap_id][$r_id] ?? 0) + ($ssid['hwWlanVapStaOnlineCnt'] ?? 0);
$numClients += ($ssid['hwWlanVapStaOnlineCnt'] ?? 0);
}
}
}
@@ -167,16 +167,16 @@ class Vrp extends OS implements
foreach ($radioTable as $ap_id => $ap) {
foreach ($ap as $r_id => $radio) {
$channel = $radio['hwWlanRadioWorkingChannel'];
$mac = $radio['hwWlanRadioMac'];
$name = $apTable[$ap_id]['hwWlanApName'] . ' Radio ' . $r_id;
$channel = $radio['hwWlanRadioWorkingChannel'] ?? null;
$mac = $radio['hwWlanRadioMac'] ?? null;
$name = ($apTable[$ap_id]['hwWlanApName'] ?? '') . ' Radio ' . $r_id;
$radionum = $r_id;
$txpow = $radio['hwWlanRadioActualEIRP'];
$interference = $radio['hwWlanRadioChInterferenceRate'];
$radioutil = $radio['hwWlanRadioChUtilizationRate'];
$numasoclients = $clientPerRadio[$ap_id][$r_id];
$txpow = $radio['hwWlanRadioActualEIRP'] ?? null;
$interference = $radio['hwWlanRadioChInterferenceRate'] ?? null;
$radioutil = $radio['hwWlanRadioChUtilizationRate'] ?? null;
$numasoclients = $clientPerRadio[$ap_id][$r_id] ?? null;
switch ($radio['hwWlanRadioFreqType']) {
switch ($radio['hwWlanRadioFreqType'] ?? null) {
case 1:
$type = '2.4Ghz';
break;
@@ -184,7 +184,7 @@ class Vrp extends OS implements
$type = '5Ghz';
break;
default:
$type = 'unknown (huawei ' . $radio['hwWlanRadioFreqType'] . ')';
$type = 'unknown (huawei ' . ($radio['hwWlanRadioFreqType'] ?? null) . ')';
}
// TODO
@@ -369,20 +369,20 @@ class Vrp extends OS implements
continue; //this would happen for an SSH session for instance
}
$nac->put($mac_address, new PortsNac([
'port_id' => $ifName_map->get($portAuthSessionEntryParameters['hwAccessInterface'], 0),
'port_id' => $ifName_map->get($portAuthSessionEntryParameters['hwAccessInterface'] ?? null, 0),
'mac_address' => $mac_address,
'auth_id' => $authId,
'domain' => $portAuthSessionEntryParameters['hwAccessDomain'],
'username' => '' . $portAuthSessionEntryParameters['hwAccessUserName'],
'ip_address' => $portAuthSessionEntryParameters['hwAccessIPAddress'],
'authz_by' => '' . $portAuthSessionEntryParameters['hwAccessType'],
'authz_status' => '' . $portAuthSessionEntryParameters['hwAccessAuthorizetype'],
'host_mode' => is_null($portAuthSessionEntryParameters['hwAccessAuthType']) ? 'default' : $portAuthSessionEntryParameters['hwAccessAuthType'],
'timeout' => $portAuthSessionEntryParameters['hwAccessSessionTimeout'],
'time_elapsed' => $portAuthSessionEntryParameters['hwAccessOnlineTime'],
'authc_status' => $portAuthSessionEntryParameters['hwAccessCurAuthenPlace'],
'method' => '' . $portAuthSessionEntryParameters['hwAccessAuthtype'],
'vlan' => $portAuthSessionEntryParameters['hwAccessVLANID'],
'domain' => $portAuthSessionEntryParameters['hwAccessDomain'] ?? null,
'username' => $portAuthSessionEntryParameters['hwAccessUserName'] ?? '',
'ip_address' => $portAuthSessionEntryParameters['hwAccessIPAddress'] ?? null,
'authz_by' => $portAuthSessionEntryParameters['hwAccessType'] ?? '',
'authz_status' => $portAuthSessionEntryParameters['hwAccessAuthorizetype'] ?? '',
'host_mode' => $portAuthSessionEntryParameters['hwAccessAuthType'] ?? 'default',
'timeout' => $portAuthSessionEntryParameters['hwAccessSessionTimeout'] ?? null,
'time_elapsed' => $portAuthSessionEntryParameters['hwAccessOnlineTime'] ?? null,
'authc_status' => $portAuthSessionEntryParameters['hwAccessCurAuthenPlace'] ?? null,
'method' => $portAuthSessionEntryParameters['hwAccessAuthtype'] ?? '',
'vlan' => $portAuthSessionEntryParameters['hwAccessVLANID'] ?? null,
]));
}
}
@@ -534,10 +534,10 @@ class Vrp extends OS implements
$divisor = 1; //values are already returned in ms, and RRD expects them in ms
// Use DISMAN-PING Status codes. 0=Good 2=Critical
$sla->opstatus = $data[$owner][$test]['pingCtlRowStatus'] == '1' ? 0 : 2;
$sla->opstatus = ($data[$owner][$test]['pingCtlRowStatus'] ?? null) == '1' ? 0 : 2;
$sla->rtt = $data[$owner][$test]['pingResultsAverageRtt'] / $divisor;
$time = Carbon::parse($data[$owner][$test]['pingResultsLastGoodProbe'])->toDateTimeString();
$sla->rtt = ($data[$owner][$test]['pingResultsAverageRtt'] ?? 0) / $divisor;
$time = Carbon::parse($data[$owner][$test]['pingResultsLastGoodProbe'] ?? null)->toDateTimeString();
echo 'SLA : ' . $rtt_type . ' ' . $owner . ' ' . $test . '... ' . $sla->rtt . 'ms at ' . $time . "\n";
$fields = [
@@ -556,8 +556,8 @@ class Vrp extends OS implements
$icmp = [
//'MinRtt' => $data[$owner][$test]['pingResultsMinRtt'] / $divisor,
//'MaxRtt' => $data[$owner][$test]['pingResultsMaxRtt'] / $divisor,
'ProbeResponses' => $data[$owner][$test]['pingResultsProbeResponses'],
'ProbeLoss' => (int) $data[$owner][$test]['pingResultsSentProbes'] - (int) $data[$owner][$test]['pingResultsProbeResponses'],
'ProbeResponses' => $data[$owner][$test]['pingResultsProbeResponses'] ?? null,
'ProbeLoss' => (int) ($data[$owner][$test]['pingResultsSentProbes'] ?? 0) - (int) ($data[$owner][$test]['pingResultsProbeResponses'] ?? 0),
];
$rrd_name = ['sla', $sla_nr, $rtt_type];
$rrd_def = RrdDefinition::make()

View File

@@ -35,15 +35,16 @@ class Windows extends \LibreNMS\OS
public function discoverOS(Device $device): void
{
if (preg_match('/Hardware: (?<hardware>.*) +- Software: .* Version (?<nt>\S+) +\(Build( Number:)? (?<build>\S+) (?<smp>\S+)/', $device->sysDescr, $matches)) {
$device->hardware = $this->parseHardware($matches['hardware']);
$device->features = $matches['smp'];
$device->hardware = $this->parseHardware($matches['hardware'] ?? null);
$device->features = $matches['smp'] ?? null;
$build = $matches['build'] ?? null;
if ($device->sysObjectID == '.1.3.6.1.4.1.311.1.1.3.1.1') {
$device->version = $this->getClientVersion($matches['build'], $matches['version']);
$device->version = $this->getClientVersion($build, $matches['version'] ?? null);
} elseif ($device->sysObjectID == '.1.3.6.1.4.1.311.1.1.3.1.2') {
$device->version = $this->getServerVersion($matches['build']);
$device->version = $this->getServerVersion($build);
} elseif ($device->sysObjectID == '.1.3.6.1.4.1.311.1.1.3.1.3') {
$device->version = $this->getDatacenterVersion($matches['build']);
$device->version = $this->getDatacenterVersion($build);
}
}

View File

@@ -33,10 +33,13 @@ use LibreNMS\Interfaces\Discovery\Sensors\WirelessRateDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRssiDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessSnrDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessUtilizationDiscovery;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\Interfaces\Polling\Sensors\WirelessFrequencyPolling;
use LibreNMS\OS;
use LibreNMS\RRD\RrdDefinition;
class XirrusAos extends OS implements
OSPolling,
WirelessClientsDiscovery,
WirelessFrequencyDiscovery,
WirelessFrequencyPolling,
@@ -46,6 +49,38 @@ class XirrusAos extends OS implements
WirelessRssiDiscovery,
WirelessSnrDiscovery
{
public function pollOS(): void
{
$associations = [];
// if this config flag is true, don't poll for stations
// this in case of large APs which may have many stations
// to prevent causing long polling times
if (\LibreNMS\Config::get('xirrus_disable_stations') != true) {
// station associations
// custom RRDs and graph as each AP may have 16 radios
$assoc = snmpwalk_cache_oid($this->getDeviceArray(), 'XIRRUS-MIB::stationAssociationIAP', [], 'XIRRUS-MIB');
foreach ($assoc as $s) {
$radio = array_pop($s);
$associations[$radio] = (int) $associations[$radio] + 1;
}
unset($radio);
unset($assoc);
// write to rrds
foreach ($associations as $radio => $count) {
$measurement = 'xirrus_users';
$rrd_name = [$measurement, $radio];
$rrd_def = RrdDefinition::make()->addDataset('stations', 'GAUGE', 0, 3200);
$fields = [
'stations' => $count,
];
$tags = compact('radio', 'rrd_name', 'rrd_def');
data_update($this->getDeviceArray(), $measurement, $tags, $fields);
}
$this->enableGraph('xirrus_stations');
}
}
/**
* Returns an array of LibreNMS\Device\Sensor objects that have been discovered
*

View File

@@ -1,8 +1,8 @@
<?php
/*
* LibreNMS
* Zebra.php
*
* ptp600.inc.php
* -Description-
*
* 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
@@ -15,14 +15,26 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link https://www.librenms.org
* @copyright 2017 Paul Heinrichs
* @author Paul Heinrichs<pdheinrichs@gmail.com>
* @link http://librenms.org
* @copyright 2021 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
$version = $device['sysDescr'];
$masterSlaveMode = ucfirst(snmp_get($device, 'masterSlaveMode.0', '-Oqv', 'CANOPY-SYS-MIB'));
$hardware = 'PTP 600 ' . $masterSlaveMode;
namespace LibreNMS\OS;
use App\Models\Device;
use Illuminate\Support\Str;
use LibreNMS\OS;
class Zebra extends OS
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
$device->features = Str::contains($device->sysDescr, 'ireless') ? 'wireless' : 'wired';
}
}

View File

@@ -45,7 +45,7 @@ class Zywall extends Zyxel implements OSDiscovery, OSPolling
}
}
public function pollOS()
public function pollOS(): void
{
$sessions = snmp_get($this->getDeviceArray(), '.1.3.6.1.4.1.890.1.6.22.1.6.0', '-Ovq');
if (is_numeric($sessions)) {

View File

@@ -457,9 +457,9 @@ class Rewrite
* If given input is an IPv6 address, wrap it in [] for use in applications that require it
*
* @param string $ip
* @return string
* @return string|null
*/
public static function addIpv6Brackets($ip): string
public static function addIpv6Brackets($ip): ?string
{
return IPv6::isValid($ip) ? "[$ip]" : $ip;
}

46
LibreNMS/Waas.php Normal file
View File

@@ -0,0 +1,46 @@
<?php
/*
* Waas.php
*
* -Description-
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2021 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\RRD\RrdDefinition;
class Waas extends OS implements OSPolling
{
public function pollOS(): void
{
$connections = \SnmpQuery::get('CISCO-WAN-OPTIMIZATION-MIB::cwoTfoStatsActiveOptConn.0')->value();
if (is_numeric($connections)) {
data_update($this->getDeviceArray(), 'waas_cwotfostatsactiveoptconn', [
'rrd_def' => RrdDefinition::make()->addDataset('connections', 'GAUGE', 0),
], [
'connections' => $connections,
]);
$this->enableGraph('waas_cwotfostatsactiveoptconn');
}
}
}

View File

@@ -0,0 +1,96 @@
<?php
namespace App\Console\Commands;
use App\Models\Device;
use Illuminate\Console\Command;
use Illuminate\Support\Str;
use Symfony\Component\Process\Process;
class FindWarnings extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'find:warnings {regex? : regex to match snmprec files (default /.*/)}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* @var bool
*/
private $found = false;
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
// TODO DELETE ME
$regex = $this->argument('regex') ?: '/./';
$modules = 'core,isis,mempools,mpls,nac,netstats,os,printer-supplies,slas';
foreach (glob(base_path('tests/snmpsim/*.snmprec')) as $file) {
if ($this->found) {
break;
}
$community = basename($file, '.snmprec');
if (preg_match($regex, $community)) {
$this->addDevice($community);
$this->info($community);
$process = new Process(['./discovery.php', '-d', '-h', 'snmpsim', '-m', $modules]);
$process->run([$this, 'find']);
$process = new Process(['./poller.php', '-d', '-h', 'snmpsim', '-m', $modules]);
$process->run([$this, 'find']);
}
}
return Command::SUCCESS;
}
public function find(string $type, string $buffer): void
{
if (Str::contains($buffer, ['Warning:', 'Error:'])) {
preg_match_all('/^(Warning|\S*Error): .*$/', $buffer, $matches);
$this->error(implode(PHP_EOL, $matches[0]));
$this->found = true;
}
}
private function addDevice(string $community): void
{
$device = Device::firstOrNew(['hostname' => 'snmpsim']);
$device->overwrite_ip = '127.1.6.1';
$device->port = 1161;
$device->snmpver = 'v2c';
$device->transport = 'udp';
$device->community = $community;
$device->last_discovered = null;
$device->status_reason = '';
$device->save();
}
}

View File

@@ -2,8 +2,30 @@
namespace App\Models;
class AccessPoint extends DeviceRelatedModel
use LibreNMS\Interfaces\Models\Keyable;
class AccessPoint extends DeviceRelatedModel implements Keyable
{
protected $primaryKey = 'accesspoint_id';
public $timestamps = false;
protected $fillable = [
'device_id',
'name',
'radio_number',
'type',
'mac_addr',
'channel',
'txpow',
'radioutil',
'numasoclients',
'nummonclients',
'numactbssid',
'nummonbssid',
'interference',
];
public function getCompositeKey()
{
return "{$this->name}_{$this->radio_number}";
}
}

View File

@@ -164,7 +164,7 @@ class Mempool extends DeviceRelatedModel implements Keyable
private function calculateTotal($total, $used, $free)
{
if ($total !== null) {
return $total * $this->mempool_precision;
return (int) $total * $this->mempool_precision;
}
if ($used !== null && $free !== null) {

View File

@@ -37,7 +37,11 @@ class MempoolObserver extends ModuleModelObserver
if ($model->isDirty('mempool_class')) {
Log::debug("Mempool class changed $model->mempool_descr ($model->mempool_id)");
Rrd::renameFile($model->device->toArray(), ['mempool', $model->mempool_type, $model->getOriginal('mempool_class'), $model->mempool_index], ['mempool', $model->mempool_type, $model->mempool_class, $model->mempool_index]);
$device = [
'device_id' => $model->device->device_id,
'hostname' => $model->device->hostname,
];
Rrd::renameFile($device, ['mempool', $model->mempool_type, $model->getOriginal('mempool_class'), $model->mempool_index], ['mempool', $model->mempool_type, $model->mempool_class, $model->mempool_index]);
}
}
}

View File

@@ -1,3 +1,3 @@
modules:
os:
sysDescr_regex: 'VERSION (?<version>[^;]+); PID (?<hardware>[^;]+); Serial (?<serial>[^;]+)'
sysDescr_regex: '/VERSION (?<version>[^;]+); PID (?<hardware>[^;]+); Serial (?<serial>[^;]+)/'

View File

@@ -0,0 +1,5 @@
modules:
os:
hardware: .1.3.6.1.4.1.18928.1.1.1.1.0
serial: .1.3.6.1.4.1.18928.1.2.1.3.0
version: .1.3.6.1.4.1.18928.1.2.1.4.0

View File

@@ -1,5 +1,17 @@
mib: CISCO-REMOTE-ACCESS-MONITOR-MIB
modules:
os:
sysDescr_regex: '/Version (?<version>.*)/'
version:
- ENTITY-MIB::entPhysicalSoftwareRev.1
- ENTITY-MIB::entPhysicalSoftwareRev.4
serial:
- ENTITY-MIB::entPhysicalSerialNum.1
- ENTITY-MIB::entPhysicalSerialNum.4
hardware:
- ENTITY-MIB::entPhysicalModelName.1
- ENTITY-MIB::entPhysicalModelName.4
hardware_mib: CISCO-PRODUCTS-MIB
sensors:
count:
data:

View File

@@ -0,0 +1,3 @@
modules:
os:
sysDescr_regex: '/Model (?<hardware>.*), AsyncOS Version: (?<version>[^,]+).*Serial #: (?<serial>.*)/'

View File

@@ -0,0 +1,4 @@
modules:
os:
hardware: ENTITY-MIB::entPhysicalDescr.1
sysDescr_regex: '/(?<version>.*)/'

View File

@@ -1,3 +1,3 @@
modules:
os:
sysDescr_regex: '(?<hardware>[^;]+); [^;]+; (?<version>[^;]+)'
sysDescr_regex: '/(?<hardware>[^;]+); [^;]+; (?<version>[^;]+)/'

View File

@@ -15,6 +15,7 @@ modules:
serial:
- NMS-CHASSIS::nmscardSerial.0
- NMS-CHASSIS::nmscardSerial.1
sysDescr_regex: '/BDCOM\(tm\) (?<hardware>[A-Z0-9]+) Software, Version (?<version>.*)\nCompiled: .*\n.*,Serial num:(?<serial>[0-9]+)/'
pre-cache:
data:
-

View File

@@ -1,5 +1,8 @@
mib: BENU-HOST-MIB
modules:
os:
serial: BENU-CHASSIS-MIB::benuChassisId.0
sysDescr_regex: '/BenuOS\, (?<version>.*)\n.Product\:(?<features>.*)\n.*\n.*\n Chassis Type \:(?<hardware>.*)/'
mempools:
data:
-

View File

@@ -1,5 +1,9 @@
mib: PRVT-SYS-MON-MIB
modules:
os:
hardware: .1.3.6.1.4.1.738.1.5.100.1.3.2.0
serial: .1.3.6.1.4.1.738.1.5.100.1.3.1.0
version: .1.3.6.1.4.1.738.1.111.1.1.4.0
mempools:
data:
-

View File

@@ -0,0 +1,3 @@
modules:
os:
sysDescr_regex: '/(?<hardware>.*)/'

View File

@@ -1,5 +1,9 @@
mib: BCN-HA-MIB:BCN-DHCPV4-MIB:BCN-DNS-MIB:BCN-NTP-MIB
modules:
os:
version: BCN-SYSTEM-MIB::bcnSysIdOSRelease.0
hardware: BCN-SYSTEM-MIB::bcnSysIdPlatform.0
serial: BCN-SYSTEM-MIB::bcnSysIdSerial.0
sensors:
state:
data:

View File

@@ -0,0 +1,3 @@
modules:
os:
sysDescr_regex: '/BNT (?<hardware>.*Module)/'

View File

@@ -0,0 +1,4 @@
modules:
os:
version: ALVARION-DOT11-WLAN-MIB::brzaccVLRunningSoftwareVersion.0
sysDescr_regex: '/Alvarion - (?<hardware>.*) , Version: (?<version>\S+)/'

View File

@@ -0,0 +1,3 @@
modules:
os:
sysDescr_regex: '/BUFFALO (?<hardware>.*) Ver\.?(?<version>\S+)/'

View File

@@ -0,0 +1,4 @@
modules:
os:
hardware: '1900'
sysDescr_regex: '/,(?<version>V[\d.]+)/'

View File

@@ -0,0 +1,3 @@
modules:
os:
sysDescr_regex: '/(?<hardware>WS-[\w-]+).*Version (?<version>[\w.()]+)/'

View File

@@ -1,5 +1,8 @@
mib: CPI-UNITY-MIB
modules:
os:
serial: .1.3.6.1.4.1.30932.1.1.1.2.0
version: .1.3.6.1.4.1.30932.1.1.1.1.0
sensors:
pre-cache:
data:

View File

@@ -0,0 +1,3 @@
modules:
os:
sysDescr_regex: '/Version (?<version>.*) Platform: (?<hardware>.*)/'

View File

@@ -0,0 +1,4 @@
modules:
os:
hardware: SA-HARDWARE-MIB::saHwDescrModel.0
serial: SA-HARDWARE-MIB::saHwDescrSerialNumber.0

View File

@@ -0,0 +1,3 @@
modules:
os:
sysDescr_regex: '/Version (?<version>\S*).*HW version: (?<hardware>.*)/'

View File

@@ -0,0 +1,9 @@
modules:
os:
hardware:
- ENTITY-MIB::entPhysicalModelName.1
- ENTITY-MIB::entPhysicalModelName.1001
- ENTITY-MIB::entPhysicalName.1
hardware_mib: CISCO-PRODUCTS-MIB
version: ENTITY-MIB::entPhysicalSoftwareRev.1
serial: ENTITY-MIB::entPhysicalSerialNum.1

View File

@@ -0,0 +1,3 @@
modules:
os:
sysDescr_regex: '/(?<hardware>WAP[\w-]+)( \((?<features>WAP[^)]+)\))?, Version (?<version>[\w.()]+)/'

View File

@@ -1,5 +1,12 @@
mib: AIRESPACE-SWITCHING-MIB
modules:
os:
hardware:
- ENTITY-MIB::entPhysicalModelName.1
- ENTITY-MIB::entPhysicalName.1
hardware_mib: CISCO-PRODUCTS-MIB
version: ENTITY-MIB::entPhysicalSoftwareRev.1
serial: ENTITY-MIB::entPhysicalSerialNum.1
mempools:
data:
-

Some files were not shown because too many files have changed in this diff Show More