diff --git a/LibreNMS/Data/Source/SnmpQueryInterface.php b/LibreNMS/Data/Source/SnmpQueryInterface.php index 3412f26e5a..cbd1ab3c46 100644 --- a/LibreNMS/Data/Source/SnmpQueryInterface.php +++ b/LibreNMS/Data/Source/SnmpQueryInterface.php @@ -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; diff --git a/LibreNMS/Device/YamlDiscovery.php b/LibreNMS/Device/YamlDiscovery.php index ab21dcb194..18834a7c90 100644 --- a/LibreNMS/Device/YamlDiscovery.php +++ b/LibreNMS/Device/YamlDiscovery.php @@ -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]; } diff --git a/LibreNMS/Interfaces/Polling/OSPolling.php b/LibreNMS/Interfaces/Polling/OSPolling.php index 82e81abf69..49d758b484 100644 --- a/LibreNMS/Interfaces/Polling/OSPolling.php +++ b/LibreNMS/Interfaces/Polling/OSPolling.php @@ -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; } diff --git a/LibreNMS/Modules/Core.php b/LibreNMS/Modules/Core.php index 3608e6f51e..1a937ab681 100644 --- a/LibreNMS/Modules/Core.php +++ b/LibreNMS/Modules/Core.php @@ -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"); } diff --git a/LibreNMS/Modules/OS.php b/LibreNMS/Modules/OS.php index 9822deb9d1..a2eaaf4085 100644 --- a/LibreNMS/Modules/OS.php +++ b/LibreNMS/Modules/OS.php @@ -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 { diff --git a/LibreNMS/Modules/PrinterSupplies.php b/LibreNMS/Modules/PrinterSupplies.php index e858f60d65..7bbeebe20a 100644 --- a/LibreNMS/Modules/PrinterSupplies.php +++ b/LibreNMS/Modules/PrinterSupplies.php @@ -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, diff --git a/LibreNMS/OS/Aix.php b/LibreNMS/OS/Aix.php index 00cf22051c..23b1dc518f 100644 --- a/LibreNMS/OS/Aix.php +++ b/LibreNMS/OS/Aix.php @@ -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)); diff --git a/LibreNMS/OS/Allied.php b/LibreNMS/OS/Allied.php index 540095bb6b..f124973d5c 100644 --- a/LibreNMS/OS/Allied.php +++ b/LibreNMS/OS/Allied.php @@ -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; diff --git a/includes/polling/os/zebra.inc.php b/LibreNMS/OS/Arbos.php similarity index 50% rename from includes/polling/os/zebra.inc.php rename to LibreNMS/OS/Arbos.php index 7c60ef563a..85ce1e513d 100644 --- a/includes/polling/os/zebra.inc.php +++ b/LibreNMS/OS/Arbos.php @@ -1,8 +1,8 @@ */ -// 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'; -} diff --git a/includes/polling/os/etherwan.inc.php b/LibreNMS/OS/Areca.php similarity index 56% rename from includes/polling/os/etherwan.inc.php rename to LibreNMS/OS/Areca.php index e112251372..223e557ae2 100644 --- a/includes/polling/os/etherwan.inc.php +++ b/LibreNMS/OS/Areca.php @@ -1,8 +1,8 @@ + * @copyright 2021 Tony Murray + * @author Tony Murray */ -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); + } + } } diff --git a/LibreNMS/OS/ArrisCm.php b/LibreNMS/OS/ArrisCm.php new file mode 100644 index 0000000000..e554a7ff42 --- /dev/null +++ b/LibreNMS/OS/ArrisCm.php @@ -0,0 +1,41 @@ +. + * + * @link https://www.librenms.org + * + * @copyright 2021 Tony Murray + * @author Tony Murray + */ + +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('/<.+); VENDOR:.*SW_REV: (?.+); MODEL: (?.+)>>/', $device->sysDescr, $matches); + + $device->hardware = "{$matches['hardware']} (Rev: {$matches['rev']})"; + $device->version = $matches['version']; + } +} diff --git a/LibreNMS/OS/Arubaos.php b/LibreNMS/OS/Arubaos.php index 388130e211..0705530984 100644 --- a/LibreNMS/OS/Arubaos.php +++ b/LibreNMS/OS/Arubaos.php @@ -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; } /** diff --git a/LibreNMS/OS/Asyncos.php b/LibreNMS/OS/Asyncos.php new file mode 100644 index 0000000000..6266883aca --- /dev/null +++ b/LibreNMS/OS/Asyncos.php @@ -0,0 +1,51 @@ +. + * + * @link https://www.librenms.org + * + * @copyright 2021 Tony Murray + * @author Tony Murray + */ + +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'); + } + } + } +} diff --git a/LibreNMS/OS/Barracudangfirewall.php b/LibreNMS/OS/Barracudangfirewall.php index afe2c65b15..afdcb3715a 100644 --- a/LibreNMS/OS/Barracudangfirewall.php +++ b/LibreNMS/OS/Barracudangfirewall.php @@ -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'); diff --git a/LibreNMS/OS/Boss.php b/LibreNMS/OS/Boss.php index dcc8fd1db1..b55c91770a 100644 --- a/LibreNMS/OS/Boss.php +++ b/LibreNMS/OS/Boss.php @@ -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'); diff --git a/LibreNMS/OS/Ciscosb.php b/LibreNMS/OS/Ciscosb.php index 53e8e711af..c00646fbaf 100644 --- a/LibreNMS/OS/Ciscosb.php +++ b/LibreNMS/OS/Ciscosb.php @@ -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"; } diff --git a/LibreNMS/OS/Ciscowlc.php b/LibreNMS/OS/Ciscowlc.php index 9491c5bf30..f427b1b26c 100644 --- a/LibreNMS/OS/Ciscowlc.php +++ b/LibreNMS/OS/Ciscowlc.php @@ -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 diff --git a/LibreNMS/OS/Comware.php b/LibreNMS/OS/Comware.php index 72b213c6bd..3b0759064c 100644 --- a/LibreNMS/OS/Comware.php +++ b/LibreNMS/OS/Comware.php @@ -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)); } } diff --git a/LibreNMS/OS/Coriant.php b/LibreNMS/OS/Coriant.php index 005435cd28..8da2020415 100644 --- a/LibreNMS/OS/Coriant.php +++ b/LibreNMS/OS/Coriant.php @@ -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'; diff --git a/LibreNMS/OS/DellLaser.php b/LibreNMS/OS/DellLaser.php index 1b51fbf5f9..4671177da7 100644 --- a/LibreNMS/OS/DellLaser.php +++ b/LibreNMS/OS/DellLaser.php @@ -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; } } diff --git a/LibreNMS/OS/Edgecos.php b/LibreNMS/OS/Edgecos.php index 6b4132f166..85d5cb2dba 100644 --- a/LibreNMS/OS/Edgecos.php +++ b/LibreNMS/OS/Edgecos.php @@ -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; } diff --git a/LibreNMS/OS/Engenius.php b/LibreNMS/OS/Engenius.php new file mode 100644 index 0000000000..3e9328e9c2 --- /dev/null +++ b/LibreNMS/OS/Engenius.php @@ -0,0 +1,84 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2021 Tony Murray + * @author Tony Murray + */ + +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; + } + } +} diff --git a/LibreNMS/OS/Enterasys.php b/LibreNMS/OS/Enterasys.php index eeeff9260f..e5304206a8 100644 --- a/LibreNMS/OS/Enterasys.php +++ b/LibreNMS/OS/Enterasys.php @@ -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)); } } diff --git a/LibreNMS/OS/Epmp.php b/LibreNMS/OS/Epmp.php index 5f5d0f1b78..14c26c930e 100644 --- a/LibreNMS/OS/Epmp.php +++ b/LibreNMS/OS/Epmp.php @@ -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 diff --git a/LibreNMS/OS/Exa.php b/LibreNMS/OS/Exa.php index 07df342ac4..ce5c65f230 100644 --- a/LibreNMS/OS/Exa.php +++ b/LibreNMS/OS/Exa.php @@ -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')); diff --git a/LibreNMS/OS/F5.php b/LibreNMS/OS/F5.php new file mode 100644 index 0000000000..07e127c95c --- /dev/null +++ b/LibreNMS/OS/F5.php @@ -0,0 +1,97 @@ +. + * + * @link https://www.librenms.org + * + * @copyright 2021 Tony Murray + * @author Tony Murray + */ + +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'); + } + } +} diff --git a/LibreNMS/OS/Fortigate.php b/LibreNMS/OS/Fortigate.php index 7767df07ed..2f30dc1109 100644 --- a/LibreNMS/OS/Fortigate.php +++ b/LibreNMS/OS/Fortigate.php @@ -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)) { diff --git a/LibreNMS/OS/Fortios.php b/LibreNMS/OS/Fortios.php index ae26e746d5..fe3c4fd582 100644 --- a/LibreNMS/OS/Fortios.php +++ b/LibreNMS/OS/Fortios.php @@ -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') { diff --git a/LibreNMS/OS/Gaia.php b/LibreNMS/OS/Gaia.php index 29ce9aaf87..8e5475611d 100644 --- a/LibreNMS/OS/Gaia.php +++ b/LibreNMS/OS/Gaia.php @@ -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) diff --git a/includes/polling/os/arris-cm.inc.php b/LibreNMS/OS/Hpvc.php similarity index 66% rename from includes/polling/os/arris-cm.inc.php rename to LibreNMS/OS/Hpvc.php index 68f7bba8c0..3a218e62bb 100644 --- a/includes/polling/os/arris-cm.inc.php +++ b/LibreNMS/OS/Hpvc.php @@ -1,8 +1,8 @@ */ -preg_match('/<>/', $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); + } +} diff --git a/includes/polling/os/ipolis.inc.php b/LibreNMS/OS/Ipolis.php similarity index 61% rename from includes/polling/os/ipolis.inc.php rename to LibreNMS/OS/Ipolis.php index 8946daf986..24d0ff2a35 100644 --- a/includes/polling/os/ipolis.inc.php +++ b/LibreNMS/OS/Ipolis.php @@ -1,8 +1,8 @@ */ -$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); diff --git a/LibreNMS/OS/Jetdirect.php b/LibreNMS/OS/Jetdirect.php index a36a7dfaf8..e4852c6d4f 100644 --- a/LibreNMS/OS/Jetdirect.php +++ b/LibreNMS/OS/Jetdirect.php @@ -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 ', diff --git a/LibreNMS/OS/Junos.php b/LibreNMS/OS/Junos.php index 66bdc7434e..579a5cada6 100644 --- a/LibreNMS/OS/Junos.php +++ b/LibreNMS/OS/Junos.php @@ -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() diff --git a/LibreNMS/OS/Junose.php b/LibreNMS/OS/Junose.php new file mode 100644 index 0000000000..948462b1f8 --- /dev/null +++ b/LibreNMS/OS/Junose.php @@ -0,0 +1,70 @@ +. + * + * @link https://www.librenms.org + * + * @copyright 2021 Tony Murray + * @author Tony Murray + */ + +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; + } +} diff --git a/LibreNMS/OS/Netscaler.php b/LibreNMS/OS/Netscaler.php index ae956ab991..5b291ade5f 100644 --- a/LibreNMS/OS/Netscaler.php +++ b/LibreNMS/OS/Netscaler.php @@ -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'); diff --git a/LibreNMS/OS/Nios.php b/LibreNMS/OS/Nios.php index 32250374da..8cbde60a2c 100644 --- a/LibreNMS/OS/Nios.php +++ b/LibreNMS/OS/Nios.php @@ -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'); diff --git a/LibreNMS/OS/Nitro.php b/LibreNMS/OS/Nitro.php new file mode 100644 index 0000000000..f73c54ab7d --- /dev/null +++ b/LibreNMS/OS/Nitro.php @@ -0,0 +1,49 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2021 Tony Murray + * @author Tony Murray + */ + +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'; + } + } +} diff --git a/includes/polling/os/savin.inc.php b/LibreNMS/OS/NsBsd.php similarity index 68% rename from includes/polling/os/savin.inc.php rename to LibreNMS/OS/NsBsd.php index 55672dc9ad..ded28f8988 100644 --- a/includes/polling/os/savin.inc.php +++ b/LibreNMS/OS/NsBsd.php @@ -1,6 +1,6 @@ */ -$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; + } +} diff --git a/LibreNMS/OS/Openbsd.php b/LibreNMS/OS/Openbsd.php index 97813769fd..1cc2b6e211 100644 --- a/LibreNMS/OS/Openbsd.php +++ b/LibreNMS/OS/Openbsd.php @@ -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 = [ diff --git a/LibreNMS/OS/Panos.php b/LibreNMS/OS/Panos.php index a15e980a60..3eb765e82d 100644 --- a/LibreNMS/OS/Panos.php +++ b/LibreNMS/OS/Panos.php @@ -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', diff --git a/includes/polling/os/ptp800.inc.php b/LibreNMS/OS/PbnCp.php similarity index 53% rename from includes/polling/os/ptp800.inc.php rename to LibreNMS/OS/PbnCp.php index a9f62989d2..eabba071eb 100644 --- a/includes/polling/os/ptp800.inc.php +++ b/LibreNMS/OS/PbnCp.php @@ -1,8 +1,8 @@ . + * along with this program. If not, see . * * @package LibreNMS - * @link https://www.librenms.org - * @copyright 2018 Paul Heinrichs - * @author Paul Heinrichs + * @link http://librenms.org + * @copyright 2021 Tony Murray + * @author Tony Murray */ -$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); + } +} diff --git a/LibreNMS/OS/Pfsense.php b/LibreNMS/OS/Pfsense.php index a90141c0e3..c174a4ba92 100644 --- a/LibreNMS/OS/Pfsense.php +++ b/LibreNMS/OS/Pfsense.php @@ -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 = [ diff --git a/LibreNMS/OS/Pmp.php b/LibreNMS/OS/Pmp.php index 4c3977d7e3..ff25572332 100644 --- a/LibreNMS/OS/Pmp.php +++ b/LibreNMS/OS/Pmp.php @@ -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); diff --git a/LibreNMS/OS/Poweralert.php b/LibreNMS/OS/Poweralert.php new file mode 100644 index 0000000000..c262e1c943 --- /dev/null +++ b/LibreNMS/OS/Poweralert.php @@ -0,0 +1,52 @@ +. + * + * @link https://www.librenms.org + * + * @copyright 2021 Tony Murray + * @author Tony Murray + */ + +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; + } +} diff --git a/LibreNMS/OS/Procurve.php b/LibreNMS/OS/Procurve.php index 069625b66f..687544d0b2 100644 --- a/LibreNMS/OS/Procurve.php +++ b/LibreNMS/OS/Procurve.php @@ -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'); diff --git a/LibreNMS/OS/Pulse.php b/LibreNMS/OS/Pulse.php index 88d6d1b6fd..1746a0805a 100644 --- a/LibreNMS/OS/Pulse.php +++ b/LibreNMS/OS/Pulse.php @@ -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'); diff --git a/LibreNMS/OS/Qnap.php b/LibreNMS/OS/Qnap.php index b287e8cda0..62c66c18fd 100644 --- a/LibreNMS/OS/Qnap.php +++ b/LibreNMS/OS/Qnap.php @@ -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']; } diff --git a/LibreNMS/OS/Riverbed.php b/LibreNMS/OS/Riverbed.php new file mode 100644 index 0000000000..78b2767175 --- /dev/null +++ b/LibreNMS/OS/Riverbed.php @@ -0,0 +1,184 @@ +. + * + * @link https://www.librenms.org + * + * Copyright (c) 2015 Søren Friis Rosiak + * Copyright (c) 2017 Cercel Valentin + */ + +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'); + } + } +} diff --git a/LibreNMS/OS/Routeros.php b/LibreNMS/OS/Routeros.php index 005bd03b8d..54abc7c170 100644 --- a/LibreNMS/OS/Routeros.php +++ b/LibreNMS/OS/Routeros.php @@ -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'); diff --git a/LibreNMS/OS/Rutos2xx.php b/LibreNMS/OS/Rutos2xx.php index a7cfe5fa17..08bc19708f 100644 --- a/LibreNMS/OS/Rutos2xx.php +++ b/LibreNMS/OS/Rutos2xx.php @@ -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(), [ diff --git a/LibreNMS/OS/Screenos.php b/LibreNMS/OS/Screenos.php index 6a5e97b300..ab208fb7e7 100644 --- a/LibreNMS/OS/Screenos.php +++ b/LibreNMS/OS/Screenos.php @@ -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'); + } } } diff --git a/LibreNMS/OS/Secureplatform.php b/LibreNMS/OS/Secureplatform.php index e02e3a9780..462f2aeefb 100644 --- a/LibreNMS/OS/Secureplatform.php +++ b/LibreNMS/OS/Secureplatform.php @@ -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'); diff --git a/LibreNMS/OS/Sgos.php b/LibreNMS/OS/Sgos.php index a2b6fa105b..a17fdbde7b 100644 --- a/LibreNMS/OS/Sgos.php +++ b/LibreNMS/OS/Sgos.php @@ -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 diff --git a/LibreNMS/OS/Shared/Cisco.php b/LibreNMS/OS/Shared/Cisco.php index d88dbea4e6..864791c8be 100644 --- a/LibreNMS/OS/Shared/Cisco.php +++ b/LibreNMS/OS/Shared/Cisco.php @@ -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([ diff --git a/LibreNMS/OS/Shared/Printer.php b/LibreNMS/OS/Shared/Printer.php index 4c6005d9c3..0b975a2379 100644 --- a/LibreNMS/OS/Shared/Printer.php +++ b/LibreNMS/OS/Shared/Printer.php @@ -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; } diff --git a/LibreNMS/OS/Shared/Zyxel.php b/LibreNMS/OS/Shared/Zyxel.php index 867db1611d..be9df5ea57 100644 --- a/LibreNMS/OS/Shared/Zyxel.php +++ b/LibreNMS/OS/Shared/Zyxel.php @@ -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; } } diff --git a/LibreNMS/OS/Sonicwall.php b/LibreNMS/OS/Sonicwall.php index 014ded43ba..01c58a2fe4 100644 --- a/LibreNMS/OS/Sonicwall.php +++ b/LibreNMS/OS/Sonicwall.php @@ -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', diff --git a/LibreNMS/OS/Speedtouch.php b/LibreNMS/OS/Speedtouch.php new file mode 100644 index 0000000000..04d643d995 --- /dev/null +++ b/LibreNMS/OS/Speedtouch.php @@ -0,0 +1,45 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2021 Tony Murray + * @author Tony Murray + */ + +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]; + } + } +} diff --git a/LibreNMS/OS/Svos.php b/LibreNMS/OS/Svos.php new file mode 100644 index 0000000000..77926ddffb --- /dev/null +++ b/LibreNMS/OS/Svos.php @@ -0,0 +1,53 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2021 Tony Murray + * @author Tony Murray + */ + +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']; + } + } + } +} diff --git a/LibreNMS/OS/ThreeCom.php b/LibreNMS/OS/ThreeCom.php index 61f670e9b6..38be287f48 100644 --- a/LibreNMS/OS/ThreeCom.php +++ b/LibreNMS/OS/ThreeCom.php @@ -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; } } } diff --git a/LibreNMS/OS/Timos.php b/LibreNMS/OS/Timos.php index e0b6aa9e61..da4c132782 100644 --- a/LibreNMS/OS/Timos.php +++ b/LibreNMS/OS/Timos.php @@ -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, diff --git a/LibreNMS/OS/Topvision.php b/LibreNMS/OS/Topvision.php index 8cd8af031f..bfc2ed976c 100644 --- a/LibreNMS/OS/Topvision.php +++ b/LibreNMS/OS/Topvision.php @@ -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'])) { diff --git a/LibreNMS/OS/Traits/HostResources.php b/LibreNMS/OS/Traits/HostResources.php index 60f680b8a0..12f2112aba 100644 --- a/LibreNMS/OS/Traits/HostResources.php +++ b/LibreNMS/OS/Traits/HostResources.php @@ -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; } diff --git a/LibreNMS/OS/Traits/UcdResources.php b/LibreNMS/OS/Traits/UcdResources.php index b5f77ab5ff..2fa567162a 100644 --- a/LibreNMS/OS/Traits/UcdResources.php +++ b/LibreNMS/OS/Traits/UcdResources.php @@ -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')) { diff --git a/LibreNMS/OS/Traits/YamlMempoolsDiscovery.php b/LibreNMS/OS/Traits/YamlMempoolsDiscovery.php index 9ca5d90498..2439fc5c83 100644 --- a/LibreNMS/OS/Traits/YamlMempoolsDiscovery.php +++ b/LibreNMS/OS/Traits/YamlMempoolsDiscovery.php @@ -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; diff --git a/LibreNMS/OS/Traits/YamlOSDiscovery.php b/LibreNMS/OS/Traits/YamlOSDiscovery.php index 894c26e3f4..3bef721514 100644 --- a/LibreNMS/OS/Traits/YamlOSDiscovery.php +++ b/LibreNMS/OS/Traits/YamlOSDiscovery.php @@ -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; } } diff --git a/LibreNMS/OS/Vrp.php b/LibreNMS/OS/Vrp.php index c8ac124b69..2866ea448e 100644 --- a/LibreNMS/OS/Vrp.php +++ b/LibreNMS/OS/Vrp.php @@ -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() diff --git a/LibreNMS/OS/Windows.php b/LibreNMS/OS/Windows.php index aa82137236..28112e60df 100644 --- a/LibreNMS/OS/Windows.php +++ b/LibreNMS/OS/Windows.php @@ -35,15 +35,16 @@ class Windows extends \LibreNMS\OS public function discoverOS(Device $device): void { if (preg_match('/Hardware: (?.*) +- Software: .* Version (?\S+) +\(Build( Number:)? (?\S+) (?\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); } } diff --git a/LibreNMS/OS/XirrusAos.php b/LibreNMS/OS/XirrusAos.php index aa266210f6..5c6d06c0d0 100644 --- a/LibreNMS/OS/XirrusAos.php +++ b/LibreNMS/OS/XirrusAos.php @@ -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 * diff --git a/includes/polling/os/ptp600.inc.php b/LibreNMS/OS/Zebra.php similarity index 53% rename from includes/polling/os/ptp600.inc.php rename to LibreNMS/OS/Zebra.php index 43c209bd03..0477dc82db 100644 --- a/includes/polling/os/ptp600.inc.php +++ b/LibreNMS/OS/Zebra.php @@ -1,8 +1,8 @@ . + * along with this program. If not, see . * * @package LibreNMS - * @link https://www.librenms.org - * @copyright 2017 Paul Heinrichs - * @author Paul Heinrichs + * @link http://librenms.org + * @copyright 2021 Tony Murray + * @author Tony Murray */ -$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'; + } +} diff --git a/LibreNMS/OS/Zywall.php b/LibreNMS/OS/Zywall.php index a7921d2715..8bb905bb02 100644 --- a/LibreNMS/OS/Zywall.php +++ b/LibreNMS/OS/Zywall.php @@ -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)) { diff --git a/LibreNMS/Util/Rewrite.php b/LibreNMS/Util/Rewrite.php index 9d526890c1..c00ca14db5 100644 --- a/LibreNMS/Util/Rewrite.php +++ b/LibreNMS/Util/Rewrite.php @@ -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; } diff --git a/LibreNMS/Waas.php b/LibreNMS/Waas.php new file mode 100644 index 0000000000..19c7618b9b --- /dev/null +++ b/LibreNMS/Waas.php @@ -0,0 +1,46 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2021 Tony Murray + * @author Tony Murray + */ + +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'); + } + } +} diff --git a/app/Console/Commands/FindWarnings.php b/app/Console/Commands/FindWarnings.php new file mode 100644 index 0000000000..6930d8bc48 --- /dev/null +++ b/app/Console/Commands/FindWarnings.php @@ -0,0 +1,96 @@ +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(); + } +} diff --git a/app/Models/AccessPoint.php b/app/Models/AccessPoint.php index 020b522bab..368dffe556 100644 --- a/app/Models/AccessPoint.php +++ b/app/Models/AccessPoint.php @@ -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}"; + } } diff --git a/app/Models/Mempool.php b/app/Models/Mempool.php index 08c451759c..cf41600dff 100644 --- a/app/Models/Mempool.php +++ b/app/Models/Mempool.php @@ -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) { diff --git a/app/Observers/MempoolObserver.php b/app/Observers/MempoolObserver.php index cb8b56a6ff..b35c49f335 100644 --- a/app/Observers/MempoolObserver.php +++ b/app/Observers/MempoolObserver.php @@ -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]); } } } diff --git a/includes/definitions/discovery/apic.yaml b/includes/definitions/discovery/apic.yaml index b76bf5fd32..8264490894 100644 --- a/includes/definitions/discovery/apic.yaml +++ b/includes/definitions/discovery/apic.yaml @@ -1,3 +1,3 @@ modules: os: - sysDescr_regex: 'VERSION (?[^;]+); PID (?[^;]+); Serial (?[^;]+)' + sysDescr_regex: '/VERSION (?[^;]+); PID (?[^;]+); Serial (?[^;]+)/' diff --git a/includes/definitions/discovery/areca.yaml b/includes/definitions/discovery/areca.yaml new file mode 100644 index 0000000000..1a82c2c9ff --- /dev/null +++ b/includes/definitions/discovery/areca.yaml @@ -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 diff --git a/includes/definitions/discovery/asa.yaml b/includes/definitions/discovery/asa.yaml index d670457420..a19ca357be 100644 --- a/includes/definitions/discovery/asa.yaml +++ b/includes/definitions/discovery/asa.yaml @@ -1,5 +1,17 @@ mib: CISCO-REMOTE-ACCESS-MONITOR-MIB modules: + os: + sysDescr_regex: '/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: diff --git a/includes/definitions/discovery/asyncos.yaml b/includes/definitions/discovery/asyncos.yaml new file mode 100644 index 0000000000..f9351db0ba --- /dev/null +++ b/includes/definitions/discovery/asyncos.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/Model (?.*), AsyncOS Version: (?[^,]+).*Serial #: (?.*)/' diff --git a/includes/definitions/discovery/avaya-ipo.yaml b/includes/definitions/discovery/avaya-ipo.yaml new file mode 100644 index 0000000000..768d2f106b --- /dev/null +++ b/includes/definitions/discovery/avaya-ipo.yaml @@ -0,0 +1,4 @@ +modules: + os: + hardware: ENTITY-MIB::entPhysicalDescr.1 + sysDescr_regex: '/(?.*)/' diff --git a/includes/definitions/discovery/axisaudio.yaml b/includes/definitions/discovery/axisaudio.yaml index 3b181ed776..1ab4750675 100644 --- a/includes/definitions/discovery/axisaudio.yaml +++ b/includes/definitions/discovery/axisaudio.yaml @@ -1,3 +1,3 @@ modules: os: - sysDescr_regex: '(?[^;]+); [^;]+; (?[^;]+)' + sysDescr_regex: '/(?[^;]+); [^;]+; (?[^;]+)/' diff --git a/includes/definitions/discovery/bdcom.yaml b/includes/definitions/discovery/bdcom.yaml index 491fd3bf58..6345cf070e 100644 --- a/includes/definitions/discovery/bdcom.yaml +++ b/includes/definitions/discovery/bdcom.yaml @@ -15,6 +15,7 @@ modules: serial: - NMS-CHASSIS::nmscardSerial.0 - NMS-CHASSIS::nmscardSerial.1 + sysDescr_regex: '/BDCOM\(tm\) (?[A-Z0-9]+) Software, Version (?.*)\nCompiled: .*\n.*,Serial num:(?[0-9]+)/' pre-cache: data: - diff --git a/includes/definitions/discovery/benuos.yaml b/includes/definitions/discovery/benuos.yaml index c6321c056d..9a0ba6d912 100644 --- a/includes/definitions/discovery/benuos.yaml +++ b/includes/definitions/discovery/benuos.yaml @@ -1,5 +1,8 @@ mib: BENU-HOST-MIB modules: + os: + serial: BENU-CHASSIS-MIB::benuChassisId.0 + sysDescr_regex: '/BenuOS\, (?.*)\n.Product\:(?.*)\n.*\n.*\n Chassis Type \:(?.*)/' mempools: data: - diff --git a/includes/definitions/discovery/binos.yaml b/includes/definitions/discovery/binos.yaml index 4e767ec96d..ef073e338a 100644 --- a/includes/definitions/discovery/binos.yaml +++ b/includes/definitions/discovery/binos.yaml @@ -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: - diff --git a/includes/definitions/discovery/bintec-smart.yaml b/includes/definitions/discovery/bintec-smart.yaml new file mode 100644 index 0000000000..806b522fde --- /dev/null +++ b/includes/definitions/discovery/bintec-smart.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/(?.*)/' diff --git a/includes/definitions/discovery/bluecatnetworks.yaml b/includes/definitions/discovery/bluecatnetworks.yaml index 0e7b6bb45d..11a4f6b9ed 100755 --- a/includes/definitions/discovery/bluecatnetworks.yaml +++ b/includes/definitions/discovery/bluecatnetworks.yaml @@ -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: diff --git a/includes/definitions/discovery/bnt.yaml b/includes/definitions/discovery/bnt.yaml new file mode 100644 index 0000000000..cdda46650c --- /dev/null +++ b/includes/definitions/discovery/bnt.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/BNT (?.*Module)/' diff --git a/includes/definitions/discovery/breeze.yaml b/includes/definitions/discovery/breeze.yaml new file mode 100644 index 0000000000..c93786ab46 --- /dev/null +++ b/includes/definitions/discovery/breeze.yaml @@ -0,0 +1,4 @@ +modules: + os: + version: ALVARION-DOT11-WLAN-MIB::brzaccVLRunningSoftwareVersion.0 + sysDescr_regex: '/Alvarion - (?.*) , Version: (?\S+)/' diff --git a/includes/definitions/discovery/buffalo.yaml b/includes/definitions/discovery/buffalo.yaml new file mode 100644 index 0000000000..ce00a66dc7 --- /dev/null +++ b/includes/definitions/discovery/buffalo.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/BUFFALO (?.*) Ver\.?(?\S+)/' diff --git a/includes/definitions/discovery/cat1900.yaml b/includes/definitions/discovery/cat1900.yaml new file mode 100644 index 0000000000..84d475c29a --- /dev/null +++ b/includes/definitions/discovery/cat1900.yaml @@ -0,0 +1,4 @@ +modules: + os: + hardware: '1900' + sysDescr_regex: '/,(?V[\d.]+)/' diff --git a/includes/definitions/discovery/catos.yaml b/includes/definitions/discovery/catos.yaml new file mode 100644 index 0000000000..2afd25ff14 --- /dev/null +++ b/includes/definitions/discovery/catos.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/(?WS-[\w-]+).*Version (?[\w.()]+)/' diff --git a/includes/definitions/discovery/chatsworth-pdu.yaml b/includes/definitions/discovery/chatsworth-pdu.yaml index 15dad2953d..67696507c8 100644 --- a/includes/definitions/discovery/chatsworth-pdu.yaml +++ b/includes/definitions/discovery/chatsworth-pdu.yaml @@ -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: diff --git a/includes/definitions/discovery/cips.yaml b/includes/definitions/discovery/cips.yaml new file mode 100644 index 0000000000..3d8c8037d4 --- /dev/null +++ b/includes/definitions/discovery/cips.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/Version (?.*) Platform: (?.*)/' diff --git a/includes/definitions/discovery/ciscoepc.yaml b/includes/definitions/discovery/ciscoepc.yaml new file mode 100644 index 0000000000..9c40cd6914 --- /dev/null +++ b/includes/definitions/discovery/ciscoepc.yaml @@ -0,0 +1,4 @@ +modules: + os: + hardware: SA-HARDWARE-MIB::saHwDescrModel.0 + serial: SA-HARDWARE-MIB::saHwDescrSerialNumber.0 diff --git a/includes/definitions/discovery/ciscosce.yaml b/includes/definitions/discovery/ciscosce.yaml new file mode 100644 index 0000000000..b79c866acd --- /dev/null +++ b/includes/definitions/discovery/ciscosce.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/Version (?\S*).*HW version: (?.*)/' diff --git a/includes/definitions/discovery/ciscosrp.yaml b/includes/definitions/discovery/ciscosrp.yaml new file mode 100644 index 0000000000..520975a875 --- /dev/null +++ b/includes/definitions/discovery/ciscosrp.yaml @@ -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 diff --git a/includes/definitions/discovery/ciscowap.yaml b/includes/definitions/discovery/ciscowap.yaml new file mode 100644 index 0000000000..4c55329397 --- /dev/null +++ b/includes/definitions/discovery/ciscowap.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/(?WAP[\w-]+)( \((?WAP[^)]+)\))?, Version (?[\w.()]+)/' diff --git a/includes/definitions/discovery/ciscowlc.yaml b/includes/definitions/discovery/ciscowlc.yaml index 73904a5cda..e23b49dce9 100644 --- a/includes/definitions/discovery/ciscowlc.yaml +++ b/includes/definitions/discovery/ciscowlc.yaml @@ -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: - diff --git a/includes/definitions/discovery/clearpass.yaml b/includes/definitions/discovery/clearpass.yaml new file mode 100644 index 0000000000..2601d02d75 --- /dev/null +++ b/includes/definitions/discovery/clearpass.yaml @@ -0,0 +1,5 @@ +modules: + os: + hardware: .1.3.6.1.4.1.14823.1.6.1.1.1.1.1.1.0 + serial: .1.3.6.1.4.1.14823.1.6.1.1.1.1.1.2.0 + version: .1.3.6.1.4.1.14823.1.6.1.1.1.1.1.3.0 diff --git a/includes/definitions/discovery/cnpilote.yaml b/includes/definitions/discovery/cnpilote.yaml new file mode 100644 index 0000000000..f49aef7e2c --- /dev/null +++ b/includes/definitions/discovery/cnpilote.yaml @@ -0,0 +1,4 @@ +modules: + os: + hardware: CAMBIUM-MIB::cambiumAPHWType.0 + serial: CAMBIUM-MIB::cambiumAPSerialNum.0 diff --git a/includes/definitions/discovery/cnpilotr.yaml b/includes/definitions/discovery/cnpilotr.yaml new file mode 100644 index 0000000000..f100d7de1f --- /dev/null +++ b/includes/definitions/discovery/cnpilotr.yaml @@ -0,0 +1,5 @@ +modules: + os: + hardware: CAMBIUM-MIB::productName.0 + serial: CAMBIUM-MIB::serialNumber.0 + version: CAMBIUM-MIB::hardwareVersion.0 diff --git a/includes/definitions/discovery/ctcu.yaml b/includes/definitions/discovery/ctcu.yaml new file mode 100644 index 0000000000..8dc2404c3e --- /dev/null +++ b/includes/definitions/discovery/ctcu.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/(?\S+) GigaBit Ethernet Switch(, firmware Ver (?.*))?/' diff --git a/includes/definitions/discovery/datacom.yaml b/includes/definitions/discovery/datacom.yaml index 20014695b8..c0957a371d 100644 --- a/includes/definitions/discovery/datacom.yaml +++ b/includes/definitions/discovery/datacom.yaml @@ -1,5 +1,9 @@ mib: DMswitch-MIB modules: + os: + hardware: DMswitch-MIB::swChassisModel.0 + version: DMswitch-MIB::swFirmwareVer.1 + serial: DMswitch-MIB::swSerialNumber.1 processors: data: - diff --git a/includes/definitions/discovery/deliberant.yaml b/includes/definitions/discovery/deliberant.yaml new file mode 100644 index 0000000000..824df9945c --- /dev/null +++ b/includes/definitions/discovery/deliberant.yaml @@ -0,0 +1,4 @@ +modules: + os: + hardware: .1.3.6.1.4.1.32761.3.1.1.1.3.0 + sysDescr_regex: '/DLB APC (?[^,]+), v(?[\d.-]+\d)/' diff --git a/includes/definitions/discovery/dell-powervault.yaml b/includes/definitions/discovery/dell-powervault.yaml new file mode 100644 index 0000000000..7f803eddf8 --- /dev/null +++ b/includes/definitions/discovery/dell-powervault.yaml @@ -0,0 +1,4 @@ +modules: + os: + serial: .1.3.6.1.4.1.674.10893.2.31.500.1.3.0 + hardware: .1.3.6.1.4.1.674.10893.2.31.500.1.5.0 diff --git a/includes/definitions/discovery/dell-rcs.yaml b/includes/definitions/discovery/dell-rcs.yaml new file mode 100644 index 0000000000..f406a0f74a --- /dev/null +++ b/includes/definitions/discovery/dell-rcs.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/(?\S+) (?.*)/' diff --git a/includes/definitions/discovery/develop.yaml b/includes/definitions/discovery/develop.yaml new file mode 100644 index 0000000000..f0a3535b4b --- /dev/null +++ b/includes/definitions/discovery/develop.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/Develop (?.*)/' diff --git a/includes/definitions/discovery/digipower.yaml b/includes/definitions/discovery/digipower.yaml new file mode 100644 index 0000000000..7a96ff9713 --- /dev/null +++ b/includes/definitions/discovery/digipower.yaml @@ -0,0 +1,4 @@ +modules: + os: + hardware: .1.3.6.1.4.1.17420.1.2.9.1.19.0 + version: .1.3.6.1.4.1.17420.1.2.4.0 diff --git a/includes/definitions/discovery/eaton-ats.yaml b/includes/definitions/discovery/eaton-ats.yaml index 41f49d0cdc..a415cbaa6a 100644 --- a/includes/definitions/discovery/eaton-ats.yaml +++ b/includes/definitions/discovery/eaton-ats.yaml @@ -1,5 +1,9 @@ mib: EATON-ATS2-MIB modules: + os: + hardware: EATON-ATS2-MIB::ats2IdentPartNumber.0 + serial: EATON-ATS2-MIB::ats2IdentSerialNumber.0 + version: EATON-ATS2-MIB::ats2IdentFWVersion.0 sensors: voltage: data: diff --git a/includes/definitions/discovery/ees.yaml b/includes/definitions/discovery/ees.yaml index 021275c861..aeef5229fa 100644 --- a/includes/definitions/discovery/ees.yaml +++ b/includes/definitions/discovery/ees.yaml @@ -1,5 +1,8 @@ mib: EES-POWER-MIB modules: + os: + serial: EES-POWER-MIB::identControllerSerialNumber.0 + version: EES-POWER-MIB::identControllerFirmwareVersion.0 sensors: temperature: data: diff --git a/includes/definitions/discovery/elg-ipecs-es.yaml b/includes/definitions/discovery/elg-ipecs-es.yaml new file mode 100644 index 0000000000..b333d3706f --- /dev/null +++ b/includes/definitions/discovery/elg-ipecs-es.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/ (?.+)/' diff --git a/includes/definitions/discovery/elg-ipecs-ucp.yaml b/includes/definitions/discovery/elg-ipecs-ucp.yaml new file mode 100644 index 0000000000..9b96f3fd2a --- /dev/null +++ b/includes/definitions/discovery/elg-ipecs-ucp.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/,(?[^,]+),/' diff --git a/includes/definitions/discovery/eltex-olt.yaml b/includes/definitions/discovery/eltex-olt.yaml index 8136e1bfb8..6b832f8c75 100644 --- a/includes/definitions/discovery/eltex-olt.yaml +++ b/includes/definitions/discovery/eltex-olt.yaml @@ -1,5 +1,10 @@ mib: ELTEX-LTP8X-STANDALONE modules: + os: + hardware: ELTEX-LTP8X-STANDALONE::ltp8xFirmwareRevision.0 + hardware_regex: '/(?[^:]*):/' + version: ELTEX-LTP8X-STANDALONE::ltp8xFirmwareRevision.0 + version_regex: '/(software version| on)(?.*)/' processors: data: - diff --git a/includes/definitions/discovery/enlogic-pdu.yaml b/includes/definitions/discovery/enlogic-pdu.yaml new file mode 100644 index 0000000000..0fa1b8171f --- /dev/null +++ b/includes/definitions/discovery/enlogic-pdu.yaml @@ -0,0 +1,5 @@ +modules: + os: + hardware: ENLOGIC-PDU-MIB::pduNamePlateModelNumber.1 + serial: ENLOGIC-PDU-MIB::pduNamePlateSerialNumber.1 + version: ENLOGIC-PDU-MIB::pduNamePlateFirmwareVersion.1 diff --git a/includes/definitions/discovery/etherwan.yaml b/includes/definitions/discovery/etherwan.yaml new file mode 100644 index 0000000000..958f3fa154 --- /dev/null +++ b/includes/definitions/discovery/etherwan.yaml @@ -0,0 +1,5 @@ +modules: + os: + sysDescr_regex: + - '/(?.*?), Firmware rev: (?[\d.]+)/' + - '/ (?(\w+ )+Managed Switch)/' diff --git a/includes/definitions/discovery/extendair.yaml b/includes/definitions/discovery/extendair.yaml new file mode 100644 index 0000000000..5c3113a951 --- /dev/null +++ b/includes/definitions/discovery/extendair.yaml @@ -0,0 +1,4 @@ +modules: + os: + serial: ExaltComProducts::serialNumber.0 + version: ExaltComProducts::firmwareVersion.0 diff --git a/includes/definitions/discovery/extrahop.yaml b/includes/definitions/discovery/extrahop.yaml new file mode 100644 index 0000000000..627a5854d4 --- /dev/null +++ b/includes/definitions/discovery/extrahop.yaml @@ -0,0 +1,3 @@ +modules: + os: + version: EXTRAHOP-MIB::extrahopInfoVersionString diff --git a/includes/definitions/discovery/f5.yaml b/includes/definitions/discovery/f5.yaml index 19cb29590b..86441eab9c 100644 --- a/includes/definitions/discovery/f5.yaml +++ b/includes/definitions/discovery/f5.yaml @@ -1,4 +1,8 @@ modules: + os: + hardware: F5-BIGIP-SYSTEM-MIB::sysPlatformInfoMarketingName.0 + serial: F5-BIGIP-SYSTEM-MIB::sysGeneralChassisSerialNum.0 + version: F5-BIGIP-SYSTEM-MIB::sysProductVersion.0 mempools: data: - diff --git a/includes/definitions/discovery/firebox.yaml b/includes/definitions/discovery/firebox.yaml new file mode 100644 index 0000000000..101a8a1564 --- /dev/null +++ b/includes/definitions/discovery/firebox.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/v(?.*)/' diff --git a/includes/definitions/discovery/fireware.yaml b/includes/definitions/discovery/fireware.yaml new file mode 100644 index 0000000000..806b522fde --- /dev/null +++ b/includes/definitions/discovery/fireware.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/(?.*)/' diff --git a/includes/definitions/discovery/flareos.yaml b/includes/definitions/discovery/flareos.yaml new file mode 100644 index 0000000000..a79fab64af --- /dev/null +++ b/includes/definitions/discovery/flareos.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/(?\S*) - Flare (?.*)/' diff --git a/includes/definitions/discovery/foundryos.yaml b/includes/definitions/discovery/foundryos.yaml new file mode 100644 index 0000000000..56ef4bde2d --- /dev/null +++ b/includes/definitions/discovery/foundryos.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/Foundry Networks, Inc. (?[^,]+), IronWare Version (?\S+)/' diff --git a/includes/definitions/discovery/fujitsupyos.yaml b/includes/definitions/discovery/fujitsupyos.yaml new file mode 100644 index 0000000000..a48b8f3623 --- /dev/null +++ b/includes/definitions/discovery/fujitsupyos.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/Fujitsu (?.*), Runtime Code (?.*)/' diff --git a/includes/definitions/discovery/fxm.yaml b/includes/definitions/discovery/fxm.yaml index b7961686f5..525b74b257 100644 --- a/includes/definitions/discovery/fxm.yaml +++ b/includes/definitions/discovery/fxm.yaml @@ -1,5 +1,8 @@ mib: Argus-Power-System-MIB modules: + os: + hardware: Argus-Power-System-MIB::upsIdentProductCode.0 + version: Argus-Power-System-MIB::upsIdentUPSSoftwareVersion.0 sensors: voltage: options: diff --git a/includes/definitions/discovery/fxos.yaml b/includes/definitions/discovery/fxos.yaml new file mode 100644 index 0000000000..bb8112dad5 --- /dev/null +++ b/includes/definitions/discovery/fxos.yaml @@ -0,0 +1,5 @@ +modules: + os: + serial: ENTITY-MIB::entPhysicalSerialNum.10 + sysDescr_regex: '/Version (?[^,]+)/' + hardware_mib: CISCO-PRODUCTS-MIB diff --git a/includes/definitions/discovery/geist-pdu.yaml b/includes/definitions/discovery/geist-pdu.yaml new file mode 100644 index 0000000000..20c4061313 --- /dev/null +++ b/includes/definitions/discovery/geist-pdu.yaml @@ -0,0 +1,4 @@ +modules: + os: + hardware: GEIST-MIB-V3::productHardware.0 + version: GEIST-MIB-V3::productVersion.0 diff --git a/includes/definitions/discovery/geist-watchdog.yaml b/includes/definitions/discovery/geist-watchdog.yaml index e78ea88599..6b55bad4c4 100644 --- a/includes/definitions/discovery/geist-watchdog.yaml +++ b/includes/definitions/discovery/geist-watchdog.yaml @@ -1,5 +1,8 @@ mib: GEIST-V4-MIB:GEIST-MIB-V3 modules: + os: + version: GEIST-MIB-V3::productVersion.0 + serial: GEIST-MIB-V3::climateSerial.1 sensors: temperature: options: diff --git a/includes/definitions/discovery/gestetner.yaml b/includes/definitions/discovery/gestetner.yaml new file mode 100644 index 0000000000..789e1816c8 --- /dev/null +++ b/includes/definitions/discovery/gestetner.yaml @@ -0,0 +1,5 @@ +modules: + os: + hardware: .1.3.6.1.4.1.367.3.2.1.1.1.1.0 + serial: .1.3.6.1.4.1.367.3.2.1.2.1.4.0 + version: .1.3.6.1.4.1.367.3.2.1.1.1.2.0 diff --git a/includes/definitions/discovery/halon.yaml b/includes/definitions/discovery/halon.yaml new file mode 100644 index 0000000000..182bd76910 --- /dev/null +++ b/includes/definitions/discovery/halon.yaml @@ -0,0 +1,4 @@ +modules: + os: + serial: HALON-SP-MIB::serialNumber.0 + sysDescr_regex: '/Halon (?.*)/' diff --git a/includes/definitions/discovery/hpe-ipdu.yaml b/includes/definitions/discovery/hpe-ipdu.yaml index 46e1b2e015..7daf60ca4c 100644 --- a/includes/definitions/discovery/hpe-ipdu.yaml +++ b/includes/definitions/discovery/hpe-ipdu.yaml @@ -1,5 +1,9 @@ mib: CPQPOWER-MIB modules: + os: + hardware: CPQPOWER-MIB::mpduModel.1 + serial: CPQPOWER-MIB::mpduSerialNumber.1 + version: CPQPOWER-MIB::mpduSerialNumber.1 sensors: current: data: diff --git a/includes/definitions/discovery/hpe-msa.yaml b/includes/definitions/discovery/hpe-msa.yaml index abf5b94b55..db62ff14b2 100644 --- a/includes/definitions/discovery/hpe-msa.yaml +++ b/includes/definitions/discovery/hpe-msa.yaml @@ -1,5 +1,8 @@ mib: FCMGMT-MIB modules: + os: + hardware: CPQSINFO-MIB::cpqSiProductName.0 + serial: CPQSINFO-MIB::cpqSiSysSerialNum.0 sensors: state: data: diff --git a/includes/definitions/discovery/hpe-msl.yaml b/includes/definitions/discovery/hpe-msl.yaml index 0156f096df..bfdff767f2 100644 --- a/includes/definitions/discovery/hpe-msl.yaml +++ b/includes/definitions/discovery/hpe-msl.yaml @@ -1,5 +1,9 @@ mib: SEMI-MIB modules: + os: + hardware: SEMI-MIB::hpHttpMgDeviceProductName.1 + version: SEMI-MIB::hpHttpMgDeviceVersion.1 + serial: SEMI-MIB::hpHttpMgDeviceSerialNumber.1 sensors: state: data: diff --git a/includes/definitions/discovery/hpe-rtups.yaml b/includes/definitions/discovery/hpe-rtups.yaml new file mode 100644 index 0000000000..db9590cedb --- /dev/null +++ b/includes/definitions/discovery/hpe-rtups.yaml @@ -0,0 +1,4 @@ +modules: + os: + serial: CPQPOWER-MIB::deviceSerialNumber.0 + version: CPQPOWER-MIB::deviceFirmwareVersion.0 diff --git a/includes/definitions/discovery/hpvc.yaml b/includes/definitions/discovery/hpvc.yaml new file mode 100644 index 0000000000..5c0132de1f --- /dev/null +++ b/includes/definitions/discovery/hpvc.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/HP (VC )?(?.*)Module (Virtual Connect )?(?[\d.]+)/' diff --git a/includes/definitions/discovery/hwg-ste2.yaml b/includes/definitions/discovery/hwg-ste2.yaml index 425a60fb9c..449812b3e8 100644 --- a/includes/definitions/discovery/hwg-ste2.yaml +++ b/includes/definitions/discovery/hwg-ste2.yaml @@ -1,5 +1,7 @@ mib: STE2-MIB modules: + os: + sysDescr_regex: '/(?.+?)( (?[\d.]+))?/' sensors: temperature: data: diff --git a/includes/definitions/discovery/ibmnos.yaml b/includes/definitions/discovery/ibmnos.yaml new file mode 100644 index 0000000000..b39a6c71fe --- /dev/null +++ b/includes/definitions/discovery/ibmnos.yaml @@ -0,0 +1,11 @@ +modules: + os: + sysDescr_regex: '/(IBM Networking Operating System|Flex System Fabric|IBM Networking OS) (?.*?)\s?( for IBM BladeCenter)?(\([^)]+\))?(, Stack)?$/' + version: + - IBM-GbTOR-G8264CS-MIB::agSoftwareVersion.0 + - IBM-GbTOR-G8264T-MIB::agSoftwareVersion.0 + - ENTITY-MIB::entPhysicalSoftwareRev.1 + serial: + - IBM-GbTOR-G8264-MIB::hardwareSerialNumber.0 + - IBM-GbTOR-G8264T-MIB::hardwareSerialNumber.0 + - ENTITY-MIB::entPhysicalSerialNum.1 diff --git a/includes/definitions/discovery/ibmtl.yaml b/includes/definitions/discovery/ibmtl.yaml new file mode 100644 index 0000000000..c1252e6323 --- /dev/null +++ b/includes/definitions/discovery/ibmtl.yaml @@ -0,0 +1,5 @@ +modules: + os: + hardware: .1.3.6.1.4.1.14851.3.1.4.2.0 + serial: .1.3.6.1.4.1.14851.3.1.3.2.0 + version: .1.3.6.1.4.1.14851.3.1.3.4.0 diff --git a/includes/definitions/discovery/ict-psu.yaml b/includes/definitions/discovery/ict-psu.yaml new file mode 100644 index 0000000000..9c20c627b3 --- /dev/null +++ b/includes/definitions/discovery/ict-psu.yaml @@ -0,0 +1,4 @@ +modules: + os: + hardware: .1.3.6.1.4.1.39145.11.1.0 + version: .1.3.6.1.4.1.39145.11.4.0 diff --git a/includes/definitions/discovery/ies.yaml b/includes/definitions/discovery/ies.yaml new file mode 100644 index 0000000000..fb8b7b2679 --- /dev/null +++ b/includes/definitions/discovery/ies.yaml @@ -0,0 +1,4 @@ +modules: + os: + version: ZYXEL-AS-MIB::accessSwitchFWVersion.0 + sysDescr_regex: '/IES-1000.(?.*) version V(?\S+)/' diff --git a/includes/definitions/discovery/informos.yaml b/includes/definitions/discovery/informos.yaml new file mode 100644 index 0000000000..cbeb7950af --- /dev/null +++ b/includes/definitions/discovery/informos.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/(HPE?_)?(?(3PAR|InServ) .*), (?ID: .*), Serial number: (?.*), InForm OS version: (?.*)/' diff --git a/includes/definitions/discovery/jwos.yaml b/includes/definitions/discovery/jwos.yaml new file mode 100644 index 0000000000..531fb6def1 --- /dev/null +++ b/includes/definitions/discovery/jwos.yaml @@ -0,0 +1,9 @@ +modules: + os: + version: JUNIPER-WX-GLOBAL-REG::jnxWxSysSwVersion.0 + serial: JUNIPER-WX-GLOBAL-REG::jnxWxSysSerialNumber.0 + hardware: + - JUNIPER-WX-GLOBAL-REG::jnxWxChassisType.0 + - JUNIPER-WX-GLOBAL-REG::jnxWxSysHwVersion.0 + hardware_regex: '/(jnx)?(?.*)/' + hardware_template: '/{{ JUNIPER-WX-GLOBAL-REG::jnxWxChassisType.0 }} {{ JUNIPER-WX-GLOBAL-REG::jnxWxSysHwVersion.0 }}/' diff --git a/includes/definitions/discovery/kemp.yaml b/includes/definitions/discovery/kemp.yaml new file mode 100644 index 0000000000..0b011f61fb --- /dev/null +++ b/includes/definitions/discovery/kemp.yaml @@ -0,0 +1,3 @@ +modules: + os: + version: B100-MIB::patchVersion.0 diff --git a/includes/definitions/discovery/kti.yaml b/includes/definitions/discovery/kti.yaml new file mode 100644 index 0000000000..247e7a8c78 --- /dev/null +++ b/includes/definitions/discovery/kti.yaml @@ -0,0 +1,4 @@ +modules: + os: + version: .1.3.6.1.2.1.47.1.1.1.1.9.1 + sysDescr_regex: '/(?.*)/' diff --git a/includes/definitions/discovery/kyocera.yaml b/includes/definitions/discovery/kyocera.yaml new file mode 100644 index 0000000000..4eacbe9672 --- /dev/null +++ b/includes/definitions/discovery/kyocera.yaml @@ -0,0 +1,5 @@ +modules: + os: + hardware: .1.3.6.1.4.1.1347.43.5.1.1.1.1 + serial: .1.3.6.1.4.1.1347.43.5.1.1.28.1 + version: .1.3.6.1.4.1.1347.43.5.4.1.5.1.1 diff --git a/includes/definitions/discovery/lantronix-slc.yaml b/includes/definitions/discovery/lantronix-slc.yaml new file mode 100644 index 0000000000..16a8311064 --- /dev/null +++ b/includes/definitions/discovery/lantronix-slc.yaml @@ -0,0 +1,6 @@ +modules: + os: + hardware: LANTRONIX-SLC-MIB::slcSystemModel.0 + version: LANTRONIX-SLC-MIB::slcSystemFWRev.0 + features: LANTRONIX-SLC-MIB::slcSystemModelString.0 + serial: LANTRONIX-SLC-MIB::slcSystemSerialNo.0 diff --git a/includes/definitions/discovery/lenovoemc.yaml b/includes/definitions/discovery/lenovoemc.yaml new file mode 100644 index 0000000000..68a2466211 --- /dev/null +++ b/includes/definitions/discovery/lenovoemc.yaml @@ -0,0 +1,3 @@ +modules: + os: + hardware: IOMEGANAS-MIB::deviceDescr.0 diff --git a/includes/definitions/discovery/lexmarkprinter.yaml b/includes/definitions/discovery/lexmarkprinter.yaml new file mode 100644 index 0000000000..8935a29c40 --- /dev/null +++ b/includes/definitions/discovery/lexmarkprinter.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/Lexmark (?[a-zA-Z0-9]+) version (?\S+)/' diff --git a/includes/definitions/discovery/ligoos.yaml b/includes/definitions/discovery/ligoos.yaml new file mode 100644 index 0000000000..24ec3b2065 --- /dev/null +++ b/includes/definitions/discovery/ligoos.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/LigoPTP (?[^,]*),? (?v[\d\-.]+\d)/' diff --git a/includes/definitions/discovery/mellanox.yaml b/includes/definitions/discovery/mellanox.yaml new file mode 100644 index 0000000000..05a64f2770 --- /dev/null +++ b/includes/definitions/discovery/mellanox.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/[, ](?\S+),SWv(SX)?(?.*)/' diff --git a/includes/definitions/discovery/merakimr.yaml b/includes/definitions/discovery/merakimr.yaml new file mode 100644 index 0000000000..806b522fde --- /dev/null +++ b/includes/definitions/discovery/merakimr.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/(?.*)/' diff --git a/includes/definitions/discovery/merakimx.yaml b/includes/definitions/discovery/merakimx.yaml new file mode 100644 index 0000000000..806b522fde --- /dev/null +++ b/includes/definitions/discovery/merakimx.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/(?.*)/' diff --git a/includes/definitions/discovery/minkelsrms.yaml b/includes/definitions/discovery/minkelsrms.yaml new file mode 100644 index 0000000000..a5e0200f03 --- /dev/null +++ b/includes/definitions/discovery/minkelsrms.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/(?SP\d+)/' diff --git a/includes/definitions/discovery/moxa-nport.yaml b/includes/definitions/discovery/moxa-nport.yaml new file mode 100644 index 0000000000..806b522fde --- /dev/null +++ b/includes/definitions/discovery/moxa-nport.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/(?.*)/' diff --git a/includes/definitions/discovery/msl.yaml b/includes/definitions/discovery/msl.yaml new file mode 100644 index 0000000000..cf497a5e1f --- /dev/null +++ b/includes/definitions/discovery/msl.yaml @@ -0,0 +1,7 @@ +modules: + os: + version: .1.3.6.1.4.1.1027.4.1.2.1.1.1.4.10.1.3.6.1.4.1.1027.1.6.1 + features: .1.3.6.1.4.1.1027.4.1.2.1.1.1.5.10.1.3.6.1.4.1.1027.1.6.1 + sysDescr_regex: + - '/VerHw:(?[^;]+);VerSw:(?[\d.]+)/' + - '/VerSw:(?[\d.]+);VerHw:(?[^;]+)/' diff --git a/includes/definitions/discovery/netagent2.yaml b/includes/definitions/discovery/netagent2.yaml index d896410606..1afc245cbe 100644 --- a/includes/definitions/discovery/netagent2.yaml +++ b/includes/definitions/discovery/netagent2.yaml @@ -1,5 +1,8 @@ mib: UPS-MIB:XPPC-MIB modules: + os: + version: UPS-MIB::upsIdentAgentSoftwareVersion.0 + hardware: UPS-MIB::upsIdentModel.0 sensors: state: data: diff --git a/includes/definitions/discovery/netapp.yaml b/includes/definitions/discovery/netapp.yaml new file mode 100644 index 0000000000..0726594c86 --- /dev/null +++ b/includes/definitions/discovery/netapp.yaml @@ -0,0 +1,6 @@ +modules: + os: + serial: NETAPP-MIB::productSerialNum.0 + hardware: NETAPP-MIB::productModel.0 + version: NETAPP-MIB::productVersion.0 + version_regex: '/NetApp Release (?.*?):/' diff --git a/includes/definitions/discovery/netbotz.yaml b/includes/definitions/discovery/netbotz.yaml index 74ac7d2f02..6fd775e3d3 100644 --- a/includes/definitions/discovery/netbotz.yaml +++ b/includes/definitions/discovery/netbotz.yaml @@ -1,5 +1,8 @@ mib: NETBOTZV2-MIB modules: + os: + version: .1.3.6.1.4.1.318.1.4.2.4.1.4.1 + hardware_mib: NETBOTZ410-MIB sensors: airflow: data: diff --git a/includes/definitions/discovery/netguardian.yaml b/includes/definitions/discovery/netguardian.yaml index 537842832c..9d8e286364 100644 --- a/includes/definitions/discovery/netguardian.yaml +++ b/includes/definitions/discovery/netguardian.yaml @@ -1,5 +1,8 @@ mib: DPS-MIB-CG-V1 modules: + os: + hardware: DPS-MIB-V38::dpsRTUModel.0 + version: DPS-MIB-V38::dpsRTUFirmwareVersion.0 sensors: voltage: data: diff --git a/includes/definitions/discovery/netmanplus.yaml b/includes/definitions/discovery/netmanplus.yaml new file mode 100644 index 0000000000..4244e28cc0 --- /dev/null +++ b/includes/definitions/discovery/netmanplus.yaml @@ -0,0 +1,4 @@ +modules: + os: + sysDescr_regex: '/(?.*)/' + version: UPS-MIB::upsIdentUPSSoftwareVersion.0 diff --git a/includes/definitions/discovery/nimbleos.yaml b/includes/definitions/discovery/nimbleos.yaml new file mode 100644 index 0000000000..4b378cf247 --- /dev/null +++ b/includes/definitions/discovery/nimbleos.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/version (?.*)/' diff --git a/includes/definitions/discovery/nitro.yaml b/includes/definitions/discovery/nitro.yaml new file mode 100644 index 0000000000..1aada6b8ad --- /dev/null +++ b/includes/definitions/discovery/nitro.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/^McAfee [A-Z]{3} (?[^,]+)$/' diff --git a/includes/definitions/discovery/nos.yaml b/includes/definitions/discovery/nos.yaml index 4df41ad061..63a0d8c70c 100644 --- a/includes/definitions/discovery/nos.yaml +++ b/includes/definitions/discovery/nos.yaml @@ -1,5 +1,9 @@ mib: SW-MIB modules: + os: + hardware: ENTITY-MIB::entPhysicalDescr.1 + version: SYSTEM-MIB::swFirmwareVersion.0 + serial: ENTITY-MIB::entPhysicalSerialNum.1 mempools: data: - diff --git a/includes/definitions/discovery/nrg.yaml b/includes/definitions/discovery/nrg.yaml new file mode 100644 index 0000000000..d48f7e6f24 --- /dev/null +++ b/includes/definitions/discovery/nrg.yaml @@ -0,0 +1,4 @@ +modules: + os: + serial: .1.3.6.1.4.1.367.3.2.1.2.1.4.0 + sysDescr_regex: '/NRG (?.*) (?[\d.]+)/' diff --git a/includes/definitions/discovery/ns-bsd.yaml b/includes/definitions/discovery/ns-bsd.yaml new file mode 100644 index 0000000000..f197529454 --- /dev/null +++ b/includes/definitions/discovery/ns-bsd.yaml @@ -0,0 +1,5 @@ +modules: + os: + hardware: STORMSHIELD-PROPERTY-MIB::snsModel.0 + version: STORMSHIELD-PROPERTY-MIB::snsVersion.0 + serial: STORMSHIELD-PROPERTY-MIB::snsSerialNumber.0 diff --git a/includes/definitions/discovery/oceanstor.yaml b/includes/definitions/discovery/oceanstor.yaml new file mode 100644 index 0000000000..f5a2676247 --- /dev/null +++ b/includes/definitions/discovery/oceanstor.yaml @@ -0,0 +1,3 @@ +modules: + os: + version_regex: ISM-STORAGE-SVC-MIB::version.0 diff --git a/includes/definitions/discovery/onefs.yaml b/includes/definitions/discovery/onefs.yaml new file mode 100644 index 0000000000..487ebdbf33 --- /dev/null +++ b/includes/definitions/discovery/onefs.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/Isilon OneFS (?\S+)( (?\S+)\(RELEASE\))?/' diff --git a/includes/definitions/discovery/oracle-ilom.yaml b/includes/definitions/discovery/oracle-ilom.yaml new file mode 100644 index 0000000000..68160fe5cf --- /dev/null +++ b/includes/definitions/discovery/oracle-ilom.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/(?.*) ILOM v(?.*),/' diff --git a/includes/definitions/discovery/pbn-cp.yaml b/includes/definitions/discovery/pbn-cp.yaml new file mode 100644 index 0000000000..879625ca52 --- /dev/null +++ b/includes/definitions/discovery/pbn-cp.yaml @@ -0,0 +1,6 @@ +modules: + os: + hardware: .1.3.6.1.4.1.11606.24.1.1.7.0 + features: .1.3.6.1.4.1.11606.24.1.1.10.0 + version: .1.3.6.1.4.1.11606.24.1.1.6.0 + serial: .1.3.6.1.4.1.11606.24.1.1.4.0 diff --git a/includes/definitions/discovery/pbn.yaml b/includes/definitions/discovery/pbn.yaml index 9e2a144baa..02fe49567a 100644 --- a/includes/definitions/discovery/pbn.yaml +++ b/includes/definitions/discovery/pbn.yaml @@ -1,4 +1,6 @@ modules: + os: + sysDescr_regex: '/Software\s+(?.*) Series Software, Version (?[^,]+), .*Serial num:(?[^,]+),/s' mempools: data: - diff --git a/includes/definitions/discovery/perle.yaml b/includes/definitions/discovery/perle.yaml new file mode 100644 index 0000000000..c66fc8479e --- /dev/null +++ b/includes/definitions/discovery/perle.yaml @@ -0,0 +1,3 @@ +modules: + os: + hardware: PERLE-MCR-MGT-MIB::chassisModelName.1 diff --git a/includes/definitions/discovery/powercode.yaml b/includes/definitions/discovery/powercode.yaml new file mode 100644 index 0000000000..4e18de7957 --- /dev/null +++ b/includes/definitions/discovery/powercode.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/(?) (?)/' diff --git a/includes/definitions/discovery/powerlogic.yaml b/includes/definitions/discovery/powerlogic.yaml new file mode 100644 index 0000000000..04859547a2 --- /dev/null +++ b/includes/definitions/discovery/powerlogic.yaml @@ -0,0 +1,5 @@ +modules: + os: + hardware: PM8ECCMIB::midDeviceName.1 + serial: PM8ECCMIB::midSerialNumber.1 + version: PM8ECCMIB::midFirmwareVersion.1 diff --git a/includes/definitions/discovery/powervault.yaml b/includes/definitions/discovery/powervault.yaml new file mode 100644 index 0000000000..5cb04c6266 --- /dev/null +++ b/includes/definitions/discovery/powervault.yaml @@ -0,0 +1,3 @@ +modules: + os: + version: .1.3.6.1.4.1.674.10893.2.102.3.1.1.9.1 diff --git a/includes/definitions/discovery/primeinfrastructure.yaml b/includes/definitions/discovery/primeinfrastructure.yaml new file mode 100644 index 0000000000..2f86f4abee --- /dev/null +++ b/includes/definitions/discovery/primeinfrastructure.yaml @@ -0,0 +1,6 @@ +modules: + os: + version: ENTITY-MIB::entPhysicalSoftwareRev.1 + version_regex: '/(Cisco ADE-OS )?(?.*)/' + serial: ENTITY-MIB::entPhysicalSerialNum.1 + hardware: ENTITY-MIB::entPhysicalModelName.1 diff --git a/includes/definitions/discovery/ptp250.yaml b/includes/definitions/discovery/ptp250.yaml new file mode 100644 index 0000000000..5a30b98f7f --- /dev/null +++ b/includes/definitions/discovery/ptp250.yaml @@ -0,0 +1,5 @@ +modules: + os: + sysDescr_regex: '/5\d(?.*?)( Wireless|,).*Version\s+(?[\d-]+)/' + hardware: CAMBIUM-PTP250-MIB::masterSlaveMode.0 + hardware_template: '{{ $hardware }} {{ CAMBIUM-PTP250-MIB::masterSlaveMode.0 }}' diff --git a/includes/definitions/discovery/ptp500.yaml b/includes/definitions/discovery/ptp500.yaml index 6c836f5e9b..d2930be643 100644 --- a/includes/definitions/discovery/ptp500.yaml +++ b/includes/definitions/discovery/ptp500.yaml @@ -1,5 +1,9 @@ mib: CAMBIUM-PTP500-V2-MIB modules: + os: + sysDescr_regex: '/5\d(?.*?)( Wireless|,).*Version\s+(?[\d-]+)/' + hardware: CAMBIUM-PTP500-V2-MIB::masterSlaveMode.0 + hardware_template: '{{ $hardware }} {{ CAMBIUM-PTP500-V2-MIB::masterSlaveMode.0 }}' sensors: state: data: diff --git a/includes/definitions/discovery/ptp600.yaml b/includes/definitions/discovery/ptp600.yaml index 720ee88cb2..7012066358 100644 --- a/includes/definitions/discovery/ptp600.yaml +++ b/includes/definitions/discovery/ptp600.yaml @@ -1,5 +1,9 @@ mib: CAMBIUM-PTP600-MIB modules: + os: + sysDescr_regex: '/5\d(?.*?)( Wireless|,).*Version\s+(?[\d-]+)/' + hardware: CAMBIUM-PTP600-MIB::masterSlaveMode.0 + hardware_template: '{{ $hardware }} {{ CAMBIUM-PTP600-MIB::masterSlaveMode.0 }}' sensors: state: data: diff --git a/includes/definitions/discovery/ptp650.yaml b/includes/definitions/discovery/ptp650.yaml index 19b9891cf9..76f441ee1c 100644 --- a/includes/definitions/discovery/ptp650.yaml +++ b/includes/definitions/discovery/ptp650.yaml @@ -1,5 +1,9 @@ mib: CAMBIUM-PTP650-MIB modules: + os: + sysDescr_regex: '/5\d(?.*?)( Wireless|,).*Version\s+(?[\d-]+)/' + hardware: CAMBIUM-PTP650-MIB::masterSlaveMode.0 + hardware_template: '{{ $hardware }} {{ CAMBIUM-PTP650-MIB::masterSlaveMode.0 }}' sensors: state: data: diff --git a/includes/definitions/discovery/ptp800.yaml b/includes/definitions/discovery/ptp800.yaml index c585e2c448..94cc32c3a3 100644 --- a/includes/definitions/discovery/ptp800.yaml +++ b/includes/definitions/discovery/ptp800.yaml @@ -1,5 +1,7 @@ mib: CAMBIUM-PTP800-MIB modules: + os: + sysDescr_regex: '/Cambium (?.*) Wireless.* (?\S+)$/' sensors: state: data: diff --git a/includes/definitions/discovery/remoteye4.yaml b/includes/definitions/discovery/remoteye4.yaml index 84f74d7991..ef92d3f9cf 100644 --- a/includes/definitions/discovery/remoteye4.yaml +++ b/includes/definitions/discovery/remoteye4.yaml @@ -1,5 +1,9 @@ mib: TIC-RMTI4-G9000-G2020-MIB modules: + os: + hardware: UPS-MIB::upsIdentName.0 + version: UPS-MIB::upsIdentAgentSoftwareVersion.0 + version_regex: '/(RemotEye4 )?(?.*)/' sensors: voltage: data: diff --git a/includes/definitions/discovery/ricoh.yaml b/includes/definitions/discovery/ricoh.yaml new file mode 100644 index 0000000000..789e1816c8 --- /dev/null +++ b/includes/definitions/discovery/ricoh.yaml @@ -0,0 +1,5 @@ +modules: + os: + hardware: .1.3.6.1.4.1.367.3.2.1.1.1.1.0 + serial: .1.3.6.1.4.1.367.3.2.1.2.1.4.0 + version: .1.3.6.1.4.1.367.3.2.1.1.1.2.0 diff --git a/includes/definitions/discovery/riverbed.yaml b/includes/definitions/discovery/riverbed.yaml index 9d8c65a005..64a480cf0f 100644 --- a/includes/definitions/discovery/riverbed.yaml +++ b/includes/definitions/discovery/riverbed.yaml @@ -1,5 +1,9 @@ mib: STEELHEAD-MIB:RBT-MIB modules: + os: + hardware: .1.3.6.1.4.1.17163.1.1.1.1.0 + serial: .1.3.6.1.4.1.17163.1.1.1.2.0 + version: .1.3.6.1.4.1.17163.1.1.1.3.0 processors: data: - diff --git a/includes/definitions/discovery/ros.yaml b/includes/definitions/discovery/ros.yaml index 487d154cd9..f2cc1f7f7b 100644 --- a/includes/definitions/discovery/ros.yaml +++ b/includes/definitions/discovery/ros.yaml @@ -1,5 +1,9 @@ mib: RUGGEDCOM-SYS-INFO-MIB modules: + os: + version: RUGGEDCOM-SYS-INFO-MIB::rcDeviceInfoMainSwVersion.0 + serial: RUGGEDCOM-SYS-INFO-MIB::rcDeviceInfoSerialNumber.0 + sysDescr_regex: '/(?.*?)-/' sensors: state: data: diff --git a/includes/definitions/discovery/samsungprinter.yaml b/includes/definitions/discovery/samsungprinter.yaml new file mode 100644 index 0000000000..593daf6368 --- /dev/null +++ b/includes/definitions/discovery/samsungprinter.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/(Samsung )+(?.*?)( Series)?; ?V?(?[\d.]+).*S\/N (?\S+)/' diff --git a/includes/definitions/discovery/savin.yaml b/includes/definitions/discovery/savin.yaml new file mode 100644 index 0000000000..59936c6646 --- /dev/null +++ b/includes/definitions/discovery/savin.yaml @@ -0,0 +1,5 @@ +modules: + os: + hardware: .1.3.6.1.4.1.367.3.2.1.1.1.1.0 + version: .1.3.6.1.4.1.367.3.2.1.1.1.2.0 + serial: .1.3.6.1.4.1.367.3.2.1.2.1.4.0 diff --git a/includes/definitions/discovery/serveriron.yaml b/includes/definitions/discovery/serveriron.yaml index ee96608ba6..bf6310cf9d 100644 --- a/includes/definitions/discovery/serveriron.yaml +++ b/includes/definitions/discovery/serveriron.yaml @@ -1,4 +1,8 @@ modules: + os: + serial: FOUNDRY-SN-AGENT-MIB::snChasSerNum.0 + hardware: FOUNDRY-SN-AGENT-MIB::snAgentBrdMainBrdDescription.1 + version: FOUNDRY-SN-AGENT-MIB::snAgImgVer.0 mempools: data: - diff --git a/includes/definitions/discovery/sgos.yaml b/includes/definitions/discovery/sgos.yaml index 8b6161d5fc..87d467b219 100644 --- a/includes/definitions/discovery/sgos.yaml +++ b/includes/definitions/discovery/sgos.yaml @@ -1,4 +1,7 @@ modules: + os: + hardware: BLUECOAT-SG-PROXY-MIB::sgProxySoftware.0 + version: BLUECOAT-SG-PROXY-MIB::sgProxyVersion.0 mempools: data: - diff --git a/includes/definitions/discovery/sinetica.yaml b/includes/definitions/discovery/sinetica.yaml new file mode 100644 index 0000000000..b41ff00b43 --- /dev/null +++ b/includes/definitions/discovery/sinetica.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/OS (?\S+), .*H\/w (?\S+)/' diff --git a/includes/definitions/discovery/smartos.yaml b/includes/definitions/discovery/smartos.yaml index e24f0d1d65..e2e75caf8b 100644 --- a/includes/definitions/discovery/smartos.yaml +++ b/includes/definitions/discovery/smartos.yaml @@ -1,5 +1,7 @@ mib: MSERIES-ENVMON-MIB:MSERIES-PORT-MIB modules: + os: + sysDescr_regex: '/Smart[Oo]ptics, (M-Series )?(?\S+( [^,]+))(, SmartOS (?\S+))?/' sensors: state: data: diff --git a/includes/definitions/discovery/speedtouch.yaml b/includes/definitions/discovery/speedtouch.yaml new file mode 100644 index 0000000000..8c9a98973b --- /dev/null +++ b/includes/definitions/discovery/speedtouch.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/ (?\S+)/' diff --git a/includes/definitions/discovery/sub10.yaml b/includes/definitions/discovery/sub10.yaml new file mode 100644 index 0000000000..56582310a6 --- /dev/null +++ b/includes/definitions/discovery/sub10.yaml @@ -0,0 +1,5 @@ +modules: + os: + serial: SUB10SYSTEMS-MIB::sub10UnitLclHWSerialNumber.0 + version: SUB10SYSTEMS-MIB::sub10UnitLclFirmwareVersion.0 + sysDescr_regex: '/(?(Liberator[ -])?\S+)$/' diff --git a/includes/definitions/discovery/symbol.yaml b/includes/definitions/discovery/symbol.yaml new file mode 100644 index 0000000000..efb78f25a5 --- /dev/null +++ b/includes/definitions/discovery/symbol.yaml @@ -0,0 +1,5 @@ +modules: + os: + version: .1.3.6.1.4.1.388.11.2.2.1.3.2.0 + serial: .1.3.6.1.4.1.388.11.2.2.1.1.0 + sysDescr_regex: '/^(Symbol )?(?\w*).*(, Version |SW=|S\/W rev: )(?\S+)/' diff --git a/includes/definitions/discovery/teradici-pcoip.yaml b/includes/definitions/discovery/teradici-pcoip.yaml new file mode 100644 index 0000000000..9c8d9eb2f9 --- /dev/null +++ b/includes/definitions/discovery/teradici-pcoip.yaml @@ -0,0 +1,5 @@ +modules: + os: + hardware: .1.3.6.1.4.1.25071.1.2.6.1.1.5.1 + version: .1.3.6.1.4.1.25071.1.2.6.1.1.9.1 + serial: .1.3.6.1.4.1.25071.1.2.6.1.1.7.1 diff --git a/includes/definitions/discovery/tgos.yaml b/includes/definitions/discovery/tgos.yaml new file mode 100644 index 0000000000..806b522fde --- /dev/null +++ b/includes/definitions/discovery/tgos.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/(?.*)/' diff --git a/includes/definitions/discovery/tomato.yaml b/includes/definitions/discovery/tomato.yaml new file mode 100644 index 0000000000..200f32582c --- /dev/null +++ b/includes/definitions/discovery/tomato.yaml @@ -0,0 +1,4 @@ +modules: + os: + version: .1.3.6.1.4.1.2021.7890.1.101.1 + version_regex: '/ (?.*)/' diff --git a/includes/definitions/discovery/tpdin.yaml b/includes/definitions/discovery/tpdin.yaml new file mode 100644 index 0000000000..1741b910ad --- /dev/null +++ b/includes/definitions/discovery/tpdin.yaml @@ -0,0 +1,4 @@ +modules: + os: + hardware: TPDIN2-MIB::name.0 + version: TPDIN2-MIB::version.0 diff --git a/includes/definitions/discovery/tranzeo.yaml b/includes/definitions/discovery/tranzeo.yaml new file mode 100644 index 0000000000..2d0e87ed6d --- /dev/null +++ b/includes/definitions/discovery/tranzeo.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/Tranzeo (?.*), OS (?[\d.]+)[()\d]*, (?.*)/' diff --git a/includes/definitions/discovery/vccodec.yaml b/includes/definitions/discovery/vccodec.yaml new file mode 100644 index 0000000000..6139ef8e9f --- /dev/null +++ b/includes/definitions/discovery/vccodec.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/SoftW: (?\S+)\nMCU: (Cisco TelePresence )?(?.*)\nDate: \S+\nS\/N: (?\S+)/' diff --git a/includes/definitions/discovery/vyatta.yaml b/includes/definitions/discovery/vyatta.yaml new file mode 100644 index 0000000000..2c30568c19 --- /dev/null +++ b/includes/definitions/discovery/vyatta.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/Vyatta (?.*)/' diff --git a/includes/definitions/discovery/waas.yaml b/includes/definitions/discovery/waas.yaml index 20d920c1e8..7260783ed0 100644 --- a/includes/definitions/discovery/waas.yaml +++ b/includes/definitions/discovery/waas.yaml @@ -1,5 +1,9 @@ mib: CISCO-WAN-OPTIMIZATION-MIB modules: + os: + hardware: ENTITY-MIB::entPhysicalModelName.1 + serial: ENTITY-MIB::entPhysicalSerialNum.1 + version: ENTITY-MIB::entPhysicalSoftwareRev.1 sensors: state: data: diff --git a/includes/definitions/discovery/webpower.yaml b/includes/definitions/discovery/webpower.yaml new file mode 100644 index 0000000000..55a84f0138 --- /dev/null +++ b/includes/definitions/discovery/webpower.yaml @@ -0,0 +1,8 @@ +modules: + os: + hardware: UPS-MIB::upsIdentAgentSoftwareVersion.0 + hardware_regex: '/(?WebPower .* Card)/' + version: UPS-MIB::upsIdentAgentSoftwareVersion.0 + version_regex: '/v(?[0-9]+.[0-9]+)/' + serial: UPS-MIB::upsIdentAgentSoftwareVersion.0 + serial_regex: '/SN (?[0-9]+)/' diff --git a/includes/definitions/discovery/websensor.yaml b/includes/definitions/discovery/websensor.yaml new file mode 100644 index 0000000000..4be3257652 --- /dev/null +++ b/includes/definitions/discovery/websensor.yaml @@ -0,0 +1,4 @@ +modules: + os: + serial: T3610-MIB::serialNumber.0 + sysDescr_regex: '/( fw|Version) (?.*)/' diff --git a/includes/definitions/discovery/wipipe.yaml b/includes/definitions/discovery/wipipe.yaml new file mode 100644 index 0000000000..ae78a02fb1 --- /dev/null +++ b/includes/definitions/discovery/wipipe.yaml @@ -0,0 +1,3 @@ +modules: + os: + sysDescr_regex: '/Cradlepoint (?.*), Firmware Version (?.*)/' diff --git a/includes/definitions/discovery/zebra.yaml b/includes/definitions/discovery/zebra.yaml new file mode 100644 index 0000000000..63ae602d4c --- /dev/null +++ b/includes/definitions/discovery/zebra.yaml @@ -0,0 +1,6 @@ +modules: + os: + hardware: ESI-MIB::genProductNumber.0 + serial: ESI-MIB::genSerialNumber.0 + version: ESI-MIB::genVersion.0 + sysDescr_regex: '/(?(wireless|wired))/i' diff --git a/includes/definitions/discovery/zxr10.yaml b/includes/definitions/discovery/zxr10.yaml index 783373f901..7c5c5e453a 100644 --- a/includes/definitions/discovery/zxr10.yaml +++ b/includes/definitions/discovery/zxr10.yaml @@ -1,5 +1,10 @@ mib: ZXR10-MIB modules: + os: + sysDescr_regex: + - '/ZXR10 (?.*),( ZTE ZXR10 Software)? Version: (?.*)/' + - '/ZXR10 (?.*) Software, 5900 Version: (?.*),/' + - '/ZXR10_(?.*) Software, Version ZXR10 5900 (?\S*) /' mempools: data: - diff --git a/includes/helpers.php b/includes/helpers.php index 723b169924..b47edd2d7f 100644 --- a/includes/helpers.php +++ b/includes/helpers.php @@ -31,7 +31,7 @@ if (! function_exists('d_echo')) { * Legacy convenience function - please use this instead of 'if (Debug::isEnabled()) { echo ...; }' * Use Log directly in pure Laravel code! * - * @param string|array $text The error message or array to print + * @param string|array|float|int $text The error message or array to print * @param string $no_debug_text Text to print if debug is disabled */ function d_echo($text, $no_debug_text = null) diff --git a/includes/polling/os/acsw.inc.php b/includes/polling/os/acsw.inc.php deleted file mode 100644 index cff16a5b53..0000000000 --- a/includes/polling/os/acsw.inc.php +++ /dev/null @@ -1,49 +0,0 @@ -addDataset('flows', 'GAUGE', 0, 3000000); - - $fields = [ - 'flows' => $flows, - ]; - - $tags = compact('rrd_def'); - data_update($device, 'arbos_flows', $tags, $fields); - - $os->enableGraph('arbos_flows'); -} diff --git a/includes/polling/os/areca.inc.php b/includes/polling/os/areca.inc.php deleted file mode 100644 index e3a0a90a71..0000000000 --- a/includes/polling/os/areca.inc.php +++ /dev/null @@ -1,21 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -use Illuminate\Support\Str; - -if (! Str::endsWith($device['hardware'], 'sc')) { - $oids = ['entPhysicalModelName.1', 'entPhysicalSoftwareRev.1', 'entPhysicalSerialNum.1', 'entPhysicalModelName.4', 'entPhysicalSoftwareRev.4']; - - $data = snmp_get_multi($device, $oids, '-OQUs', 'ENTITY-MIB'); - - if (isset($data[1]['entPhysicalSoftwareRev']) && $data[1]['entPhysicalSoftwareRev'] != '') { - $version = $data[1]['entPhysicalSoftwareRev']; - } elseif (isset($data[4]['entPhysicalSoftwareRev']) && $data[4]['entPhysicalSoftwareRev'] != '') { - $version = $data[4]['entPhysicalSoftwareRev']; - } - - if (isset($data[1]['entPhysicalModelName']) && $data[1]['entPhysicalModelName'] != '') { - $hardware = $data[1]['entPhysicalModelName']; - } elseif (isset($data[4]['entPhysicalSoftwareRev']) && $data[4]['entPhysicalSoftwareRev'] != '') { - $hardware = $data[4]['entPhysicalModelName']; - } - - if (isset($data[1]['entPhysicalSerialNum']) && $data[1]['entPhysicalSerialNum'] != '') { - $serial = $data[1]['entPhysicalSerialNum']; - } -} - -if (empty($hardware)) { - $hardware = snmp_get($device, 'sysObjectID.0', '-Osqv', 'SNMPv2-MIB:CISCO-PRODUCTS-MIB'); -} - -if (empty($version)) { - $explodeddata = explode(' ', $device['sysDescr']); - $version = $explodeddata['5']; -} diff --git a/includes/polling/os/asyncos.inc.php b/includes/polling/os/asyncos.inc.php deleted file mode 100644 index 6e658d2b12..0000000000 --- a/includes/polling/os/asyncos.inc.php +++ /dev/null @@ -1,47 +0,0 @@ - - */ - -use LibreNMS\RRD\RrdDefinition; - -[$hardware,$version,,$serial] = explode(',', $device['sysDescr']); - -preg_match('/\w[\d]+\w?/', $hardware, $regexp_results); -$hardware = $regexp_results[0]; - -preg_match('/[\d\.-]+/', $version, $regexp_results); -$version = $regexp_results[0]; - -preg_match('/[[\w]+-[\w]+/', $serial, $regexp_results); -$serial = $regexp_results[0]; - -// Get stats only if device is web proxy -if (strcmp($device['sysObjectID'], '.1.3.6.1.4.1.15497.1.2') == 0) { - $connections = snmp_get($device, 'tcpCurrEstab.0', '-OQv', 'TCP-MIB'); - - if (is_numeric($connections)) { - $rrd_name = 'asyncos_conns'; - $rrd_def = RrdDefinition::make()->addDataset('connections', 'GAUGE', 0, 50000); - - $fields = [ - 'connections' => $connections, - ]; - - $tags = compact('rrd_def'); - data_update($device, 'asyncos_conns', $tags, $fields); - - $os->enableGraph('asyncos_conns'); - } -} diff --git a/includes/polling/os/avaya-ipo.inc.php b/includes/polling/os/avaya-ipo.inc.php deleted file mode 100644 index 22857ab3d3..0000000000 --- a/includes/polling/os/avaya-ipo.inc.php +++ /dev/null @@ -1,11 +0,0 @@ - - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - - $version = snmp_get($device, '.1.3.6.1.4.1.738.1.111.1.1.4.0', '-Ovqs', ''); - $serial = snmp_get($device, '.1.3.6.1.4.1.738.1.5.100.1.3.1.0', '-Ovqs', ''); - $hardware = snmp_get($device, '.1.3.6.1.4.1.738.1.5.100.1.3.2.0', '-OQv', ''); - $features = ''; - - $version = str_replace('"', '', $version); - $serial = str_replace('"', '', $serial); - $hardware = str_replace('"', '', $hardware); diff --git a/includes/polling/os/bintec-smart.inc.php b/includes/polling/os/bintec-smart.inc.php deleted file mode 100644 index ab9e53a9c9..0000000000 --- a/includes/polling/os/bintec-smart.inc.php +++ /dev/null @@ -1,3 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Neil Lathwood - * @author Neil Lathwood - */ -$version = trim(snmp_get($device, 'brzaccVLRunningSoftwareVersion.0', '-Oqv', 'ALVARION-DOT11-WLAN-MIB'), '"'); diff --git a/includes/polling/os/buffalo.inc.php b/includes/polling/os/buffalo.inc.php deleted file mode 100644 index 3c5756aec9..0000000000 --- a/includes/polling/os/buffalo.inc.php +++ /dev/null @@ -1,14 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -$match = explode(' ', $device['sysDescr']); -$hardware = $match[2]; diff --git a/includes/polling/os/cat1900.inc.php b/includes/polling/os/cat1900.inc.php deleted file mode 100644 index 0b7b7fb72e..0000000000 --- a/includes/polling/os/cat1900.inc.php +++ /dev/null @@ -1,4 +0,0 @@ -= '3') { - $hardware = $ciscomodel; -} - -$device['sysDescr'] = str_replace(', Inc.', '', $device['sysDescr']); -// Make the two formats the same -$device['sysDescr'] = str_replace("\n", ' ', $device['sysDescr']); - -[,,$hardware,,,,,,,$version,,,$features] = explode(' ', $device['sysDescr']); -[,$features] = explode('-', $features); diff --git a/includes/polling/os/chatsworth-pdu.inc.php b/includes/polling/os/chatsworth-pdu.inc.php deleted file mode 100644 index 6a21af022a..0000000000 --- a/includes/polling/os/chatsworth-pdu.inc.php +++ /dev/null @@ -1,26 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Lorenzo Zafra - * @author Lorenzo Zafra - */ -$serial = trim(snmp_get($device, '.1.3.6.1.4.1.30932.1.1.1.2.0', '-OQv'), '"'); -$version = trim(snmp_get($device, '.1.3.6.1.4.1.30932.1.1.1.1.0', '-OQv'), '"'); diff --git a/includes/polling/os/cips.inc.php b/includes/polling/os/cips.inc.php deleted file mode 100644 index 271c53393d..0000000000 --- a/includes/polling/os/cips.inc.php +++ /dev/null @@ -1,15 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -$data = explode(' ', $device['sysDescr']); -$version = $data['5']; -$hardware = $data['7']; diff --git a/includes/polling/os/ciscoepc.inc.php b/includes/polling/os/ciscoepc.inc.php deleted file mode 100644 index fac51c0bd8..0000000000 --- a/includes/polling/os/ciscoepc.inc.php +++ /dev/null @@ -1,28 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Neil Lathwood - * @author Neil Lathwood - */ -$ciscoepc = snmp_get_multi_oid($device, ['saHwDescrModel.0', 'saHwDescrSerialNumber.0'], '-OUQs', 'SA-HARDWARE-MIB'); - -$hardware = $ciscoepc['saHwDescrModel.0']; -$serial = $ciscoepc['saHwDescrSerialNumber.0']; diff --git a/includes/polling/os/ciscosce.inc.php b/includes/polling/os/ciscosce.inc.php deleted file mode 100644 index 5a164698da..0000000000 --- a/includes/polling/os/ciscosce.inc.php +++ /dev/null @@ -1,15 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -$explodeddata = explode(' ', $device['sysDescr']); -$version = $explodeddata['6']; -$hardware = $explodeddata['11']; diff --git a/includes/polling/os/ciscosrp.inc.php b/includes/polling/os/ciscosrp.inc.php deleted file mode 100644 index ce58f70b6b..0000000000 --- a/includes/polling/os/ciscosrp.inc.php +++ /dev/null @@ -1,35 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -use LibreNMS\RRD\RrdDefinition; - -$oids = ['entPhysicalModelName.1', 'entPhysicalSoftwareRev.1', 'entPhysicalSerialNum.1']; - -$data = snmp_get_multi($device, $oids, '-OQUs', 'ENTITY-MIB'); - -if (isset($data[1]['entPhysicalSoftwareRev']) && $data[1]['entPhysicalSoftwareRev'] != '') { - $version = $data[1]['entPhysicalSoftwareRev']; -} - -if (isset($data[1]['entPhysicalName']) && $data[1]['entPhysicalName'] != '') { - $hardware = $data[1]['entPhysicalName']; -} - -if (isset($data[1]['entPhysicalModelName']) && $data[1]['entPhysicalModelName'] != '') { - $hardware = $data[1]['entPhysicalModelName']; -} - -if (empty($hardware)) { - $hardware = snmp_get($device, 'sysObjectID.0', '-Osqv', 'SNMPv2-MIB:CISCO-PRODUCTS-MIB'); -} - -$stats = snmpwalk_cache_oid($device, 'bsnAPEntry', $stats, 'AIRESPACE-WIRELESS-MIB', null, '-OQUsb'); -$radios = snmpwalk_cache_oid($device, 'bsnAPIfEntry', $radios, 'AIRESPACE-WIRELESS-MIB', null, '-OQUsb'); -$APstats = snmpwalk_cache_oid($device, 'bsnApIfNoOfUsers', $APstats, 'AIRESPACE-WIRELESS-MIB', null, '-OQUsxb'); -$loadParams = snmpwalk_cache_oid($device, 'bsnAPIfLoadChannelUtilization', $loadParams, 'AIRESPACE-WIRELESS-MIB', null, '-OQUsb'); -$interferences = snmpwalk_cache_oid($device, 'bsnAPIfInterferencePower', $interferences, 'AIRESPACE-WIRELESS-MIB', null, '-OQUsb'); - -$numAccessPoints = is_countable($stats) ? count($stats) : 0; -$numClients = 0; - -foreach ($APstats as $key => $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); - -$ap_db = dbFetchRows('SELECT * FROM `access_points` WHERE `device_id` = ?', [$device['device_id']]); - -foreach ($radios as $key => $value) { - $indexName = substr($key, 0, -2); - - $channel = str_replace('ch', '', $value['bsnAPIfPhyChannelNumber']); - $mac = str_replace(' ', ':', $stats[$indexName]['bsnAPDot3MacAddress']); - $name = $stats[$indexName]['bsnAPName']; - $numasoclients = $value['bsnApIfNoOfUsers']; - $radioArray = explode('.', $key); - $radionum = array_pop($radioArray); - $txpow = $value['bsnAPIfPhyTxPowerLevel']; - $type = $value['bsnAPIfType']; - $interference = 128 + $interferences[$key . '.' . $channel]['bsnAPIfInterferencePower']; - $radioutil = $loadParams[$key]['bsnAPIfLoadChannelUtilization']; - - // TODO - $numactbssid = 0; - $nummonbssid = 0; - $nummonclients = 0; - - d_echo(" name: $name\n"); - d_echo(" radionum: $radionum\n"); - d_echo(" type: $type\n"); - d_echo(" channel: $channel\n"); - d_echo(" txpow: $txpow\n"); - d_echo(" radioutil: $radioutil\n"); - d_echo(" numasoclients: $numasoclients\n"); - d_echo(" interference: $interference\n"); - - // if there is a numeric channel, assume the rest of the data is valid, I guess - if (! is_numeric($channel)) { - continue; - } - - $rrd_name = ['arubaap', $name . $radionum]; - $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); - - $fields = [ - 'channel' => $channel, - 'txpow' => $txpow, - 'radioutil' => $radioutil, - 'nummonclients' => $nummonclients, - 'nummonbssid' => $nummonbssid, - 'numasoclients' => $numasoclients, - 'interference' => $interference, - ]; - - $tags = compact('name', 'radionum', 'rrd_name', 'rrd_def'); - data_update($device, 'arubaap', $tags, $fields); - - $foundid = 0; - - for ($z = 0; $z < sizeof($ap_db); $z++) { - if ($ap_db[$z]['name'] == $name && $ap_db[$z]['radio_number'] == $radionum) { - $foundid = $ap_db[$z]['accesspoint_id']; - $ap_db[$z]['seen'] = 1; - continue; - } - } - - if ($foundid == 0) { - $ap_id = dbInsert( - [ - 'device_id' => $device['device_id'], - 'name' => $name, - 'radio_number' => $radionum, - 'type' => $type, - 'mac_addr' => $mac, - 'channel' => $channel, - 'txpow' => $txpow, - 'radioutil' => $radioutil, - 'numasoclients' => $numasoclients, - 'nummonclients' => $nummonclients, - 'numactbssid' => $numactbssid, - 'nummonbssid' => $nummonbssid, - 'interference' => $interference, - ], - 'access_points' - ); - } else { - dbUpdate( - [ - 'mac_addr' => $mac, - 'type' => $type, - 'deleted' => 0, - 'channel' => $channel, - 'txpow' => $txpow, - 'radioutil' => $radioutil, - 'numasoclients' => $numasoclients, - 'nummonclients' => $nummonclients, - 'numactbssid' => $numactbssid, - 'nummonbssid' => $nummonbssid, - 'interference' => $interference, - ], - 'access_points', - '`accesspoint_id` = ?', - [$foundid] - ); - } -}//end foreach - -for ($z = 0; $z < sizeof($ap_db); $z++) { - if (! isset($ap_db[$z]['seen']) && $ap_db[$z]['deleted'] == 0) { - dbUpdate(['deleted' => 1], 'access_points', '`accesspoint_id` = ?', [$ap_db[$z]['accesspoint_id']]); - } -} diff --git a/includes/polling/os/clearpass.inc.php b/includes/polling/os/clearpass.inc.php deleted file mode 100644 index fe22f441ed..0000000000 --- a/includes/polling/os/clearpass.inc.php +++ /dev/null @@ -1,38 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Neil Lathwood - * @author Neil Lathwood - */ -$hardware_oid = '.1.3.6.1.4.1.14823.1.6.1.1.1.1.1.1.0'; -$serial_oid = '.1.3.6.1.4.1.14823.1.6.1.1.1.1.1.2.0'; -$firmware_oid = '.1.3.6.1.4.1.14823.1.6.1.1.1.1.1.3.0'; -$clearpass_data = snmp_get_multi_oid($device, "$hardware_oid $serial_oid $firmware_oid"); - -$hardware = trim($clearpass_data[$hardware_oid], '"'); -$serial = trim($clearpass_data[$serial_oid], '"'); -$version = trim($clearpass_data[$firmware_oid], '"'); - -unset( - $clearpass_data, - $hardware_oid, - $firmware_oid -); diff --git a/includes/polling/os/cnpilote.inc.php b/includes/polling/os/cnpilote.inc.php deleted file mode 100644 index 969b2e0eba..0000000000 --- a/includes/polling/os/cnpilote.inc.php +++ /dev/null @@ -1,16 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2016 Neil Lathwood - * @author Neil Lathwood - */ -$hardware = str_replace(' GigaBit Ethernet Switch', '', $device['sysDescr']); diff --git a/includes/polling/os/datacom.inc.php b/includes/polling/os/datacom.inc.php deleted file mode 100644 index 945f2a2400..0000000000 --- a/includes/polling/os/datacom.inc.php +++ /dev/null @@ -1,6 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ -$hardware = snmp_get($device, '.1.3.6.1.4.1.32761.3.1.1.1.3.0', '-Osqv'); diff --git a/includes/polling/os/dell-powervault.inc.php b/includes/polling/os/dell-powervault.inc.php deleted file mode 100644 index d9b1d76560..0000000000 --- a/includes/polling/os/dell-powervault.inc.php +++ /dev/null @@ -1,4 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2016 Neil Lathwood - * @author Neil Lathwood - */ -[$hardware, $version] = preg_split('/ /', preg_replace('/([\\\"]+)/', '', $device['sysDescr'])); diff --git a/includes/polling/os/develop.inc.php b/includes/polling/os/develop.inc.php deleted file mode 100644 index 23a182a0b2..0000000000 --- a/includes/polling/os/develop.inc.php +++ /dev/null @@ -1,12 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ -$hardware = str_replace('Develop ', '', $device['sysDescr']); diff --git a/includes/polling/os/digipower.inc.php b/includes/polling/os/digipower.inc.php deleted file mode 100644 index 82b0f8dc31..0000000000 --- a/includes/polling/os/digipower.inc.php +++ /dev/null @@ -1,12 +0,0 @@ - - */ -preg_match('/Router Model: ([\w ]+), Version: ([\w\.]+)/', $device['sysDescr'], $tmp_draytek); -$hardware = $tmp_draytek[1]; -$version = $tmp_draytek[2]; -unset($tmp_draytek); diff --git a/includes/polling/os/eaton-ats.inc.php b/includes/polling/os/eaton-ats.inc.php deleted file mode 100644 index c0ae0aca46..0000000000 --- a/includes/polling/os/eaton-ats.inc.php +++ /dev/null @@ -1,6 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Neil Lathwood - * @author Neil Lathwood - */ -$tmp_ees = snmp_get_multi($device, ['identControllerFirmwareVersion.0', 'identControllerSerialNumber.0'], '-OQUs', 'EES-POWER-MIB'); -$version = $tmp_ees[0]['identControllerFirmwareVersion']; -$serial = $tmp_ees[0]['identControllerSerialNumber']; - -unset($tmp_ees); diff --git a/includes/polling/os/elg-ipecs-es.inc.php b/includes/polling/os/elg-ipecs-es.inc.php deleted file mode 100644 index 7128d4e242..0000000000 --- a/includes/polling/os/elg-ipecs-es.inc.php +++ /dev/null @@ -1,27 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Neil Lathwood - * @author Neil Lathwood - */ -[$hardware, $dump] = explode(' ', $device['sysDescr'], 2); - -unset($dump); diff --git a/includes/polling/os/elg-ipecs-ucp.inc.php b/includes/polling/os/elg-ipecs-ucp.inc.php deleted file mode 100644 index d3b2e75667..0000000000 --- a/includes/polling/os/elg-ipecs-ucp.inc.php +++ /dev/null @@ -1,25 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Neil Lathwood - * @author Neil Lathwood - */ -[,$hardware,] = explode(',', $device['sysDescr'], 3); diff --git a/includes/polling/os/eltex-olt.inc.php b/includes/polling/os/eltex-olt.inc.php deleted file mode 100644 index 92460f00a9..0000000000 --- a/includes/polling/os/eltex-olt.inc.php +++ /dev/null @@ -1,30 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Neil Lathwood - * @author Neil Lathwood - */ -$tmp_eltex = snmp_get($device, 'ltp8xFirmwareRevision.0', '-Ovq', 'ELTEX-LTP8X-STANDALONE'); -[$hardware, $tmp_eltex] = explode(':', $tmp_eltex); -$tmp_eltex = preg_split('/(software version| on)/', $tmp_eltex); -$version = $tmp_eltex['1']; - -unset($tmp_eltex); diff --git a/includes/polling/os/engenius.inc.php b/includes/polling/os/engenius.inc.php deleted file mode 100644 index 5284d642a3..0000000000 --- a/includes/polling/os/engenius.inc.php +++ /dev/null @@ -1,43 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Neil Lathwood - * @author Neil Lathwood - */ -$tmp_enlogic = snmp_get_multi_oid($device, 'pduNamePlateModelNumber pduNamePlateSerialNumber pduNamePlateFirmwareVersion', '-OUQn', 'ENLOGIC-PDU-MIB'); - -$hardware = $tmp_enlogic['.1.3.6.1.4.1.38446.1.1.2.1.10.1']; -$serial = $tmp_enlogic['.1.3.6.1.4.1.38446.1.1.2.1.11.1']; -$version = $tmp_enlogic['.1.3.6.1.4.1.38446.1.1.2.1.13.1']; - -unset($tmp_enlogic); diff --git a/includes/polling/os/epmp.inc.php b/includes/polling/os/epmp.inc.php deleted file mode 100644 index a122ab879f..0000000000 --- a/includes/polling/os/epmp.inc.php +++ /dev/null @@ -1,102 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. -*/ -use LibreNMS\RRD\RrdDefinition; - -$epmp_ap = snmp_get($device, 'wirelessInterfaceMode.0', '-Oqv', 'CAMBIUM-PMP80211-MIB'); -$epmp_number = snmp_get($device, 'cambiumSubModeType.0', '-Oqv', 'CAMBIUM-PMP80211-MIB'); - -if ($epmp_ap == 1) { - if ($epmp_number == 5) { - $hardware = 'ePTP Master'; - } else { - $hardware = 'ePMP AP'; - } -} elseif ($epmp_ap == 2) { - if ($epmp_number == 4) { - $hardware = 'ePTP Slave'; - } else { - $hardware = 'ePMP SM'; - } -} - -$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); - $os->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); - $os->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); - $os->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); - $os->enableGraph('cambium-epmp-frameUtilization'); -} -unset($multi_get_array, $ulWlanFrameUtilization, $ulWLanTotalAvailableFrameTimePerSecond, $ulWLanTotalUsedFrameTimePerSecond, $dlWlanFrameUtilization, $dlWLanTotalAvailableFrameTimePerSecond, $dlWLanTotalUsedFrameTimePerSecond); diff --git a/includes/polling/os/exagridos.inc.php b/includes/polling/os/exagridos.inc.php deleted file mode 100644 index 587a704c10..0000000000 --- a/includes/polling/os/exagridos.inc.php +++ /dev/null @@ -1,5 +0,0 @@ -[^,]*), (?.*)$/', $device['sysDescr'], $data); -$version = $data[2]; -$hardware = $data[1]; diff --git a/includes/polling/os/extendair.inc.php b/includes/polling/os/extendair.inc.php deleted file mode 100644 index 88fae49d62..0000000000 --- a/includes/polling/os/extendair.inc.php +++ /dev/null @@ -1,30 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Neil Lathwood - * @author Neil Lathwood - */ -$extendair_data = snmp_get_multi_oid($device, ['serialNumber.0', 'firmwareVersion.0'], '-OQs', 'ExaltComProducts'); - -$serial = $extendair_data['serialNumber.0']; -$version = $extendair_data['firmwareVersion.0']; - -unset($extendair_data); diff --git a/includes/polling/os/extrahop.inc.php b/includes/polling/os/extrahop.inc.php deleted file mode 100644 index 7d4d94a40f..0000000000 --- a/includes/polling/os/extrahop.inc.php +++ /dev/null @@ -1,15 +0,0 @@ - - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -$version = snmp_get($device, 'extrahopInfoVersionString', '-Oqv', 'EXTRAHOP-MIB'); diff --git a/includes/polling/os/f5.inc.php b/includes/polling/os/f5.inc.php deleted file mode 100644 index 8013050228..0000000000 --- a/includes/polling/os/f5.inc.php +++ /dev/null @@ -1,90 +0,0 @@ - [ - 'dataset' => 'sessions', - 'type' => 'GAUGE', - 'name' => 'bigip_apm_sessions', - ], - 'sysStatClientTotConns' => [ - 'dataset' => 'ClientTotConns', - 'type' => 'COUNTER', - 'name' => 'bigip_system_client_connection_rate', - ], - 'sysStatServerTotConns' => [ - 'dataset' => 'ServerTotConns', - 'type' => 'COUNTER', - 'name' => 'bigip_system_server_connection_rate', - ], - 'sysStatClientCurConns' => [ - 'dataset' => 'ClientCurConns', - 'type' => 'GAUGE', - 'name' => 'bigip_system_client_concurrent_connections', - ], - 'sysStatServerCurConns' => [ - 'dataset' => 'ServerCurConns', - 'type' => 'GAUGE', - 'name' => 'bigip_system_server_concurrent_connections', - ], -]; - -$data = snmp_get_multi($device, $oids, '-OQUs'); - -foreach ($metadata as $key => $info) { - $value = $data[0][$key]; - if (is_numeric($value)) { - $rrd_def = RrdDefinition::make()->addDataset($info['dataset'], $info['type'], 0); - $fields = [ - $info['dataset'] => $value, - ]; - $tags = compact('rrd_def'); - data_update($device, $info['name'], $tags, $fields); - $graphs[$info['name']] = true; - } -} - -// SSL TPS -$oids = [ - 'F5-BIGIP-SYSTEM-MIB::sysClientsslStatTotNativeConns.0', - 'F5-BIGIP-SYSTEM-MIB::sysClientsslStatTotCompatConns.0', -]; -$data = snmp_get_multi($device, $oids, '-OQUs'); - -if (is_numeric($data[0]['sysClientsslStatTotNativeConns']) && is_numeric($data[0]['sysClientsslStatTotCompatConns'])) { - $rrd_def = RrdDefinition::make() - ->addDataset('TotNativeConns', 'COUNTER', 0) - ->addDataset('TotCompatConns', 'COUNTER', 0); - $fields = [ - 'TotNativeConns' => $data[0]['sysClientsslStatTotNativeConns'], - 'TotCompatConns' => $data[0]['sysClientsslStatTotCompatConns'], - ]; - $tags = compact('rrd_def'); - data_update($device, 'bigip_system_tps', $tags, $fields); - $os->enableGraph('bigip_system_tps'); -} - -unset($data, $oids, $metadata); diff --git a/includes/polling/os/firebox.inc.php b/includes/polling/os/firebox.inc.php deleted file mode 100644 index 5a3ea52bad..0000000000 --- a/includes/polling/os/firebox.inc.php +++ /dev/null @@ -1,8 +0,0 @@ - - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -$hardware = $device['sysDescr']; diff --git a/includes/polling/os/flareos.inc.php b/includes/polling/os/flareos.inc.php deleted file mode 100644 index a1692286c6..0000000000 --- a/includes/polling/os/flareos.inc.php +++ /dev/null @@ -1,15 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -$output = preg_split('/ /', $device['sysDescr']); -$hardware = $output[0]; -$version = $output[3]; diff --git a/includes/polling/os/foundryos.inc.php b/includes/polling/os/foundryos.inc.php deleted file mode 100644 index ee95ae2708..0000000000 --- a/includes/polling/os/foundryos.inc.php +++ /dev/null @@ -1,14 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -preg_match('/Foundry Networks (.*)/', $device['sysDescr'], $data); -$hardware = $data[1]; diff --git a/includes/polling/os/fujitsupyos.inc.php b/includes/polling/os/fujitsupyos.inc.php deleted file mode 100644 index 387091ef77..0000000000 --- a/includes/polling/os/fujitsupyos.inc.php +++ /dev/null @@ -1,15 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -$data = str_replace(['Fujitsu ', ' Runtime Code '], '', explode(',', $device['sysDescr'])); -$hardware = $data[0]; -$version = $data[1]; diff --git a/includes/polling/os/fxm.inc.php b/includes/polling/os/fxm.inc.php deleted file mode 100644 index c811517fe2..0000000000 --- a/includes/polling/os/fxm.inc.php +++ /dev/null @@ -1,28 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Neil Lathwood - * @author Neil Lathwood - */ -$fxm_tmp = snmp_get_multi_oid($device, ['upsIdentProductCode.0', 'upsIdentUPSSoftwareVersion.0'], '-OUQs', 'Argus-Power-System-MIB'); -$hardware = $fxm_tmp['upsIdentProductCode.0']; -$version = $fxm_tmp['upsIdentUPSSoftwareVersion.0']; -unset($fxm_tmp); diff --git a/includes/polling/os/fxos.inc.php b/includes/polling/os/fxos.inc.php deleted file mode 100644 index a6ae239c1d..0000000000 --- a/includes/polling/os/fxos.inc.php +++ /dev/null @@ -1,18 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -if (preg_match('/Version ([^,]+)/', $device['sysDescr'], $regexp_result)) { - $version = $regexp_result[1]; -} - -$serial = snmp_get($device, 'ENTITY-MIB::entPhysicalSerialNum.10', '-Osqnv'); -$hardware = snmp_get($device, 'sysObjectID.0', '-Osqv', 'SNMPv2-MIB:CISCO-PRODUCTS-MIB'); diff --git a/includes/polling/os/geist-pdu.inc.php b/includes/polling/os/geist-pdu.inc.php deleted file mode 100644 index 0226bbd032..0000000000 --- a/includes/polling/os/geist-pdu.inc.php +++ /dev/null @@ -1,26 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Neil Lathwood - * @author Neil Lathwood - */ -$version = snmp_get($device, 'productVersion.0', '-Oqv', 'GEIST-MIB-V3'); -$hardware = snmp_get($device, 'productHardware.0', '-Oqv', 'GEIST-MIB-V3'); diff --git a/includes/polling/os/geist-watchdog.inc.php b/includes/polling/os/geist-watchdog.inc.php deleted file mode 100644 index feca5d8f0e..0000000000 --- a/includes/polling/os/geist-watchdog.inc.php +++ /dev/null @@ -1,26 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Neil Lathwood - * @author Neil Lathwood - */ -$serial = snmp_get($device, 'climateSerial.1', '-Oqv', 'GEIST-MIB-V3'); -$version = snmp_get($device, 'productVersion.0', '-Oqv', 'GEIST-MIB-V3'); diff --git a/includes/polling/os/gestetner.inc.php b/includes/polling/os/gestetner.inc.php deleted file mode 100644 index 10172afcb6..0000000000 --- a/includes/polling/os/gestetner.inc.php +++ /dev/null @@ -1,10 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -$explodeddata = explode('Halon ', $device['sysDescr']); -$version = $explodeddata['1']; -$serial = trim(snmp_get($device, 'HALON-SP-MIB::serialNumber.0', '-OQv'), '"'); diff --git a/includes/polling/os/hpe-ipdu.inc.php b/includes/polling/os/hpe-ipdu.inc.php deleted file mode 100644 index c330106a86..0000000000 --- a/includes/polling/os/hpe-ipdu.inc.php +++ /dev/null @@ -1,31 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Neil Lathwood - * @author Neil Lathwood - */ -$hpe_ipdu_data = snmp_get_multi_oid($device, ['mpduFirmwareVersion.0', 'mpduSerialNumber.0', 'mpduModel.0'], '-OUQs', 'CPQPOWER-MIB'); - -$serial = trim($hpe_ipdu_data['mpduSerialNumber.1'], '"'); -$version = trim($hpe_ipdu_data['mpduFirmwareVersion.1'], '"'); -$hardware = trim($hpe_ipdu_data['mpduModel.1'], '"'); - -unset($hpe_ipdu_data); diff --git a/includes/polling/os/hpe-msa.inc.php b/includes/polling/os/hpe-msa.inc.php deleted file mode 100644 index 243e9a25aa..0000000000 --- a/includes/polling/os/hpe-msa.inc.php +++ /dev/null @@ -1,8 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2016 Neil Lathwood - * @author Neil Lathwood - */ -$oids = ['hpHttpMgDeviceProductName.1', 'hpHttpMgDeviceSerialNumber.1', 'hpHttpMgDeviceVersion.1']; - -$data = snmp_get_multi($device, $oids, '-OQUs', 'SEMI-MIB'); -d_echo($data); - -$hardware = $data[1]['hpHttpMgDeviceProductName']; -$serial = $data[1]['hpHttpMgDeviceSerialNumber']; -$version = $data[1]['hpHttpMgDeviceVersion']; diff --git a/includes/polling/os/hpe-rtups.inc.php b/includes/polling/os/hpe-rtups.inc.php deleted file mode 100644 index c5d63b2ac0..0000000000 --- a/includes/polling/os/hpe-rtups.inc.php +++ /dev/null @@ -1,8 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -preg_match_all('/STE2/', $device['sysDescr'], $matches); -$hardware = $matches[0][0]; diff --git a/includes/polling/os/ibmnos.inc.php b/includes/polling/os/ibmnos.inc.php deleted file mode 100644 index acab5e1af8..0000000000 --- a/includes/polling/os/ibmnos.inc.php +++ /dev/null @@ -1,48 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ -$sysdescr_value = $device['sysDescr']; -if (strpos($sysdescr_value, 'IBM Networking Operating System') !== false) { - $hardware = str_replace('IBM Networking Operating System', '', $sysdescr_value); - if (strpos($sysdescr_value, 'G8052') !== false) { - $version = trim(snmp_get($device, '.1.3.6.1.2.1.47.1.1.1.1.10.1', '-Ovq'), '" '); - $serial = trim(snmp_get($device, '.1.3.6.1.4.1.26543.100.100.14.9.0', '-Ovq'), '" '); - } - - if (strpos($sysdescr_value, 'G8316') !== false) { - $version = trim(snmp_get($device, '.1.3.6.1.2.1.47.1.1.1.1.10.1', '-Ovq'), '" '); - $serial = trim(snmp_get($device, '.1.3.6.1.4.1.20301.100.100.14.9.0', '-Ovq'), '" '); - } - - if (strpos($sysdescr_value, 'G8264CS') !== false) { - $version = trim(snmp_get($device, '.1.3.6.1.4.1.20301.2.7.15.1.1.1.10.0', '-Ovq'), '" '); - $serial = trim(snmp_get($device, '.1.3.6.1.4.1.20301.100.100.14.9.0', '-Ovq'), '" '); - } - - if (strpos($sysdescr_value, 'G8264-T') !== false) { - $version = trim(snmp_get($device, '.1.3.6.1.4.1.20301.2.7.13.1.1.1.10.0', '-Ovq'), '" '); - $serial = trim(snmp_get($device, '.1.3.6.1.4.1.20301.100.100.14.9.0', '-Ovq'), '" '); - } - - if (empty($version)) { - $version = trim(snmp_get($device, '.1.3.6.1.2.1.47.1.1.1.1.10.1', '-Ovq'), '" '); - } - - if (empty($serial)) { - $serial = trim(snmp_get($device, '.1.3.6.1.2.1.47.1.1.1.1.11.1', '-Ovq'), '" '); - } -} elseif (strpos($sysdescr_value, 'IBM Flex System Fabric') !== false) { - $hardware = str_replace('IBM Flex System Fabric', '', $sysdescr_value); - $version = trim(snmp_get($device, '.1.3.6.1.2.1.47.1.1.1.1.10.1', '-Ovq'), '" '); - $serial = trim(snmp_get($device, '.1.3.6.1.2.1.47.1.1.1.1.11.1', '-Ovq'), '" '); -} elseif (strpos($sysdescr_value, 'IBM Networking OS 1/10Gb Uplink Ethernet Switch Module') !== false) { - $hardware = 'IBM BladeCenter 1/10Gb Uplink Ethernet Switch Module'; -}//end if diff --git a/includes/polling/os/ibmtl.inc.php b/includes/polling/os/ibmtl.inc.php deleted file mode 100644 index ad791f5014..0000000000 --- a/includes/polling/os/ibmtl.inc.php +++ /dev/null @@ -1,15 +0,0 @@ - -* This program is free software: you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by the -* Free Software Foundation, either version 3 of the License, or (at your -* option) any later version. Please see LICENSE.txt at the top level of -* the source code distribution for details. -*/ - -$hardware = trim(snmp_get($device, '.1.3.6.1.4.1.14851.3.1.4.2.0', '-Ovq'), '" '); -$serial = trim(snmp_get($device, '.1.3.6.1.4.1.14851.3.1.3.2.0', '-Ovq'), '" '); -$version = trim(snmp_get($device, '.1.3.6.1.4.1.14851.3.1.3.4.0', '-Ovq'), '" '); diff --git a/includes/polling/os/ict-psu.inc.php b/includes/polling/os/ict-psu.inc.php deleted file mode 100644 index 02efaae706..0000000000 --- a/includes/polling/os/ict-psu.inc.php +++ /dev/null @@ -1,7 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -if (preg_match('/^HP_3PAR (.*), ID: (.*), Serial number: (.*), InForm OS version: (.*)/', $device['sysDescr'], $regexp_result)) { - $hardware = 'HP 3Par ' . $regexp_result[1]; - $serial = $regexp_result[3]; - $version = $regexp_result[4]; -} diff --git a/includes/polling/os/junose.inc.php b/includes/polling/os/junose.inc.php deleted file mode 100644 index 8caad8a873..0000000000 --- a/includes/polling/os/junose.inc.php +++ /dev/null @@ -1,17 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -$version = trim(snmp_get($device, 'patchVersion.0', '-Ovq', 'B100-MIB'), '"'); diff --git a/includes/polling/os/kti.inc.php b/includes/polling/os/kti.inc.php deleted file mode 100644 index 18cd8c6a70..0000000000 --- a/includes/polling/os/kti.inc.php +++ /dev/null @@ -1,4 +0,0 @@ - - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - - $hardware = snmp_get($device, 'slcSystemModel.0', '-Ovqs', 'LANTRONIX-SLC-MIB'); - $hardware = str_replace('"', '', $hardware); - $version = snmp_get($device, 'slcSystemFWRev.0', '-Ovqs', 'LANTRONIX-SLC-MIB'); - $version = str_replace('"', '', $version); - $serial = snmp_get($device, 'slcSystemSerialNo.0', '-Ovqs', 'LANTRONIX-SLC-MIB'); - $serial = str_replace('"', '', $serial); - $features = snmp_get($device, 'slcSystemModelString.0', '-Ovqs', 'LANTRONIX-SLC-MIB'); - $features = str_replace('"', '', $features); diff --git a/includes/polling/os/lenovoemc.inc.php b/includes/polling/os/lenovoemc.inc.php deleted file mode 100644 index b165c5a96b..0000000000 --- a/includes/polling/os/lenovoemc.inc.php +++ /dev/null @@ -1,3 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -[$hardware,$version] = explode(',', $device['sysDescr']); -preg_match('/(v[0-9\-\.]+)/', $version, $tmp_version); -$version = rtrim($tmp_version[0], '.'); diff --git a/includes/polling/os/mellanox.inc.php b/includes/polling/os/mellanox.inc.php deleted file mode 100644 index ae78c44ac7..0000000000 --- a/includes/polling/os/mellanox.inc.php +++ /dev/null @@ -1,8 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -if (empty($hardware)) { - $hardware = $device['sysDescr']; -} diff --git a/includes/polling/os/merakimx.inc.php b/includes/polling/os/merakimx.inc.php deleted file mode 100644 index 5943fb1d53..0000000000 --- a/includes/polling/os/merakimx.inc.php +++ /dev/null @@ -1,15 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -if (empty($hardware)) { - $hardware = $device['sysDescr']; -} diff --git a/includes/polling/os/minkelsrms.inc.php b/includes/polling/os/minkelsrms.inc.php deleted file mode 100644 index 9922a2e166..0000000000 --- a/includes/polling/os/minkelsrms.inc.php +++ /dev/null @@ -1,4 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -// SNMPv2-MIB::sysDescr.0 = STRING: NP5610-16 -// SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.8691.2.7 -// DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (50870289) 5 days, 21:18:22.89 - -$hardware = $device['sysDescr']; diff --git a/includes/polling/os/msl.inc.php b/includes/polling/os/msl.inc.php deleted file mode 100644 index 46b7fea431..0000000000 --- a/includes/polling/os/msl.inc.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -$mslhw = $device['sysDescr']; -$version_oid = '.1.3.6.1.4.1.1027.4.1.2.1.1.1.4.10.1.3.6.1.4.1.1027.1.6.1'; -$features_oid = '.1.3.6.1.4.1.1027.4.1.2.1.1.1.5.10.1.3.6.1.4.1.1027.1.6.1'; -$oids = ['mitelAppTblProductVersion.10.1.3.6.1.4.1.1027.1.6.1', 'mitelAppTblProductDescr.10.1.3.6.1.4.1.1027.1.6.1']; -$mitelapptbl_data = snmp_get_multi_oid($device, $oids, '-OUQnt', 'MITEL-APPCMN-MIB'); - -$hardware = preg_replace('/;VerSw.*$/', '', (preg_replace('/^.*VerHw:/', '', $mslhw))); -$version = trim($mitelapptbl_data[$version_oid], '"'); -$features = trim($mitelapptbl_data[$features_oid], '"'); - -unset( - $mslhw, - $mitelapptbl_data, - $version_oid, - $features_oid -); diff --git a/includes/polling/os/netagent2.inc.php b/includes/polling/os/netagent2.inc.php deleted file mode 100644 index ef2ab7eb1a..0000000000 --- a/includes/polling/os/netagent2.inc.php +++ /dev/null @@ -1,27 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2018 Mikael Sipilainen - * @author Mikael Sipilainen - */ -$oid = snmp_get_multi($device, ['.1.3.6.1.2.1.33.1.1.4.0', '.1.3.6.1.2.1.33.1.1.1.0'], '-OQU'); -$version = $oid[0]['.1.3.6.1.2.1.33.1.1.4.0']; -$hardware = $oid[0]['.1.3.6.1.2.1.33.1.1.1.0']; diff --git a/includes/polling/os/netapp.inc.php b/includes/polling/os/netapp.inc.php deleted file mode 100644 index e39c7529a8..0000000000 --- a/includes/polling/os/netapp.inc.php +++ /dev/null @@ -1,6 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -$version = trim(snmp_get($device, '1.3.6.1.4.1.318.1.4.2.4.1.4.1', '-OQv', '', ''), '"'); -$hardware = snmp_get($device, 'sysObjectID.0', '-Osqv', 'SNMPv2-MIB:NETBOTZ410-MIB'); diff --git a/includes/polling/os/netguardian.inc.php b/includes/polling/os/netguardian.inc.php deleted file mode 100644 index d8ceb2ffaf..0000000000 --- a/includes/polling/os/netguardian.inc.php +++ /dev/null @@ -1,28 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Neil Lathwood - * @author Neil Lathwood - */ -$netguardian_tmp = snmp_get_multi_oid($device, ['dpsRTUModel.0', 'dpsRTUFirmwareVersion.0'], '-OQs', 'DPS-MIB-V38'); -$version = $netguardian_tmp['dpsRTUFirmwareVersion.0']; -$hardware = $netguardian_tmp['dpsRTUModel.0']; -unset($netguardian_tmp); diff --git a/includes/polling/os/netmanplus.inc.php b/includes/polling/os/netmanplus.inc.php deleted file mode 100644 index e209c6a376..0000000000 --- a/includes/polling/os/netmanplus.inc.php +++ /dev/null @@ -1,3 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -preg_match('/version (.*)/', $device['sysDescr'], $data); -$version = $data[1]; diff --git a/includes/polling/os/nitro.inc.php b/includes/polling/os/nitro.inc.php deleted file mode 100644 index 6d9757ac2c..0000000000 --- a/includes/polling/os/nitro.inc.php +++ /dev/null @@ -1,18 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Thomas GAGNIERE - * @author Thomas GAGNIERE - */ -$data = snmp_get_multi_oid($device, ['snsModel.0', 'snsVersion.0', 'snsSerialNumber.0', 'snsSystemName.0'], '-OUQs', 'STORMSHIELD-PROPERTY-MIB'); - -$hardware = $data['snsModel.0']; -$version = $data['snsVersion.0']; -$serial = $data['snsSerialNumber.0']; -$sysName = $data['snsSystemName.0']; diff --git a/includes/polling/os/oceanstor.inc.php b/includes/polling/os/oceanstor.inc.php deleted file mode 100644 index 1a30f1a335..0000000000 --- a/includes/polling/os/oceanstor.inc.php +++ /dev/null @@ -1,25 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Neil Lathwood - * @author Neil Lathwood - */ -$version = snmp_get($device, 'version.0', '-OQv', 'ISM-STORAGE-SVC-MIB'); diff --git a/includes/polling/os/onefs.inc.php b/includes/polling/os/onefs.inc.php deleted file mode 100644 index 6fcebfc1b6..0000000000 --- a/includes/polling/os/onefs.inc.php +++ /dev/null @@ -1,7 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -if (preg_match('/^(.*), ILOM v(.*), (.*)/', $device['sysDescr'], $regexp_result)) { - $hardware = 'Oracle ' . $regexp_result[1]; - $version = $regexp_result[2]; -} diff --git a/includes/polling/os/pbn-cp.inc.php b/includes/polling/os/pbn-cp.inc.php deleted file mode 100644 index a61cca4ca3..0000000000 --- a/includes/polling/os/pbn-cp.inc.php +++ /dev/null @@ -1,8 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ -$hardware = snmp_get($device, 'chassisModelName.1', '-OsvQU', 'PERLE-MCR-MGT-MIB'); diff --git a/includes/polling/os/poweralert.inc.php b/includes/polling/os/poweralert.inc.php deleted file mode 100644 index bfd30f068e..0000000000 --- a/includes/polling/os/poweralert.inc.php +++ /dev/null @@ -1,14 +0,0 @@ - - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -$version = 'Powercode'; -$hardware = 'BMU'; diff --git a/includes/polling/os/powerlogic.inc.php b/includes/polling/os/powerlogic.inc.php deleted file mode 100644 index 3e6ad857e0..0000000000 --- a/includes/polling/os/powerlogic.inc.php +++ /dev/null @@ -1,29 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Neil Lathwood - * @author Neil Lathwood - */ -$data = snmp_get_multi_oid($device, ['midSerialNumber.1', 'midFirmwareVersion.1', 'midModelNumber.1', 'midDeviceName.1'], '-OQs', 'PM8ECCMIB'); -$serial = trim($data['midSerialNumber.1'], '"'); -$version = trim($data['midFirmwareVersion.1'], '"'); -$hardware = trim($data['midDeviceName.1'], '"'); -unset($data); diff --git a/includes/polling/os/powervault.inc.php b/includes/polling/os/powervault.inc.php deleted file mode 100644 index fc5c7e01a0..0000000000 --- a/includes/polling/os/powervault.inc.php +++ /dev/null @@ -1,3 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. -*/ - -$version = $device['sysDescr']; -$masterSlaveMode = ucfirst(snmp_get($device, 'masterSlaveMode.0', '-Oqv', 'CAMBIUM-PTP250-MIB')); -$hardware = 'PTP 250 ' . $masterSlaveMode; diff --git a/includes/polling/os/ptp500.inc.php b/includes/polling/os/ptp500.inc.php deleted file mode 100644 index d80ac64b9a..0000000000 --- a/includes/polling/os/ptp500.inc.php +++ /dev/null @@ -1,5 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. -*/ - -$version = $device['sysDescr']; -$masterSlaveMode = ucfirst(snmp_get($device, 'masterSlaveMode.0', '-Oqv', 'CAMBIUM-PTP650-MIB')); -$hardware = 'PTP 650 ' . $masterSlaveMode; diff --git a/includes/polling/os/remoteye4.inc.php b/includes/polling/os/remoteye4.inc.php deleted file mode 100644 index ab424c8648..0000000000 --- a/includes/polling/os/remoteye4.inc.php +++ /dev/null @@ -1,28 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Neil Lathwood - * @author Neil Lathwood - */ -$remoteye4_tmp = snmp_get_multi($device, ['upsIdentName.0', 'upsIdentAgentSoftwareVersion.0'], '-OQUs', 'UPS-MIB'); - -$hardware = $remoteye4_tmp[0]['upsIdentName']; -$version = str_replace('RemotEye4 ', '', $remoteye4_tmp[0]['upsIdentAgentSoftwareVersion']); diff --git a/includes/polling/os/ricoh.inc.php b/includes/polling/os/ricoh.inc.php deleted file mode 100644 index 10172afcb6..0000000000 --- a/includes/polling/os/ricoh.inc.php +++ /dev/null @@ -1,10 +0,0 @@ - - * Copyright (c) 2017 Cercel Valentin - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -use LibreNMS\RRD\RrdDefinition; - -$hardware = trim(snmp_get($device, '.1.3.6.1.4.1.17163.1.1.1.1.0', '-OQv'), '"'); -$serial = trim(snmp_get($device, '.1.3.6.1.4.1.17163.1.1.1.2.0', '-OQv'), '"'); -$version = trim(snmp_get($device, '.1.3.6.1.4.1.17163.1.1.1.3.0', '-OQv'), '"'); - -/* 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($device, $conn_array); - -$conn_half_open = $connections['.1.3.6.1.4.1.17163.1.1.5.2.3.0']; -$conn_half_closed = $connections['.1.3.6.1.4.1.17163.1.1.5.2.4.0']; -$conn_established = $connections['.1.3.6.1.4.1.17163.1.1.5.2.5.0']; -$conn_active = $connections['.1.3.6.1.4.1.17163.1.1.5.2.6.0']; -$conn_total = $connections['.1.3.6.1.4.1.17163.1.1.5.2.7.0']; - -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($device, 'riverbed_connections', $tags, $fields); - $os->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($device, $datastore_array); - -$datastore_hits = $datastore['.1.3.6.1.4.1.17163.1.1.5.4.1.0']; -$datastore_miss = $datastore['.1.3.6.1.4.1.17163.1.1.5.4.2.0']; - -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($device, 'riverbed_datastore', $tags, $fields); - $os->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($device, $optimization_array); - -$conn_optimized = $optimizations['.1.3.6.1.4.1.17163.1.1.5.2.1.0']; -$conn_passthrough = $optimizations['.1.3.6.1.4.1.17163.1.1.5.2.2.0']; - -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($device, 'riverbed_optimization', $tags, $fields); - $os->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($device, $bandwidth_array); - -$bw_in = $bandwidth['.1.3.6.1.4.1.17163.1.1.5.3.3.1.0']; -$bw_out = $bandwidth['.1.3.6.1.4.1.17163.1.1.5.3.3.2.0']; -$bw_total = $bandwidth['.1.3.6.1.4.1.17163.1.1.5.3.3.3.0']; - -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($device, 'riverbed_passthrough', $tags, $fields); - $os->enableGraph('riverbed_passthrough'); -} diff --git a/includes/polling/os/ros.inc.php b/includes/polling/os/ros.inc.php deleted file mode 100644 index a71bb37459..0000000000 --- a/includes/polling/os/ros.inc.php +++ /dev/null @@ -1,32 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Lorenzo Zafra - * @author Lorenzo Zafra - */ -preg_match('~(?\'hardware\'.*?)-(?:.*)~', $device['sysDescr'], $matches); - -if ($matches['hardware']) { - $hardware = $matches['hardware']; -} - -$version = trim(snmp_get($device, '.1.3.6.1.4.1.15004.4.2.3.3.0', '-Ovq'), '"'); -$serial = trim(snmp_get($device, '.1.3.6.1.4.1.15004.4.2.3.1.0', '-Ovq'), '"'); diff --git a/includes/polling/os/ruckuswireless.inc.php b/includes/polling/os/ruckuswireless.inc.php deleted file mode 100644 index 3dca656c0e..0000000000 --- a/includes/polling/os/ruckuswireless.inc.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * Updates by Paul Gear: - * Copyright (c) 2015 Gear Consulting Pty Ltd - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -$ruckus_data = snmp_get_multi_oid($device, ['.1.3.6.1.4.1.25053.1.2.1.1.1.1.18.0', '.1.3.6.1.4.1.25053.1.2.1.1.1.1.15.0', '.1.3.6.1.4.1.25053.1.2.1.1.1.1.12.0', '.1.3.6.1.4.1.25053.1.2.1.1.1.1.9.0', '.1.3.6.1.4.1.25053.1.2.1.1.1.1.20.0', '.1.3.6.1.4.1.25053.1.2.1.1.1.15.15.0']); - -$version = $ruckus_data['.1.3.6.1.4.1.25053.1.2.1.1.1.1.18.0']; -$serial = $ruckus_data['.1.3.6.1.4.1.25053.1.2.1.1.1.1.15.0']; -$features = 'Licenses: ' . $ruckus_data['.1.3.6.1.4.1.25053.1.2.1.1.1.15.15.0'] . '/' . $ruckus_data['.1.3.6.1.4.1.25053.1.2.1.1.1.1.12.0']; -$hardware = $ruckus_data['.1.3.6.1.4.1.25053.1.2.1.1.1.1.9.0']; -$ruckuscountry = $ruckus_data['.1.3.6.1.4.1.25053.1.2.1.1.1.1.20.0']; - -if (isset($ruckuscountry) && $ruckuscountry != '') { - $version .= " ($ruckuscountry)"; -} diff --git a/includes/polling/os/samsungprinter.inc.php b/includes/polling/os/samsungprinter.inc.php deleted file mode 100644 index 1a4404627a..0000000000 --- a/includes/polling/os/samsungprinter.inc.php +++ /dev/null @@ -1,5 +0,0 @@ - RrdDefinition::make()->addDataset('requests', 'GAUGE', 0), - ]; - $fields = [ - 'requests' => $sgos[0]['sgProxyHttpClientRequestRate'], - ]; - - data_update($device, 'sgos_average_requests', $tags, $fields); - - $os->enableGraph('sgos_average_requests'); - echo ' HTTP Req Rate'; -} - -if (is_numeric($sgos[0]['sgProxyHttpClientConnections'])) { - $tags = [ - 'rrd_def' => RrdDefinition::make()->addDataset('client_conn', 'GAUGE', 0), - ]; - $fields = [ - 'client_conn' => $sgos[0]['sgProxyHttpClientConnections'], - ]; - - data_update($device, 'sgos_client_connections', $tags, $fields); - - $os->enableGraph('sgos_client_connections'); - echo ' Client Conn'; -} - -if (is_numeric($sgos[0]['sgProxyHttpServerConnections'])) { - $tags = [ - 'rrd_def' => RrdDefinition::make()->addDataset('server_conn', 'GAUGE', 0), - ]; - $fields = [ - 'server_conn' => $sgos[0]['sgProxyHttpServerConnections'], - ]; - - data_update($device, 'sgos_server_connections', $tags, $fields); - - $os->enableGraph('sgos_server_connections'); - echo ' Server Conn'; -} - -if (is_numeric($sgos[0]['sgProxyHttpClientConnectionsActive'])) { - $tags = [ - 'rrd_def' => RrdDefinition::make()->addDataset('client_conn_active', 'GAUGE', 0), - ]; - $fields = [ - 'client_conn_active' => $sgos[0]['sgProxyHttpClientConnectionsActive'], - ]; - - data_update($device, 'sgos_client_connections_active', $tags, $fields); - - $os->enableGraph('sgos_client_connections_active'); - echo ' Client Conn Active'; -} - -if (is_numeric($sgos[0]['sgProxyHttpServerConnectionsActive'])) { - $tags = [ - 'rrd_def' => RrdDefinition::make()->addDataset('server_conn_active', 'GAUGE', 0), - ]; - $fields = [ - 'server_conn_active' => $sgos[0]['sgProxyHttpServerConnectionsActive'], - ]; - - data_update($device, 'sgos_server_connections_active', $tags, $fields); - - $os->enableGraph('sgos_server_connections_active'); - echo ' Server Conn Active'; -} - -if (is_numeric($sgos[0]['sgProxyHttpClientConnectionsIdle'])) { - $tags = [ - 'rrd_def' => RrdDefinition::make()->addDataset('client_idle', 'GAUGE', 0), - ]; - $fields = [ - 'client_idle' => $sgos[0]['sgProxyHttpClientConnectionsIdle'], - ]; - - data_update($device, 'sgos_client_connections_idle', $tags, $fields); - - $os->enableGraph('sgos_client_connections_idle'); - echo ' Client Conne Idle'; -} - -if (is_numeric($sgos[0]['sgProxyHttpServerConnectionsIdle'])) { - $tags = [ - 'rrd_def' => RrdDefinition::make()->addDataset('server_idle', 'GAUGE', 0), - ]; - $fields = [ - 'server_idle' => $sgos[0]['sgProxyHttpServerConnectionsIdle'], - ]; - - data_update($device, 'sgos_server_connections_idle', $tags, $fields); - - $os->enableGraph('sgos_server_connections_idle'); - echo ' Server Conn Idle'; -} diff --git a/includes/polling/os/sinetica.inc.php b/includes/polling/os/sinetica.inc.php deleted file mode 100644 index 33fd587b19..0000000000 --- a/includes/polling/os/sinetica.inc.php +++ /dev/null @@ -1,31 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2016 Neil Lathwood - * @author Neil Lathwood - */ - -// Sinetica UPSController. Versions: App. 6.04.03, OS 6.3, Btldr 1.06.09, H/w ZBBNC2 Rev 1.01.06 - -[$os_temp, $os_ver, $btldr, $hardware_temp] = explode(', ', $device['sysDescr']); - -[$ignore, $version] = explode('App. ', $os_temp); -$hardware = preg_replace('/H\/w /', '', $hardware_temp); diff --git a/includes/polling/os/smartos.inc.php b/includes/polling/os/smartos.inc.php deleted file mode 100644 index 9ba3a9a24a..0000000000 --- a/includes/polling/os/smartos.inc.php +++ /dev/null @@ -1,31 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Neil Lathwood - * @author Neil Lathwood - */ - -//SmartOptics, M-Series M-1601-D1000C1 R2A, SmartOS v2.4.14 (Compiled on Thu Jun 2 14:21:33 CEST 2016) - -[, $hardware, $version] = explode(',', $device['sysDescr']); - -$hardware = str_replace('M-Series ', '', $hardware); -[,,$version,] = explode(' ', $version); diff --git a/includes/polling/os/speedtouch.inc.php b/includes/polling/os/speedtouch.inc.php deleted file mode 100644 index 768bf867c5..0000000000 --- a/includes/polling/os/speedtouch.inc.php +++ /dev/null @@ -1,15 +0,0 @@ - $oid) { - if (isset($data[$serialnum]['raidlistSerialNumber']) && $data[$serialnum]['raidlistSerialNumber'] != '') { - $serial = $data[$serialnum]['raidlistSerialNumber']; - } - - if (isset($data[$serialnum]['raidlistDKCProductName']) && $data[$serialnum]['raidlistDKCProductName'] != '') { - $hardware = $data[$serialnum]['raidlistDKCProductName']; - } - - if (isset($data[$serialnum]['raidlistDKCMainVersion']) && $data[$serialnum]['raidlistDKCMainVersion'] != '') { - $version = $data[$serialnum]['raidlistDKCMainVersion']; - } -} diff --git a/includes/polling/os/symbol.inc.php b/includes/polling/os/symbol.inc.php deleted file mode 100644 index ed491efdd6..0000000000 --- a/includes/polling/os/symbol.inc.php +++ /dev/null @@ -1,8 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Thomas GAGNIERE - * @author Thomas GAGNIERE - */ -$hardware = $device['sysDescr']; diff --git a/includes/polling/os/tomato.inc.php b/includes/polling/os/tomato.inc.php deleted file mode 100644 index 03f007fc11..0000000000 --- a/includes/polling/os/tomato.inc.php +++ /dev/null @@ -1,27 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2016 Neil Lathwood - * @author Neil Lathwood - */ -[$ignore, $version] = explode(' ', trim(snmp_get($device, '.1.3.6.1.4.1.2021.7890.1.101.1', '-Osqnv'), '"')); - -unset($ignore); diff --git a/includes/polling/os/tpdin.inc.php b/includes/polling/os/tpdin.inc.php deleted file mode 100644 index a3a88db93c..0000000000 --- a/includes/polling/os/tpdin.inc.php +++ /dev/null @@ -1,30 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Neil Lathwood - * @author Neil Lathwood - */ -$tycon_data = snmp_get_multi_oid($device, ['name.0', 'version.0'], '-OUQs', 'TPDIN2-MIB'); - -$hardware = $tycon_data['name.0']; -$version = $tycon_data['version.0']; - -unset($tycon_data); diff --git a/includes/polling/os/tranzeo.inc.php b/includes/polling/os/tranzeo.inc.php deleted file mode 100644 index d3a8e79fb8..0000000000 --- a/includes/polling/os/tranzeo.inc.php +++ /dev/null @@ -1,13 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -use LibreNMS\RRD\RrdDefinition; - -$oids = ['entPhysicalContainedIn.1', 'entPhysicalSoftwareRev.1', 'entPhysicalSerialNum.1', 'entPhysicalModelName.1']; -$data = snmp_get_multi($device, $oids, '-OQUs', 'ENTITY-MIB'); -if ($data[1]['entPhysicalContainedIn'] == '0') { - if (! empty($data[1]['entPhysicalSoftwareRev'])) { - $version = $data[1]['entPhysicalSoftwareRev']; - } - if (! empty($data[1]['entPhysicalModelName'])) { - $hardware = $data[1]['entPhysicalModelName']; - } - if (! empty($data[1]['entPhysicalSerialNum'])) { - $serial = $data[1]['entPhysicalSerialNum']; - } -} - -$connections = snmp_get($device, 'CISCO-WAN-OPTIMIZATION-MIB::cwoTfoStatsActiveOptConn.0', '-OQv'); - -if (is_numeric($connections)) { - $rrd_def = RrdDefinition::make()->addDataset('connections', 'GAUGE', 0); - - $fields = [ - 'connections' => $connections, - ]; - - $tags = compact('rrd_def'); - data_update($device, 'waas_cwotfostatsactiveoptconn', $tags, $fields); - $os->enableGraph('waas_cwotfostatsactiveoptconn'); -} diff --git a/includes/polling/os/webpower.inc.php b/includes/polling/os/webpower.inc.php deleted file mode 100644 index ddf5278130..0000000000 --- a/includes/polling/os/webpower.inc.php +++ /dev/null @@ -1,17 +0,0 @@ - - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -$data = str_replace('"', '', snmp_get($device, '1.3.6.1.2.1.33.1.1.4.0', '-Ovq')); -preg_match_all('/^WebPower Pro II Card|v[0-9]+.[0-9]+|(SN [0-9]+)/', $data, $matches); -$hardware = $matches[0][0]; -$version = $matches[0][1]; -$serial = $matches[0][2]; diff --git a/includes/polling/os/websensor.inc.php b/includes/polling/os/websensor.inc.php deleted file mode 100644 index 5f0f7863a8..0000000000 --- a/includes/polling/os/websensor.inc.php +++ /dev/null @@ -1,25 +0,0 @@ -. - * - * @link https://www.librenms.org - * - * @copyright 2017 Neil Lathwood - * @author Neil Lathwood - */ -$serial = snmp_get($device, 'serialNumber.0', '-OevTQUs', 'T3610-MIB'); diff --git a/includes/polling/os/wipipe.inc.php b/includes/polling/os/wipipe.inc.php deleted file mode 100644 index 1475ef5663..0000000000 --- a/includes/polling/os/wipipe.inc.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -// Rip hardware and firmware version from sysDescr string -- example: Cradlepoint CBA850, Firmware Version 6.2.0.dd92f49 -preg_match('/(.*) ([\w\d]+), (.*) ([\w\d\.]+)/', $device['sysDescr'], $wipipe_data); -$hardware = $wipipe_data[2]; -$version = $wipipe_data[4]; diff --git a/includes/polling/os/xirrus_aos.inc.php b/includes/polling/os/xirrus_aos.inc.php deleted file mode 100644 index fd39665ff4..0000000000 --- a/includes/polling/os/xirrus_aos.inc.php +++ /dev/null @@ -1,3 +0,0 @@ -= 1) { - $hardware = 'ZXDSL ' . $sysObjectIdSplit[0]; - if (count($sysObjectIdSplit) >= 2) { - for ($i = 1; $i < count($sysObjectIdSplit); $i++) { - $hardware .= chr(64 + $sysObjectIdSplit[$i]); - } - } - } - unset($matches); - unset($sysObjectId); - unset($sysObjectIdSplit); -} diff --git a/includes/polling/os/zxr10.inc.php b/includes/polling/os/zxr10.inc.php deleted file mode 100644 index 3ce745b775..0000000000 --- a/includes/polling/os/zxr10.inc.php +++ /dev/null @@ -1,7 +0,0 @@ - $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($device, $measurement, $tags, $fields); - } - $os->enableGraph('xirrus_stations'); -} - -// cleanup -unset($rrd_def, $associations, $tags, $fields, $measurement); diff --git a/includes/rewrites.php b/includes/rewrites.php index 33e0780807..61adfe5e95 100644 --- a/includes/rewrites.php +++ b/includes/rewrites.php @@ -121,26 +121,6 @@ function makeshortif($if) return $if; } -function rewrite_junose_hardware($hardware) -{ - $rewrite_junose_hardware = [ - '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; -} - function rewrite_generic_hardware($hardware) { $rewrite_GenericHW = [ diff --git a/includes/snmp.inc.php b/includes/snmp.inc.php index 57d599d2a6..11f6c5461c 100644 --- a/includes/snmp.inc.php +++ b/includes/snmp.inc.php @@ -196,6 +196,14 @@ function snmp_get_multi($device, $oids, $options = '-OQUs', $mib = null, $mibdir $data = trim(external_exec($cmd)); foreach (explode("\n", $data) as $entry) { + if (! Str::contains($entry, ' =')) { + if (! empty($entry) && isset($index, $oid)) { + $array[$index][$oid] .= "\n$entry"; + } + + continue; + } + [$oid,$value] = explode('=', $entry, 2); $oid = trim($oid); $value = trim($value, "\" \n\r"); @@ -347,7 +355,7 @@ function snmp_getnext_multi($device, $oids, $options = '-OQUs', $mib = null, $mi [$oid,$value] = explode('=', $entry, 2); $oid = trim($oid); $value = trim($value, "\" \n\r"); - [$oid, $index] = explode('.', $oid, 2); + $oid = explode('.', $oid, 2)[0] ?? null; if (! Str::contains($value, 'at this OID')) { if (empty($oid)) { continue; // no index or oid @@ -475,8 +483,11 @@ function snmpwalk_cache_oid($device, $oid, $array, $mib = null, $mibdir = null, { $data = snmp_walk($device, $oid, $snmpflags, $mib, $mibdir); foreach (explode("\n", $data) as $entry) { - if (! Str::contains($entry, ' =') && ! empty($entry) && isset($index, $oid)) { - $array[$index][$oid] .= "\n$entry"; + if (! Str::contains($entry, ' =')) { + if (! empty($entry) && isset($index, $oid)) { + $array[$index][$oid] .= "\n$entry"; + } + continue; } @@ -555,23 +566,34 @@ function snmpwalk_cache_multi_oid($device, $oid, $array, $mib = null, $mibdir = { global $cache; - if (! (is_array($cache['snmp'][$device['device_id']]) && array_key_exists($oid, $cache['snmp'][$device['device_id']]))) { + if (! (is_array($cache['snmp'][$device['device_id']] ?? null) && array_key_exists($oid, $cache['snmp'][$device['device_id']]))) { $data = snmp_walk($device, $oid, $snmpflags, $mib, $mibdir); - foreach (explode("\n", $data) as $entry) { - [$r_oid,$value] = explode('=', $entry, 2); - $r_oid = trim($r_oid); - $value = trim($value); - $oid_parts = explode('.', $r_oid); - $r_oid = array_shift($oid_parts); - $index = array_shift($oid_parts); - foreach ($oid_parts as $tmp_oid) { - $index .= '.' . $tmp_oid; - } - if (! strstr($value, 'at this OID') && isset($r_oid) && isset($index)) { - $array[$index][$r_oid] = $value; - } - }//end foreach + if ($data) { + foreach (explode("\n", $data) as $entry) { + if (! Str::contains($entry, ' =')) { + if (! empty($entry) && isset($index, $r_oid)) { + $array[$index][$r_oid] .= "\n$entry"; // multi-line value, append to previous entry + } + + continue; + } + + [$r_oid,$value] = explode('=', $entry, 2); + $r_oid = trim($r_oid); + $value = trim($value); + $oid_parts = explode('.', $r_oid); + $r_oid = array_shift($oid_parts); + $index = array_shift($oid_parts); + foreach ($oid_parts as $tmp_oid) { + $index .= '.' . $tmp_oid; + } + + if (! strstr($value, 'at this OID') && isset($r_oid) && isset($index)) { + $array[$index][$r_oid] = $value; + } + }//end foreach + } $cache['snmp'][$device['device_id']][$oid] = $array; }//end if @@ -695,12 +717,21 @@ function snmpwalk_cache_twopart_oid($device, $oid, $array, $mib = 0, $mibdir = n $data = trim(external_exec($cmd)); foreach (explode("\n", $data) as $entry) { + if (! Str::contains($entry, ' =')) { + if (! empty($entry) && isset($first, $second, $oid)) { + $array[$first][$second][$oid] .= "\n$entry"; // multi-line value, append to previous entry + } + + continue; + } + [$oid,$value] = explode('=', $entry, 2); $oid = trim($oid); $value = trim($value); $value = str_replace('"', '', $value); - [$oid, $first, $second] = explode('.', $oid); - if (! strstr($value, 'at this OID') && isset($oid) && isset($first) && isset($second)) { + $parts = explode('.', $oid); + if (! strstr($value, 'at this OID') && count($parts) >= 3) { + [$oid, $first, $second] = $parts; $array[$first][$second][$oid] = $value; } } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 9bd99048dd..ec0e883178 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -3475,11 +3475,6 @@ parameters: count: 1 path: LibreNMS/Interfaces/Polling/MplsPolling.php - - - message: "#^Method LibreNMS\\\\Interfaces\\\\Polling\\\\OSPolling\\:\\:pollOS\\(\\) has no return type specified\\.$#" - count: 1 - path: LibreNMS/Interfaces/Polling/OSPolling.php - - message: "#^Method LibreNMS\\\\Interfaces\\\\Polling\\\\PollerModule\\:\\:poll\\(\\) has no return type specified\\.$#" count: 1 @@ -4105,16 +4100,6 @@ parameters: count: 1 path: LibreNMS/OS/AsuswrtMerlin.php - - - message: "#^Method LibreNMS\\\\OS\\\\Barracudangfirewall\\:\\:pollOS\\(\\) has no return type specified\\.$#" - count: 1 - path: LibreNMS/OS/Barracudangfirewall.php - - - - message: "#^Expression on left side of \\?\\? is not nullable\\.$#" - count: 1 - path: LibreNMS/OS/Boss.php - - message: "#^Method LibreNMS\\\\OS\\\\Ceraos\\:\\:fetchHardware\\(\\) has no return type specified\\.$#" count: 1 @@ -4135,11 +4120,6 @@ parameters: count: 1 path: LibreNMS/OS/Comware.php - - - message: "#^Method LibreNMS\\\\OS\\\\Coriant\\:\\:pollOS\\(\\) has no return type specified\\.$#" - count: 1 - path: LibreNMS/OS/Coriant.php - - message: "#^Method LibreNMS\\\\OS\\\\Dnos\\:\\:findProcessors\\(\\) has no return type specified\\.$#" count: 1 @@ -4160,26 +4140,11 @@ parameters: count: 1 path: LibreNMS/OS/Fabos.php - - - message: "#^Method LibreNMS\\\\OS\\\\Fortigate\\:\\:pollOS\\(\\) has no return type specified\\.$#" - count: 1 - path: LibreNMS/OS/Fortigate.php - - - - message: "#^Method LibreNMS\\\\OS\\\\Fortios\\:\\:pollOS\\(\\) has no return type specified\\.$#" - count: 1 - path: LibreNMS/OS/Fortios.php - - message: "#^Method LibreNMS\\\\OS\\\\Ftos\\:\\:getHardware\\(\\) has no return type specified\\.$#" count: 1 path: LibreNMS/OS/Ftos.php - - - message: "#^Method LibreNMS\\\\OS\\\\Gaia\\:\\:pollOS\\(\\) has no return type specified\\.$#" - count: 1 - path: LibreNMS/OS/Gaia.php - - message: "#^Parameter \\#8 \\$multiplier of class LibreNMS\\\\Device\\\\WirelessSensor constructor expects int, null given\\.$#" count: 3 @@ -4245,11 +4210,6 @@ parameters: count: 1 path: LibreNMS/OS/Junos.php - - - message: "#^Method LibreNMS\\\\OS\\\\Junos\\:\\:pollOS\\(\\) has no return type specified\\.$#" - count: 1 - path: LibreNMS/OS/Junos.php - - message: "#^Method LibreNMS\\\\OS\\\\Junos\\:\\:pollSlas\\(\\) has no return type specified\\.$#" count: 1 @@ -4275,21 +4235,6 @@ parameters: count: 1 path: LibreNMS/OS/Mimosa.php - - - message: "#^Method LibreNMS\\\\OS\\\\Netscaler\\:\\:pollOS\\(\\) has no return type specified\\.$#" - count: 1 - path: LibreNMS/OS/Netscaler.php - - - - message: "#^Method LibreNMS\\\\OS\\\\Nios\\:\\:pollOS\\(\\) has no return type specified\\.$#" - count: 1 - path: LibreNMS/OS/Nios.php - - - - message: "#^Method LibreNMS\\\\OS\\\\Openbsd\\:\\:pollOS\\(\\) has no return type specified\\.$#" - count: 1 - path: LibreNMS/OS/Openbsd.php - - message: "#^Method LibreNMS\\\\OS\\\\Openwrt\\:\\:getSensorData\\(\\) has parameter \\$query with no type specified\\.$#" count: 1 @@ -4350,61 +4295,16 @@ parameters: count: 1 path: LibreNMS/OS/Panos.php - - - message: "#^Method LibreNMS\\\\OS\\\\Panos\\:\\:pollOS\\(\\) has no return type specified\\.$#" - count: 1 - path: LibreNMS/OS/Panos.php - - message: "#^Property LibreNMS\\\\OS\\\\Panos\\:\\:\\$validNetBufferMemory has no type specified\\.$#" count: 1 path: LibreNMS/OS/Panos.php - - - message: "#^Method LibreNMS\\\\OS\\\\Pfsense\\:\\:pollOS\\(\\) has no return type specified\\.$#" - count: 1 - path: LibreNMS/OS/Pfsense.php - - message: "#^Method LibreNMS\\\\OS\\\\Pmp\\:\\:freqDivisor\\(\\) has no return type specified\\.$#" count: 1 path: LibreNMS/OS/Pmp.php - - - message: "#^Method LibreNMS\\\\OS\\\\Pmp\\:\\:pollOS\\(\\) has no return type specified\\.$#" - count: 1 - path: LibreNMS/OS/Pmp.php - - - - message: "#^Method LibreNMS\\\\OS\\\\Procurve\\:\\:pollOS\\(\\) has no return type specified\\.$#" - count: 1 - path: LibreNMS/OS/Procurve.php - - - - message: "#^Method LibreNMS\\\\OS\\\\Pulse\\:\\:pollOS\\(\\) has no return type specified\\.$#" - count: 1 - path: LibreNMS/OS/Pulse.php - - - - message: "#^Method LibreNMS\\\\OS\\\\Routeros\\:\\:pollOS\\(\\) has no return type specified\\.$#" - count: 1 - path: LibreNMS/OS/Routeros.php - - - - message: "#^Method LibreNMS\\\\OS\\\\Rutos2xx\\:\\:pollOS\\(\\) has no return type specified\\.$#" - count: 1 - path: LibreNMS/OS/Rutos2xx.php - - - - message: "#^Method LibreNMS\\\\OS\\\\Screenos\\:\\:pollOS\\(\\) has no return type specified\\.$#" - count: 1 - path: LibreNMS/OS/Screenos.php - - - - message: "#^Method LibreNMS\\\\OS\\\\Secureplatform\\:\\:pollOS\\(\\) has no return type specified\\.$#" - count: 1 - path: LibreNMS/OS/Secureplatform.php - - message: "#^If condition is always false\\.$#" count: 1 @@ -4765,11 +4665,6 @@ parameters: count: 2 path: LibreNMS/OS/SmOs.php - - - message: "#^Method LibreNMS\\\\OS\\\\Sonicwall\\:\\:pollOS\\(\\) has no return type specified\\.$#" - count: 1 - path: LibreNMS/OS/Sonicwall.php - - message: "#^Offset 'sonicCurrentConnCac…' does not exist on string\\.$#" count: 1 @@ -4830,16 +4725,6 @@ parameters: count: 2 path: LibreNMS/OS/Timos.php - - - message: "#^Expression on left side of \\?\\? is not nullable\\.$#" - count: 2 - path: LibreNMS/OS/Topvision.php - - - - message: "#^Method LibreNMS\\\\OS\\\\Topvision\\:\\:pollOS\\(\\) has no return type specified\\.$#" - count: 1 - path: LibreNMS/OS/Topvision.php - - message: "#^Property LibreNMS\\\\OS\\\\Unifi\\:\\:\\$ccqDivisor has no type specified\\.$#" count: 1 @@ -4860,11 +4745,6 @@ parameters: count: 1 path: LibreNMS/OS/Vrp.php - - - message: "#^Method LibreNMS\\\\OS\\\\Vrp\\:\\:pollOS\\(\\) has no return type specified\\.$#" - count: 1 - path: LibreNMS/OS/Vrp.php - - message: "#^Method LibreNMS\\\\OS\\\\Vrp\\:\\:pollSlas\\(\\) has no return type specified\\.$#" count: 1 @@ -4965,11 +4845,6 @@ parameters: count: 1 path: LibreNMS/OS/Zxdsl.php - - - message: "#^Method LibreNMS\\\\OS\\\\Zywall\\:\\:pollOS\\(\\) has no return type specified\\.$#" - count: 1 - path: LibreNMS/OS/Zywall.php - - message: "#^Property LibreNMS\\\\ObjectCache\\:\\:\\$data has no type specified\\.$#" count: 1 diff --git a/tests/Mocks/SnmpQueryMock.php b/tests/Mocks/SnmpQueryMock.php index ce734e45cd..3af1196f3b 100644 --- a/tests/Mocks/SnmpQueryMock.php +++ b/tests/Mocks/SnmpQueryMock.php @@ -28,6 +28,7 @@ namespace LibreNMS\Tests\Mocks; use App\Models\Device; use DeviceCache; use Exception; +use Illuminate\Support\Arr; use Illuminate\Support\Str; use LibreNMS\Data\Source\NetSnmpQuery; use LibreNMS\Data\Source\SnmpQueryInterface; @@ -142,7 +143,7 @@ class SnmpQueryMock implements SnmpQueryInterface public function options($options = []): SnmpQueryInterface { - $this->options = $options; + $this->options = $options === null ? [] : Arr::wrap($options); return $this; } diff --git a/tests/data/axiscam_q6055-e.json b/tests/data/axiscam_q6055-e.json index 1f516978a0..cb7c237b88 100644 --- a/tests/data/axiscam_q6055-e.json +++ b/tests/data/axiscam_q6055-e.json @@ -3,7 +3,7 @@ "discovery": { "devices": [ { - "sysName": "", + "sysName": null, "sysObjectID": ".1.3.6.1.4.1.368.1.1", "sysDescr": "; AXIS Q6055-E; PTZ Dome Network Camera; 7.40.1; Nov 29 2017 18:51; 725.2; 1;", "sysContact": null, diff --git a/tests/data/bluecatnetworks.json b/tests/data/bluecatnetworks.json index 6d22603854..85da560b14 100644 --- a/tests/data/bluecatnetworks.json +++ b/tests/data/bluecatnetworks.json @@ -7,12 +7,12 @@ "sysObjectID": ".1.3.6.1.4.1.13315.2.1", "sysDescr": "labbdds01", "sysContact": "", - "version": null, - "hardware": null, + "version": "8.3.2-091.GA.bcn", + "hardware": "VMware", "features": null, "os": "bluecatnetworks", "type": "appliance", - "serial": null, + "serial": "Unknown", "icon": "bcn.png", "location": "" } diff --git a/tests/data/datacom.json b/tests/data/datacom.json index 9f2cd3df6b..ed4c900c69 100644 --- a/tests/data/datacom.json +++ b/tests/data/datacom.json @@ -23,7 +23,7 @@ { "sysName": "", "sysObjectID": ".1.3.6.1.4.1.3709", - "sysDescr": null, + "sysDescr": "", "sysContact": null, "version": null, "hardware": null, @@ -36,23 +36,6 @@ } ] }, - "poller": { - "devices": [ - { - "sysName": "", - "sysObjectID": ".1.3.6.1.4.1.3709", - "sysDescr": null, - "sysContact": null, - "version": null, - "hardware": "Datacom ", - "features": null, - "os": "datacom", - "type": "network", - "serial": null, - "icon": "datacom.png", - "location": null - } - ] - } + "poller": "matches discovery" } } diff --git a/tests/data/dell-powervault.json b/tests/data/dell-powervault.json index 2f05cb9cec..c526e1414a 100644 --- a/tests/data/dell-powervault.json +++ b/tests/data/dell-powervault.json @@ -1,24 +1,6 @@ { "os": { "discovery": { - "devices": [ - { - "sysName": "", - "sysObjectID": ".1.3.6.1.4.1.674.10893.2.31", - "sysDescr": "DELL MD38xxi 0123", - "sysContact": "", - "version": null, - "hardware": null, - "features": null, - "os": "dell-powervault", - "type": "storage", - "serial": null, - "icon": "dell.svg", - "location": "" - } - ] - }, - "poller": { "devices": [ { "sysName": "", @@ -35,6 +17,7 @@ "location": "" } ] - } + }, + "poller": "matches discovery" } } diff --git a/tests/data/epmp.json b/tests/data/epmp.json index b5ec55e6aa..3bc3f2283f 100644 --- a/tests/data/epmp.json +++ b/tests/data/epmp.json @@ -19,24 +19,6 @@ }, "os": { "discovery": { - "devices": [ - { - "sysName": "", - "sysObjectID": ".1.3.6.1.4.1.17713.21", - "sysDescr": "Cambium ePMP", - "sysContact": "", - "version": "4.5.6", - "hardware": null, - "features": null, - "os": "epmp", - "type": "wireless", - "serial": "E2NF3572D8XT", - "icon": "cambium.svg", - "location": "" - } - ] - }, - "poller": { "devices": [ { "sysName": "", @@ -53,7 +35,8 @@ "location": "" } ] - } + }, + "poller": "matches discovery" }, "ports": { "discovery": { diff --git a/tests/data/ftos.json b/tests/data/ftos.json index dd8c046443..9d4a7a4904 100644 --- a/tests/data/ftos.json +++ b/tests/data/ftos.json @@ -21,7 +21,7 @@ "discovery": { "devices": [ { - "sysName": "", + "sysName": null, "sysObjectID": ".1.3.6.1.4.1.6027.1.3.4", "sysDescr": "Force10 Networks Real Time Operating System Software.Force10 Operating System Version: 1.0.Force10 Application Software Version: 8.4.2.5.Copyright (c) 1999-2010 by Force10 Networks, Inc.", "sysContact": null, diff --git a/tests/data/junose.json b/tests/data/junose.json index 8327ba8edd..f1b376eea1 100644 --- a/tests/data/junose.json +++ b/tests/data/junose.json @@ -22,11 +22,11 @@ "devices": [ { "sysName": "", - "sysObjectID": ".1.3.6.1.4.1.4874", + "sysObjectID": ".1.3.6.1.4.1.4874.1.1.1.1.1", "sysDescr": null, "sysContact": null, "version": null, - "hardware": null, + "hardware": "Juniper ERX-1400", "features": null, "os": "junose", "type": "network", @@ -36,23 +36,6 @@ } ] }, - "poller": { - "devices": [ - { - "sysName": "", - "sysObjectID": ".1.3.6.1.4.1.4874", - "sysDescr": null, - "sysContact": null, - "version": null, - "hardware": "Juniper juniperUni", - "features": null, - "os": "junose", - "type": "network", - "serial": null, - "icon": "junos.png", - "location": null - } - ] - } + "poller": "matches discovery" } } diff --git a/tests/data/netagent2.json b/tests/data/netagent2.json index fbf1280973..6386e66903 100644 --- a/tests/data/netagent2.json +++ b/tests/data/netagent2.json @@ -7,7 +7,7 @@ "sysObjectID": ".1.3.6.1.4.1.935", "sysDescr": "NET Agent II", "sysContact": "", - "version": null, + "version": "2.48.DP520.WEST", "hardware": null, "features": null, "os": "netagent2", diff --git a/tests/data/netagent2_1.json b/tests/data/netagent2_1.json index b139ed29c2..bccf005f44 100644 --- a/tests/data/netagent2_1.json +++ b/tests/data/netagent2_1.json @@ -7,7 +7,7 @@ "sysObjectID": ".1.3.6.1.4.1.935.1.1.1", "sysDescr": "", "sysContact": "", - "version": null, + "version": "3.7.CY504", "hardware": null, "features": null, "os": "netagent2", diff --git a/tests/data/pbn.json b/tests/data/pbn.json index 471df3c8cd..fa15e50e6b 100644 --- a/tests/data/pbn.json +++ b/tests/data/pbn.json @@ -23,14 +23,14 @@ { "sysName": "", "sysObjectID": ".1.3.6.1.4.1.11606.25.1.219.0", - "sysDescr": "Pacific Broadband Networks Internetwork Operating System Software AOCM3924 Series Software, Version 2.1.0C Build 15419, RELEASE SOFTWARE Compiled: 2013-11-11 14:55:11 by SYS ROM: System Bootstrap, Version 0.4.3 Serial num:S00000000, ID num:00000000", + "sysDescr": "Pacific Broadband Networks Internetwork Operating System Software\r\nAOCM3948 Series Software, Version 2.1.0C Build 15419, RELEASE SOFTWARE\r\nCompiled: 2013-11-11 14:55:11 by SYS\r\nROM: System Bootstrap, Version 0.4.3\r\nSerial num:A00000000, ID num:11111111", "sysContact": null, - "version": null, - "hardware": null, + "version": "2.1.0C Build 15419", + "hardware": "AOCM3948", "features": null, "os": "pbn", "type": "network", - "serial": null, + "serial": "A00000000", "icon": "pbn.png", "location": null } diff --git a/tests/data/poweralert_2.json b/tests/data/poweralert_2.json index 201ab95809..d0f22b5282 100644 --- a/tests/data/poweralert_2.json +++ b/tests/data/poweralert_2.json @@ -3,7 +3,7 @@ "discovery": { "devices": [ { - "sysName": "poweralert-01234.local", + "sysName": "device 1", "sysObjectID": ".1.3.6.1.4.1.850.1", "sysDescr": "POWERALERT 12", "sysContact": null, @@ -18,24 +18,7 @@ } ] }, - "poller": { - "devices": [ - { - "sysName": "poweralert-01234.local", - "sysObjectID": ".1.3.6.1.4.1.850.1", - "sysDescr": "POWERALERT 12", - "sysContact": null, - "version": "12.06.0069", - "hardware": "SMART1500RMXL2UA", - "features": "Envirosense", - "os": "poweralert", - "type": "power", - "serial": "snmpcardserialnum", - "icon": "tripplite.svg", - "location": "location1" - } - ] - } + "poller": "matches discovery" }, "ports": { "discovery": { diff --git a/tests/data/ricoh_mpc3002.json b/tests/data/ricoh_mpc3002.json index 1a531fa108..c3bab195e9 100644 --- a/tests/data/ricoh_mpc3002.json +++ b/tests/data/ricoh_mpc3002.json @@ -1,24 +1,6 @@ { "os": { "discovery": { - "devices": [ - { - "sysName": "", - "sysObjectID": ".1.3.6.1.4.1.367.1.1", - "sysDescr": "RICOH Aficio MP C3002 2.20 / RICOH Network Printer C model / RICOH Network Scanner C model / RICOH Network Facsimile C model", - "sysContact": "", - "version": null, - "hardware": null, - "features": null, - "os": "ricoh", - "type": "printer", - "serial": "W492KB03439", - "icon": "ricoh.svg", - "location": "" - } - ] - }, - "poller": { "devices": [ { "sysName": "", @@ -35,7 +17,8 @@ "location": "" } ] - } + }, + "poller": "matches discovery" }, "ports": { "discovery": { diff --git a/tests/data/zxr10_5928.json b/tests/data/zxr10_5928.json index 4adc08bcc6..af421a859b 100644 --- a/tests/data/zxr10_5928.json +++ b/tests/data/zxr10_5928.json @@ -7,8 +7,8 @@ "sysObjectID": ".1.3.6.1.4.1.3902.3.100.20", "sysDescr": "ZXR10 ROS Version V4.08.23 ZXR10_5928 Software, Version ZXR10 5900 V2.8.23.A.19.P02 Copyright (c) 2000-2011 by ZTE Corporation Compiled Oct 12 2011, 11:04:37", "sysContact": "", - "version": null, - "hardware": null, + "version": "V2.8.23.A.19.P02", + "hardware": "5928", "features": null, "os": "zxr10", "type": "network", @@ -18,24 +18,7 @@ } ] }, - "poller": { - "devices": [ - { - "sysName": "", - "sysObjectID": ".1.3.6.1.4.1.3902.3.100.20", - "sysDescr": "ZXR10 ROS Version V4.08.23 ZXR10_5928 Software, Version ZXR10 5900 V2.8.23.A.19.P02 Copyright (c) 2000-2011 by ZTE Corporation Compiled Oct 12 2011, 11:04:37", - "sysContact": "", - "version": "ZXR10 ROS Version V4.08.23 ZXR10_5928 Software", - "hardware": "ZXR10_5928", - "features": null, - "os": "zxr10", - "type": "network", - "serial": null, - "icon": "zte.svg", - "location": "" - } - ] - } + "poller": "matches discovery" }, "ports": { "discovery": { diff --git a/tests/snmpsim/catos.snmprec b/tests/snmpsim/catos.snmprec index a7b9786df7..5afa72a1df 100644 --- a/tests/snmpsim/catos.snmprec +++ b/tests/snmpsim/catos.snmprec @@ -1 +1,2 @@ -1.3.6.1.2.1.1.1.0|4|Cisco Catalyst Operating System Software +1.3.6.1.2.1.1.1.0|4x|436973636F2053797374656D732057532D43363530362D450D0A436973636F20436174616C797374204F7065726174696E672053797374656D20536F6674776172652C2056657273696F6E20382E36283661290D0A436F707972696768742028632920313939352D3230303920627920436973636F2053797374656D73 +1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.9.5.44 diff --git a/tests/snmpsim/enlogic-pdu.snmprec b/tests/snmpsim/enlogic-pdu.snmprec index 33e8fc7525..14473fbbe4 100644 --- a/tests/snmpsim/enlogic-pdu.snmprec +++ b/tests/snmpsim/enlogic-pdu.snmprec @@ -1,2 +1,2 @@ 1.3.6.1.2.1.1.1.0|4|Enlogic PDU -1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.38446.1 \ No newline at end of file +1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.38446.1 diff --git a/tests/snmpsim/foundryos.snmprec b/tests/snmpsim/foundryos.snmprec index 720be87b0c..5b1581b746 100644 --- a/tests/snmpsim/foundryos.snmprec +++ b/tests/snmpsim/foundryos.snmprec @@ -1 +1,2 @@ -1.3.6.1.2.1.1.1.0|4|Foundry Networks +1.3.6.1.2.1.1.1.0|4|Foundry Networks, Inc. FWS648G-POE, IronWare Version 04.3.03T7e1 Compiled on Oct 29 2009 at 15:36:10 labeled as FGS04303 +1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.1991.1.3.52.2.4.1.1 diff --git a/tests/snmpsim/fujitsupyos.snmprec b/tests/snmpsim/fujitsupyos.snmprec index a42ced495f..26dab4e5f9 100644 --- a/tests/snmpsim/fujitsupyos.snmprec +++ b/tests/snmpsim/fujitsupyos.snmprec @@ -1 +1,2 @@ -1.3.6.1.2.1.1.1.0|4|Fujitsu PY CB Eth Switch +1.3.6.1.2.1.1.1.0|4|Fujitsu PY CB Eth Switch 1Gb 36/8 2, Runtime Code 6.76 +1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.231 diff --git a/tests/snmpsim/gestetner.snmprec b/tests/snmpsim/gestetner.snmprec index 7baa349be7..c974834f9d 100644 --- a/tests/snmpsim/gestetner.snmprec +++ b/tests/snmpsim/gestetner.snmprec @@ -1,3 +1,5 @@ 1.3.6.1.2.1.1.1.0|4|Gestetner MPC2500/DSc525 1.71 / Gestetner Network Printer C model / Gestetner Network Scanner C model 1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.367.1.1 - +1.3.6.1.4.1.367.3.2.1.1.1.1.0|4|Gestetner MPC2500/DSc525 +1.3.6.1.4.1.367.3.2.1.1.1.2.0|4|1.71 +1.3.6.1.4.1.367.3.2.1.2.1.4.0|4|M6394300657 diff --git a/tests/snmpsim/ict-psu.snmprec b/tests/snmpsim/ict-psu.snmprec index 748dc1befa..1f67d6b06b 100644 --- a/tests/snmpsim/ict-psu.snmprec +++ b/tests/snmpsim/ict-psu.snmprec @@ -1,2 +1,4 @@ 1.3.6.1.2.1.1.1.0|4|ICT Digital Series 1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.39145.11 +1.3.6.1.4.1.39145.11.1.0|4|ICT600-48 +1.3.6.1.4.1.39145.11.4.0|4|1.08 diff --git a/tests/snmpsim/junose.snmprec b/tests/snmpsim/junose.snmprec index 4d7137dceb..1658341ae7 100644 --- a/tests/snmpsim/junose.snmprec +++ b/tests/snmpsim/junose.snmprec @@ -1,4 +1,4 @@ -1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.4874 +1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.4874.1.1.1.1.1 1.3.6.1.4.1.4874.2.2.2.1.3.4.1.6.0.0|4|Valid Processor 1.3.6.1.4.1.4874.2.2.2.1.3.4.1.6.1.0|4|Invalid Processor 1.3.6.1.4.1.4874.2.2.2.1.3.4.1.12.0.0|2|4242 diff --git a/tests/snmpsim/kyocera.snmprec b/tests/snmpsim/kyocera.snmprec index 23d7404c81..c9ffdfd7d1 100644 --- a/tests/snmpsim/kyocera.snmprec +++ b/tests/snmpsim/kyocera.snmprec @@ -1,2 +1,5 @@ 1.3.6.1.2.1.1.1.0|4|KYOCERA Document Solutions Printing System 1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.1347.41 +1.3.6.1.4.1.1347.43.5.1.1.1.1|4|FS-1028MFP +1.3.6.1.4.1.1347.43.5.1.1.28.1|4|QUV9600664 +1.3.6.1.4.1.1347.43.5.4.1.5.1.1|4|2H9_2F00.002.002 diff --git a/tests/snmpsim/netapp.snmprec b/tests/snmpsim/netapp.snmprec index 4c7d520ebf..adb6faef6a 100644 --- a/tests/snmpsim/netapp.snmprec +++ b/tests/snmpsim/netapp.snmprec @@ -1,2 +1,3 @@ 1.3.6.1.2.1.1.1.0|4|NetApp Release 9.0: Fri Aug 19 11:04:54 UTC 2016 1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.789.2.5 +1.3.6.1.4.1.789.1.1.2.0|4|NetApp Release 8.1.2P3 7-Mode: Wed Feb 20 19:56:22 PST 2013 diff --git a/tests/snmpsim/pbn.snmprec b/tests/snmpsim/pbn.snmprec index 1b7ef3d357..0b7da192a4 100644 --- a/tests/snmpsim/pbn.snmprec +++ b/tests/snmpsim/pbn.snmprec @@ -1,4 +1,4 @@ -1.3.6.1.2.1.1.1.0|4|Pacific Broadband Networks Internetwork Operating System Software AOCM3924 Series Software, Version 2.1.0C Build 15419, RELEASE SOFTWARE Compiled: 2013-11-11 14:55:11 by SYS ROM: System Bootstrap, Version 0.4.3 Serial num:S00000000, ID num:00000000 +1.3.6.1.2.1.1.1.0|4x|506163696669632042726F616462616E64204E6574776F726B7320496E7465726E6574776F726B204F7065726174696E672053797374656D20536F6674776172650D0A414F434D333934382053657269657320536F6674776172652C2056657273696F6E20322E312E3043204275696C642031353431392C2052454C4541534520534F4654574152450D0A436F6D70696C65643A20323031332D31312D31312031343A35353A3131206279205359530D0A524F4D3A2053797374656D20426F6F7473747261702C2056657273696F6E20302E342E330D0A53657269616C206E756D3A4130303030303030302C204944206E756D3A3131313131313131 1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.11606.25.1.219.0 1.3.6.1.4.1.11606.10.9.109.1.1.1.1.5.1|2|42 1.3.6.1.4.1.11606.10.9.48.1.0|2|83 diff --git a/tests/snmpsim/ptp650.snmprec b/tests/snmpsim/ptp650.snmprec index cc7153f334..55208c22f2 100644 --- a/tests/snmpsim/ptp650.snmprec +++ b/tests/snmpsim/ptp650.snmprec @@ -1,2 +1,3 @@ 1.3.6.1.2.1.1.1.0|4|Cambium PTP 50650 PTP Wireless Ethernet Bridge, Version 50650-01-40 1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.17713.7 +1.3.6.1.4.1.17713.7.5.5.0|2|1 diff --git a/tests/snmpsim/samsungprinter_clx.snmprec b/tests/snmpsim/samsungprinter_clx.snmprec index e555781e7c..222c1967c5 100644 --- a/tests/snmpsim/samsungprinter_clx.snmprec +++ b/tests/snmpsim/samsungprinter_clx.snmprec @@ -1 +1 @@ -1.3.6.1.2.1.1.1.0|4|Samsung CLX +1.3.6.1.2.1.1.1.0|4|Samsung CLX-3170 Series;V1.00.01.64 Sep-27-2010;Engine 1.77.81;NIC V4.01.20(CLX-3170) 02-05-2010;S/N AAAAAAA000AAAA000