Convert OS discovery to new style (#12099)

* terra

* airos

* port cisco os polling
old wwan polling was broken and deprecated anyway

* enterasys

* Brother, a few changes

* AW Plus

* Fabos

* set expected test data

* 3com

* Adva FSP150

* advantech

* airos-af

* aix

* akcp

* allied

* allworx and missed mibs

* anyos

* fixup some zyxel shared stuffs
zywall graph polling

* aos

* apc

* apex

* apsoluteos

* fix copyrights

* arris

* arris

* aruba-instant

* ArubaOS

* Ascom

* asuswrt-merlin, ats

* audiocodes

* avocent

* avtech

* barracuda

* binox

* boss

* canonprinter

* cdata

* ceraos

* ciena-waveserver

* fix 3com

* fix airos

* fix brother yaml?

* fix aos more

* fix and improve apc

* fix arista test data

* yaml discovery (basic)

* cimc

* mib not used

* remove old discovery file

* ciscosat

* ciscosb fixes + improvements

* comware

* ctm

* cumulus

* cxr-ts

* cyberoam-utm

* cyberpower

* dahua-nvr

* dasan-nos

* datadomain

* dcn-software and fallback oids

* dd-wrt

* dell-laser

* d*

* e* and location

* forti, post processing, oid coalescing

* Freebsd array of sysDescr regex

* finish f*

* g*

* h*

* i* WIP

* i*

* Junos

* j*

* k*

* unix refactor previous to yaml more
inject $device

* fixes

* fixes

* l*

* m*

* n* ability to set other fields in regex
tnmsne polling to eloquent

* o*

* p*

* q* + bonus calix

* r*

* s* WIP

* s*

* t*

* u*

* v*
rework vrp to yaml (hybrid)

* w*

* x*

* z*

* a* easy no-data

* fixes

* style fixes

* missed ApexPlus

* fix signature

* Add missing location data

* rename getDevice functions

* add new cisco ftd data

* update docs

* revert sill snmp format

* fix snmp options

* update for new smartax test data

* rebase dsm

* fix voss
This commit is contained in:
Tony Murray 2020-09-18 08:12:07 -05:00 committed by GitHub
parent d2d1e18925
commit 941037e44e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1189 changed files with 137252 additions and 12921 deletions

View File

@ -26,7 +26,6 @@
namespace LibreNMS\Device;
use Illuminate\Support\Str;
use LibreNMS\Config;
use LibreNMS\Interfaces\Discovery\DiscoveryItem;
use LibreNMS\Interfaces\Discovery\DiscoveryModule;
use LibreNMS\Interfaces\Discovery\ProcessorDiscovery;
@ -192,7 +191,7 @@ class Processor extends Model implements DiscoveryModule, PollerModule, Discover
$rrd_name = array('processor', $processor_type, $processor_index);
$fields = compact('usage');
$tags = compact('processor_type', 'processor_index', 'rrd_name', 'rrd_def');
data_update($os->getDevice(), 'processors', $tags, $fields);
data_update($os->getDeviceArray(), 'processors', $tags, $fields);
if ($usage != $processor_usage) {
dbUpdate(array('processor_usage' => $usage), 'processors', '`processor_id` = ?', array($processor_id));
@ -211,8 +210,8 @@ class Processor extends Model implements DiscoveryModule, PollerModule, Discover
// don't fetch too many at a time TODO build into snmp_get_multi_oid?
$snmp_data = array();
foreach (array_chunk($oids, get_device_oid_limit($os->getDevice())) as $oid_chunk) {
$multi_data = snmp_get_multi_oid($os->getDevice(), $oid_chunk);
foreach (array_chunk($oids, get_device_oid_limit($os->getDeviceArray())) as $oid_chunk) {
$multi_data = snmp_get_multi_oid($os->getDeviceArray(), $oid_chunk);
$snmp_data = array_merge($snmp_data, $multi_data);
}
@ -252,7 +251,7 @@ class Processor extends Model implements DiscoveryModule, PollerModule, Discover
public static function processYaml(OS $os)
{
$device = $os->getDevice();
$device = $os->getDeviceArray();
if (empty($device['dynamic_discovery']['modules']['processors'])) {
d_echo("No YAML Discovery data.\n");
return array();

View File

@ -306,7 +306,7 @@ class Sensor implements DiscoveryModule, PollerModule
// pre-fetch all standard sensors
$standard_sensors = collect($sensors)->flatten(1)->all();
$pre_fetch = self::fetchSnmpData($os->getDevice(), $standard_sensors);
$pre_fetch = self::fetchSnmpData($os->getDeviceArray(), $standard_sensors);
// poll standard sensors
foreach ($sensors as $type => $type_sensors) {
@ -642,7 +642,7 @@ class Sensor implements DiscoveryModule, PollerModule
'rrd_name' => $rrd_name,
'rrd_def' => $rrd_def
);
data_update($os->getDevice(), static::$data_name, $tags, $fields);
data_update($os->getDeviceArray(), static::$data_name, $tags, $fields);
$update = array(
'sensor_prev' => $sensor['sensor_current'],

View File

@ -194,7 +194,7 @@ class YamlDiscovery
{
// Pre-cache data for later use
$pre_cache = array();
$device = $os->getDevice();
$device = $os->getDeviceArray();
$pre_cache_file = 'includes/discovery/sensors/pre-cache/' . $device['os'] . '.inc.php';
if (is_file($pre_cache_file)) {

View File

@ -26,11 +26,15 @@
namespace LibreNMS\Interfaces\Discovery;
use App\Models\Device;
interface OSDiscovery
{
/**
* Discover additional information about the OS.
* Primarily this is just version, hardware, features, serial, but could be anything
*
* @param \App\Models\Device $device
*/
public function discoverOS(): void;
public function discoverOS(Device $device): void;
}

View File

@ -49,35 +49,35 @@ class Mpls implements Module
if ($os instanceof MplsDiscovery) {
echo "\nMPLS LSPs: ";
ModuleModelObserver::observe('\App\Models\MplsLsp');
$lsps = $this->syncModels($os->getDeviceModel(), 'mplsLsps', $os->discoverMplsLsps());
$lsps = $this->syncModels($os->getDevice(), 'mplsLsps', $os->discoverMplsLsps());
echo "\nMPLS LSP Paths: ";
ModuleModelObserver::observe('\App\Models\MplsLspPath');
$paths = $this->syncModels($os->getDeviceModel(), 'mplsLspPaths', $os->discoverMplsPaths($lsps));
$paths = $this->syncModels($os->getDevice(), 'mplsLspPaths', $os->discoverMplsPaths($lsps));
echo "\nMPLS SDPs: ";
ModuleModelObserver::observe('\App\Models\MplsSdp');
$sdps = $this->syncModels($os->getDeviceModel(), 'mplsSdps', $os->discoverMplsSdps());
$sdps = $this->syncModels($os->getDevice(), 'mplsSdps', $os->discoverMplsSdps());
echo "\nMPLS Services: ";
ModuleModelObserver::observe('\App\Models\MplsService');
$svcs = $this->syncModels($os->getDeviceModel(), 'mplsServices', $os->discoverMplsServices());
$svcs = $this->syncModels($os->getDevice(), 'mplsServices', $os->discoverMplsServices());
echo "\nMPLS SAPs: ";
ModuleModelObserver::observe('\App\Models\MplsSap');
$this->syncModels($os->getDeviceModel(), 'mplsSaps', $os->discoverMplsSaps($svcs));
$this->syncModels($os->getDevice(), 'mplsSaps', $os->discoverMplsSaps($svcs));
echo "\nMPLS SDP Bindings: ";
ModuleModelObserver::observe('\App\Models\MplsSdpBind');
$this->syncModels($os->getDeviceModel(), 'mplsSdpBinds', $os->discoverMplsSdpBinds($sdps, $svcs));
$this->syncModels($os->getDevice(), 'mplsSdpBinds', $os->discoverMplsSdpBinds($sdps, $svcs));
echo "\nMPLS Tunnel Active Routing Hops: ";
ModuleModelObserver::observe('\App\Models\MplsTunnelArHop');
$this->syncModels($os->getDeviceModel(), 'mplsTunnelArHops', $os->discoverMplsTunnelArHops($paths));
$this->syncModels($os->getDevice(), 'mplsTunnelArHops', $os->discoverMplsTunnelArHops($paths));
echo "\nMPLS Tunnel Constrained Shortest Path First Hops: ";
ModuleModelObserver::observe('\App\Models\MplsTunnelCHop');
$this->syncModels($os->getDeviceModel(), 'mplsTunnelCHops', $os->discoverMplsTunnelCHops($paths));
$this->syncModels($os->getDevice(), 'mplsTunnelCHops', $os->discoverMplsTunnelCHops($paths));
echo PHP_EOL;
}
@ -93,7 +93,7 @@ class Mpls implements Module
public function poll(OS $os)
{
if ($os instanceof MplsPolling) {
$device = $os->getDeviceModel();
$device = $os->getDevice();
if ($device->mplsLsps()->exists()) {
echo "\nMPLS LSPs: ";
@ -155,13 +155,13 @@ class Mpls implements Module
*/
public function cleanup(OS $os)
{
$os->getDeviceModel()->mplsLsps()->delete();
$os->getDeviceModel()->mplsLspPaths()->delete();
$os->getDeviceModel()->mplsSdps()->delete();
$os->getDeviceModel()->mplsServices()->delete();
$os->getDeviceModel()->mplsSaps()->delete();
$os->getDeviceModel()->mplsSdpBinds()->delete();
$os->getDeviceModel()->mplsTunnelArHops()->delete();
$os->getDeviceModel()->mplsTunnelCHops()->delete();
$os->getDevice()->mplsLsps()->delete();
$os->getDevice()->mplsLspPaths()->delete();
$os->getDevice()->mplsSdps()->delete();
$os->getDevice()->mplsServices()->delete();
$os->getDevice()->mplsSaps()->delete();
$os->getDevice()->mplsSdpBinds()->delete();
$os->getDevice()->mplsTunnelArHops()->delete();
$os->getDevice()->mplsTunnelCHops()->delete();
}
}

View File

@ -60,7 +60,7 @@ class Nac implements Module
}
$nac_entries = $os->pollNac()->keyBy('mac_address');
$existing_entries = $os->getDeviceModel()->portsNac->keyBy('mac_address');
$existing_entries = $os->getDevice()->portsNac->keyBy('mac_address');
// update existing models
foreach ($nac_entries as $nac_entry) {
@ -70,7 +70,7 @@ class Nac implements Module
}
// persist to DB
$os->getDeviceModel()->portsNac()->saveMany($nac_entries);
$os->getDevice()->portsNac()->saveMany($nac_entries);
$delete = $existing_entries->diffKeys($nac_entries)->pluck('ports_nac_id');
if ($delete->isNotEmpty()) {
@ -88,6 +88,6 @@ class Nac implements Module
*/
public function cleanup(OS $os)
{
$os->getDeviceModel()->portsNac()->delete();
$os->getDevice()->portsNac()->delete();
}
}

View File

@ -35,26 +35,25 @@ class OS implements Module
{
public function discover(\LibreNMS\OS $os)
{
$this->updateLocation($os);
if ($os instanceof OSDiscovery) {
// null out values in case they aren't filled.
$os->getDeviceModel()->fill([
$os->getDevice()->fill([
'hardware' => null,
'version' => null,
'features' => null,
'serial' => null,
'icon' => null,
// 'location_id' => null, // TODO set location
]);
$os->discoverOS();
$os->discoverOS($os->getDevice());
}
$this->handleChanges($os);
}
public function poll(\LibreNMS\OS $os)
{
$deviceModel = $os->getDeviceModel();
$deviceModel = $os->getDevice();
if ($os instanceof OSPolling) {
$os->pollOS();
} else {
@ -75,9 +74,11 @@ class OS implements Module
$deviceModel->hardware = ($hardware ?? $deviceModel->hardware) ?: null;
$deviceModel->features = ($features ?? $deviceModel->features) ?: null;
$deviceModel->serial = ($serial ?? $deviceModel->serial) ?: null;
if (!empty($location)) {
$deviceModel->setLocation($location);
}
}
$this->updateLocation($os, $location ?? null);
$this->handleChanges($os);
}
@ -88,7 +89,7 @@ class OS implements Module
private function handleChanges(\LibreNMS\OS $os)
{
$device = $os->getDeviceModel();
$device = $os->getDevice();
$device->icon = basename(Url::findOsImage($device->os, $device->features, null, 'images/os/'));
@ -102,9 +103,9 @@ class OS implements Module
private function updateLocation(\LibreNMS\OS $os, $altLocation = null)
{
$device = $os->getDeviceModel();
$device = $os->getDevice();
if ($device->override_sysLocation == 0) {
$device->setLocation($altLocation ?? snmp_get($os->getDevice(), 'sysLocation.0', '-Ovq', 'SNMPv2-MIB'));
$device->setLocation(snmp_get($os->getDeviceArray(), 'sysLocation.0', '-Ovq', 'SNMPv2-MIB'));
}
// make sure the location has coordinates

View File

@ -31,12 +31,14 @@ use DeviceCache;
use Illuminate\Support\Str;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Device\YamlDiscovery;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\Interfaces\Discovery\ProcessorDiscovery;
use LibreNMS\OS\Generic;
use LibreNMS\OS\Traits\HostResources;
use LibreNMS\OS\Traits\UcdResources;
use LibreNMS\OS\Traits\YamlOSDiscovery;
class OS implements ProcessorDiscovery
class OS implements ProcessorDiscovery, OSDiscovery
{
use HostResources {
HostResources::discoverProcessors as discoverHrProcessors;
@ -44,6 +46,7 @@ class OS implements ProcessorDiscovery
use UcdResources {
UcdResources::discoverProcessors as discoverUcdProcessors;
}
use YamlOSDiscovery;
private $device; // annoying use of references to make sure this is in sync with global $device variable
private $graphs; // stores device graphs
@ -52,6 +55,7 @@ class OS implements ProcessorDiscovery
/**
* OS constructor. Not allowed to be created directly. Use OS::make()
*
* @param array $device
*/
private function __construct(&$device)
@ -65,7 +69,7 @@ class OS implements ProcessorDiscovery
*
* @return array
*/
public function &getDevice()
public function &getDeviceArray()
{
return $this->device;
}
@ -85,7 +89,7 @@ class OS implements ProcessorDiscovery
*
* @return Device
*/
public function getDeviceModel()
public function getDevice()
{
return DeviceCache::get($this->getDeviceId());
}
@ -102,7 +106,7 @@ class OS implements ProcessorDiscovery
public function persistGraphs()
{
$device = $this->getDeviceModel();
$device = $this->getDevice();
$graphs = collect(array_keys($this->graphs));
// delete extra graphs
@ -140,7 +144,7 @@ class OS implements ProcessorDiscovery
}
if (!isset($this->cache['cache_oid'][$oid])) {
$data = snmpwalk_cache_oid($this->getDevice(), $oid, array(), $mib, null, $snmpflags);
$data = snmpwalk_cache_oid($this->getDeviceArray(), $oid, [], $mib, null, $snmpflags);
$this->cache['cache_oid'][$oid] = array_map('current', $data);
}
@ -165,7 +169,7 @@ class OS implements ProcessorDiscovery
}
if (!isset($this->cache['group'][$depth][$oid])) {
$this->cache['group'][$depth][$oid] = snmpwalk_group($this->getDevice(), $oid, $mib, $depth);
$this->cache['group'][$depth][$oid] = snmpwalk_group($this->getDeviceArray(), $oid, $mib, $depth);
}
return $this->cache['group'][$depth][$oid];
@ -236,17 +240,17 @@ class OS implements ProcessorDiscovery
protected function pollWirelessChannelAsFrequency($sensors, $callback = null)
{
if (empty($sensors)) {
return array();
return [];
}
$oids = array();
$oids = [];
foreach ($sensors as $sensor) {
$oids[$sensor['sensor_id']] = current($sensor['sensor_oids']);
}
$snmp_data = snmp_get_multi_oid($this->getDevice(), $oids);
$snmp_data = snmp_get_multi_oid($this->getDeviceArray(), $oids);
$data = array();
$data = [];
foreach ($oids as $id => $oid) {
if (isset($callback)) {
$channel = call_user_func($callback, $snmp_data[$oid]);
@ -276,4 +280,21 @@ class OS implements ProcessorDiscovery
return $processors;
}
public function getDiscovery()
{
if (!array_key_exists('dynamic_discovery', $this->device)) {
$file = base_path('/includes/definitions/discovery/' . $this->getName() . '.yaml');
if (file_exists($file)) {
$this->device['dynamic_discovery'] = \Symfony\Component\Yaml\Yaml::parse(file_get_contents($file));
}
}
return $this->device['dynamic_discovery'] ?? [];
}
public function hasYamlDiscovery(string $module = null)
{
return $module ? isset($this->getDiscovery()['modules'][$module]) : !empty($this->getDiscovery());
}
}

View File

@ -39,7 +39,7 @@ class Aen extends OS implements ProcessorDiscovery
*/
public function discoverProcessors()
{
$device = $this->getDevice();
$device = $this->getDeviceArray();
// don't poll v5.3.1_22558 devices due to bug that crashes snmpd
if ($device['version'] == 'AEN_5.3.1_22558') {

View File

@ -25,7 +25,9 @@
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessCapacityDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessCcqDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessClientsDiscovery;
@ -40,6 +42,7 @@ use LibreNMS\Interfaces\Discovery\Sensors\WirelessUtilizationDiscovery;
use LibreNMS\OS;
class Airos extends OS implements
OSDiscovery,
WirelessCapacityDiscovery,
WirelessCcqDiscovery,
WirelessClientsDiscovery,
@ -52,6 +55,19 @@ class Airos extends OS implements
WirelessRssiDiscovery,
WirelessUtilizationDiscovery
{
public function discoverOS(Device $device): void
{
$oids = ['dot11manufacturerProductName', 'dot11manufacturerProductVersion'];
$data = snmp_getnext_multi($this->getDeviceArray(), $oids, '-OQUs', 'IEEE802dot11-MIB');
$device->hardware = $data['dot11manufacturerProductName'] ?? null;
if (isset($data['dot11manufacturerProductVersion'])) {
preg_match('/\.v(.*)$/', $data['dot11manufacturerProductVersion'], $matches);
$device->version = $matches[1] ?? null;
}
}
/**
* Discover wireless frequency. This is in Hz. Type is frequency.
* Returns an array of LibreNMS\Device\Sensor objects that have been discovered
@ -195,7 +211,7 @@ class Airos extends OS implements
new WirelessSensor('rssi', $this->getDeviceId(), $oid, 'airos', 0, 'Overall RSSI')
);
$data = snmpwalk_cache_oid($this->getDevice(), 'ubntRadioRssi', array(), 'UBNT-AirMAX-MIB');
$data = snmpwalk_cache_oid($this->getDeviceArray(), 'ubntRadioRssi', array(), 'UBNT-AirMAX-MIB');
foreach ($data as $index => $entry) {
$sensors[] = new WirelessSensor(
'rssi',

View File

@ -26,6 +26,7 @@
namespace LibreNMS\OS;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessDistanceDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessFrequencyDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessPowerDiscovery;
@ -33,12 +34,12 @@ use LibreNMS\Interfaces\Discovery\Sensors\WirelessRateDiscovery;
use LibreNMS\OS;
class AirosAf extends OS implements
OSDiscovery,
WirelessFrequencyDiscovery,
WirelessPowerDiscovery,
WirelessDistanceDiscovery,
WirelessRateDiscovery
{
/**
* Discover wireless distance. This is in Kilometers. Type is distance.
* Returns an array of LibreNMS\Device\Sensor objects that have been discovered

View File

@ -3,6 +3,7 @@
namespace LibreNMS\OS;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessDistanceDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessFrequencyDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessPowerDiscovery;
@ -11,6 +12,7 @@ use LibreNMS\Interfaces\Discovery\Sensors\WirelessRateDiscovery;
use LibreNMS\OS;
class AirosAfLtu extends OS implements
OSDiscovery,
WirelessDistanceDiscovery,
WirelessFrequencyDiscovery,
WirelessPowerDiscovery,
@ -39,7 +41,7 @@ class AirosAfLtu extends OS implements
*/
public function discoverWirelessDistance()
{
$oids = snmpwalk_cache_oid($this->getDevice(), 'afLTUStaRemoteDistance', array(), 'UBNT-AFLTU-MIB', null, '-OteQUsb');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'afLTUStaRemoteDistance', array(), 'UBNT-AFLTU-MIB', null, '-OteQUsb');
foreach ($oids as $index => $entry) {
return array(
@ -60,10 +62,10 @@ class AirosAfLtu extends OS implements
$tx_eirp_oid = '.1.3.6.1.4.1.41112.1.10.1.2.6.0'; //UBNT-AFLTU-MIB::afLTUTxEIRP
$oids = snmpwalk_cache_oid($this->getDevice(), 'afLTUStaRxPower0', array(), 'UBNT-AFLTU-MIB', null, '-OteQUsb');
$oids = snmpwalk_cache_oid($this->getDevice(), 'afLTUStaRxPower1', $oids, 'UBNT-AFLTU-MIB', null, '-OteQUsb');
$oids = snmpwalk_cache_oid($this->getDevice(), 'afLTUStaIdealRxPower0', $oids, 'UBNT-AFLTU-MIB', null, '-OteQUsb');
$oids = snmpwalk_cache_oid($this->getDevice(), 'afLTUStaIdealRxPower1', $oids, 'UBNT-AFLTU-MIB', null, '-OteQUsb');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'afLTUStaRxPower0', array(), 'UBNT-AFLTU-MIB', null, '-OteQUsb');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'afLTUStaRxPower1', $oids, 'UBNT-AFLTU-MIB', null, '-OteQUsb');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'afLTUStaIdealRxPower0', $oids, 'UBNT-AFLTU-MIB', null, '-OteQUsb');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'afLTUStaIdealRxPower1', $oids, 'UBNT-AFLTU-MIB', null, '-OteQUsb');
foreach ($oids as $index => $entry) {
$sensors[] = new WirelessSensor('power', $this->getDeviceId(), '.1.3.6.1.4.1.41112.1.10.1.4.1.5.' . $index, 'airos-af-ltu-rx-chain-0', 1, 'RX Power Chain 0', $entry['afLTUStaRxPower0']); //UBNT-AFLTU-MIB::afLTUStaRxPower0
@ -87,8 +89,8 @@ class AirosAfLtu extends OS implements
{
$sensors = array();
$oids = snmpwalk_cache_oid($this->getDevice(), 'afLTUStaRxPowerLevel0', array(), 'UBNT-AFLTU-MIB', null, '-OteQUsb');
$oids = snmpwalk_cache_oid($this->getDevice(), 'afLTUStaRxPowerLevel1', $oids, 'UBNT-AFLTU-MIB', null, '-OteQUsb');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'afLTUStaRxPowerLevel0', array(), 'UBNT-AFLTU-MIB', null, '-OteQUsb');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'afLTUStaRxPowerLevel1', $oids, 'UBNT-AFLTU-MIB', null, '-OteQUsb');
foreach ($oids as $index => $entry) {
$sensors[] = new WirelessSensor('quality', $this->getDeviceId(), '.1.3.6.1.4.1.41112.1.10.1.4.1.9.' . $index, 'airos-af-ltu-level-rx-chain-0', 1, 'Signal Level Chain 0', $entry['afLTUStaRxPower0']); //UBNT-AFLTU-MIB::afLTUStaRxPowerLevel0
@ -109,8 +111,8 @@ class AirosAfLtu extends OS implements
{
$sensors = array();
$oids = snmpwalk_cache_oid($this->getDevice(), 'afLTUStaTxCapacity', array(), 'UBNT-AFLTU-MIB', null, '-OteQUsb');
$oids = snmpwalk_cache_oid($this->getDevice(), 'afLTUStaRxCapacity', $oids, 'UBNT-AFLTU-MIB', null, '-OteQUsb');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'afLTUStaTxCapacity', array(), 'UBNT-AFLTU-MIB', null, '-OteQUsb');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'afLTUStaRxCapacity', $oids, 'UBNT-AFLTU-MIB', null, '-OteQUsb');
foreach ($oids as $index => $entry) {
$sensors[] = new WirelessSensor('rate', $this->getDeviceId(), '.1.3.6.1.4.1.41112.1.10.1.4.1.3.' . $index, 'airos-af-ltu-tx', 1, 'TX Rate', $entry['afLTUStaTxCapacity'], 1000); //UBNT-AFLTU-MIB::afLTUStaTxCapacity

View File

@ -1,6 +1,6 @@
<?php
/**
* Dsm.php
* Aix.php
*
* -Description-
*
@ -17,28 +17,32 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2018 Nick Peelman
* @copyright 2020 Daniel Baeza
* @author Nick Peelman <nick@peelman.us>
* @author Daniel Baeza <doctoruve@gmail.com>
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use Illuminate\Support\Str;
use App\Models\Device;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\OS;
class Dsm extends OS implements OSDiscovery
class Aix extends OS implements OSDiscovery
{
public function discoverOS(): void
public function discoverOS(Device $device): void
{
$device = $this->getDeviceModel();
$tmp_dsm = snmp_get_multi_oid($this->getDevice(), ['modelName.0', 'version.0', 'serialNumber.0'], '-OUQs', 'SYNOLOGY-SYSTEM-MIB');
$device->hardware = $tmp_dsm['modelName.0'];
$device->version = Str::replaceFirst('DSM ', '', $tmp_dsm['version.0']);
$device->serial = $tmp_dsm['serialNumber.0'];
unset($tmp_dsm);
$aix_descr = explode("\n", $device->sysDescr);
# AIX standard snmp deamon
if ($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));
# AIX net-snmp
} else {
[, , $aix_version_min, $device->version, $device->serial] = explode(" ", $aix_descr[0]);
}
$device->version .= "." . $aix_version_min;
}
}

109
LibreNMS/OS/Allied.php Normal file
View File

@ -0,0 +1,109 @@
<?php
/**
* Allied.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\OS;
class Allied extends OS implements OSDiscovery
{
public function discoverOS(Device $device): void
{
//OS: AT-S39
//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'];
if ($software && $version) {
$version = $software . ' ' . $version;
}
//OS: AT-S41
// sysDescr.0 = STRING: "AT-8126XL, AT-S21 version 1.4.2"
// AtiL2-MIB::atiL2SwProduct.0 = STRING: "AT-8326GB"
// AtiL2-MIB::atiL2SwVersion.0 = STRING: "AT-S41 v1.1.6 "
if (!$hardware && !$version && !$software) {
$hardware = snmp_get($this->getDeviceArray(), 'atiL2SwProduct.0', '-OsvQU', 'AtiL2-MIB');
$version = snmp_get($this->getDeviceArray(), 'atiL2SwVersion.0', '-OsvQU', 'AtiL2-MIB');
}
//Alliedware Plus 2.x.x.x | Legacy products: 8100S
//SNMPv2-MIB::sysDescr.0 = STRING: AlliedWare Plus (TM) 2.2.3.0
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'];
}
//Gets OS outputting "Alliedware Plus" instead of just Alliedware.
if ($hardware && $version) {
$version = 'Plus ' . $version;
}
/*Products running Alliedware OS
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']);
if (!$hardware && !$version) {
if ($a == 'Allied' && $d == 'version') {
$version = $e;
$features = $f;
$hardware = $c;
$serial = snmp_get($this->getDeviceArray(), 'arBoardSerialNumber.1', '-OsvQU', 'AT-INTERFACES-MIB');
// sysDescr.0 = STRING: "CentreCOM 9924Ts, version 3.2.1-04, built 08-Sep-2009"
} elseif ($a == 'CentreCOM' && $c == 'version') {
$version = $d;
$features = $f;
$hardware = snmp_get($this->getDeviceArray(), 'arBoardName.1', '-OsvQU', 'AT-INTERFACES-MIB');
$serial = snmp_get($this->getDeviceArray(), 'arBoardSerialNumber.1', '-OsvQU', 'AT-INTERFACES-MIB');
//AT-GS950/24 Gigabit Ethernet WebSmart Switch
//Also requires system description as no OIDs provide $hardware
} elseif ($d == 'WebSmart' && $e == 'Switch') {
$version = snmp_get($this->getDeviceArray(), 'swhub.167.81.1.3.0', '-OsvQU', 'AtiL2-MIB');
$version = $d . ' ' . $version;
$hardware = $a;
}
}
// sysDescr.0 = STRING: "Allied Telesyn Ethernet Switch AT-8012M"
if ($a == 'Allied' && $d == 'Switch') {
$hardware = $e;
}
$device->version = str_replace(['"', ','], '', $version);
$device->features = str_replace('"', '', $features);
$device->hardware = str_replace('"', '', $hardware);
$device->serial = $serial;
}
}

View File

@ -1,8 +1,8 @@
<?php
/**
* Gigavue.php
* AllworxVoip.php
*
* Gigamon GigaVUE OS
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -19,23 +19,22 @@
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Hans Erasmus
* @author Hans Erasmus <erasmushans27@gmail.com>
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\OS;
class Gigavue extends OS implements OSDiscovery
class AllworxVoip extends OS implements OSDiscovery
{
public function discoverOS(): void
public function discoverOS(Device $device): void
{
$device = $this->getDeviceModel();
$info = snmp_getnext_multi($this->getDevice(), 'version serialNumber', '-OQUs', 'GIGAMON-SNMP-MIB');
$device->version = $info['version'];
$device->serial = $info['serialNumber'];
$device->hardware = $device->sysDescr;
$device->serial = $device->sysName;
$device->version = snmp_get($this->getDeviceArray(), 'applVersion.1', '-OQv', 'NETWORK-SERVICES-MIB');
}
}

67
LibreNMS/OS/Aos.php Normal file
View File

@ -0,0 +1,67 @@
<?php
/**
* Aos.php
*
* Alcatel-Lucent AOS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2017 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use LibreNMS\Device\Processor;
use LibreNMS\Interfaces\Discovery\ProcessorDiscovery;
use LibreNMS\OS;
class Aos extends OS implements ProcessorDiscovery
{
/**
* Discover processors.
* Returns an array of LibreNMS\Device\Processor objects that have been discovered
*
* @return array Processors
*/
public function discoverProcessors()
{
$processor = Processor::discover(
'aos-system',
$this->getDeviceId(),
'.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.1.13.0', // ALCATEL-IND1-HEALTH-MIB::healthDeviceCpuLatest
0,
'Device CPU'
);
if (!$processor->isValid()) {
// AOS7 devices use a different OID for CPU load. Not all Switches have
// healthModuleCpuLatest so we use healthModuleCpu1MinAvg which makes no
// difference for a 5 min. polling interval.
// Note: This OID shows (a) the CPU load of a single switch or (b) the
// average CPU load of all CPUs in a stack of switches.
$processor = Processor::discover(
'aos-system',
$this->getDeviceId(),
'.1.3.6.1.4.1.6486.801.1.2.1.16.1.1.1.1.1.11.0',
0,
'Device CPU'
);
}
return array($processor);
}
}

64
LibreNMS/OS/Apc.php Normal file
View File

@ -0,0 +1,64 @@
<?php
/**
* Apc.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\OS;
class Apc extends OS implements OSDiscovery
{
public function discoverOS(Device $device): void
{
$apc_serial = snmp_get_multi_oid($this->getDeviceArray(), ['rPDUIdentSerialNumber.0', 'atsIdentSerialNumber.0', 'upsAdvIdentSerialNumber.0', 'sPDUIdentSerialNumber.0', 'airIRRCUnitIdentSerialNumber.0', 'isxModularPduIdentSerialNumber.0', 'airIRRP100UnitIdentSerialNumber.0', 'airIRRP500UnitIdentSerialNumber.0'], '-OUQs', 'PowerNet-MIB');
$device->serial = array_pop($apc_serial);
$apc_model = snmp_get_multi_oid($this->getDeviceArray(), ['rPDUIdentModelNumber.0', 'atsIdentModelNumber.0', 'upsBasicIdentModel.0', 'sPDUIdentModelNumber.0', 'airIRRCUnitIdentModelNumber.0', 'isxModularPduIdentModelNumber.0', 'airIRRP100UnitIdentModelNumber.0', 'airIRRP500UnitIdentModelNumber.0'], '-OUQs', 'PowerNet-MIB');
$hardware = array_pop($apc_model);
$apc_hardware = snmp_get_multi_oid($this->getDeviceArray(), ['rPDUIdentHardwareRev.0', 'atsIdentHardwareRev.0', 'upsAdvIdentFirmwareRevision.0', 'sPDUIdentHardwareRev.0', 'airIRRCUnitIdentHardwareRevision.0', 'isxModularPduIdentMonitorCardHardwareRev.0', 'airIRRP100UnitIdentHardwareRevision.0', 'airIRRP500UnitIdentHardwareRevision.0'], '-OUQs', 'PowerNet-MIB');
if (!empty($apc_hardware)) {
$hardware = trim($hardware . ' ' . array_pop($apc_hardware));
}
if (empty($hardware)) {
preg_match('/APC (.+) \(/', $device->sysDescr, $hardware_match);
$hardware = $hardware_match[1] ?? null;
}
$device->hardware = $hardware;
$AOSrev = snmp_get($this->getDeviceArray(), '1.3.6.1.4.1.318.1.4.2.4.1.4.1', '-OQv');
$APPrev = snmp_get($this->getDeviceArray(), '1.3.6.1.4.1.318.1.4.2.4.1.4.2', '-OQv');
if ($AOSrev) {
$device->version = "AOS $AOSrev / App $APPrev";
} else {
$apc_version = snmp_get_multi_oid($this->getDeviceArray(), ['rPDUIdentFirmwareRev.0', 'atsIdentFirmwareRev.0', 'sPDUIdentFirmwareRev.0', 'airIRRCUnitIdentFirmwareRevision.0', 'isxModularPduIdentMonitorCardFirmwareAppRev.0', 'airIRRP100UnitIdentFirmwareRevision.0', 'airIRRP500UnitIdentFirmwareRevision.0'], '-OUQs', 'PowerNet-MIB');
$version = array_pop($apc_version);
if (empty($version) && preg_match('/PF:([^ ]+) .*AF1:([^ ]+) /', $device->sysDescr, $version_matches)) {
$version = "AOS {$version_matches[1]} / App $version_matches[2]";
}
$device->version = $version;
}
}
}

View File

@ -10,11 +10,11 @@
namespace LibreNMS\OS;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRssiDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessErrorRateDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessFrequencyDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessMseDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRateDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessErrorRateDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRssiDiscovery;
use LibreNMS\OS;
class ApexLynx extends OS implements

View File

@ -9,11 +9,11 @@
namespace LibreNMS\OS;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRssiDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessErrorRateDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessFrequencyDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessMseDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRateDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessErrorRateDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRssiDiscovery;
use LibreNMS\OS;
class ApexPlus extends OS implements

View File

@ -0,0 +1,48 @@
<?php
/**
* Apsoluteos.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2017 Simone Fini
* @author Simone Fini<tomfordfirst@gmail.com>
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\OS;
class Apsoluteos extends OS implements OSDiscovery
{
public function discoverOS(Device $device): void
{
$oids = ['genGroupHWVersion.0', 'rndSerialNumber.0', 'rndApsoluteOSVersion.0', 'rdwrDevicePortsConfig.0'];
$data = snmp_get_multi($this->getDeviceArray(), $oids, '-OQs', 'RADWARE-MIB');
$device->serial = $data[0]['rndSerialNumber'] ?? null;
$device->version = $data[0]['rndApsoluteOSVersion'] ?? null;
$device->hardware = $data[0]['genGroupHWVersion'] ?? null;
if (isset($data[0]['rdwrDevicePortsConfig'])) {
$device->features = 'Ver. '.$data[0]['rdwrDevicePortsConfig'];
}
}
}

View File

@ -1,8 +1,8 @@
<?php
/**
* CienaSds.php
* ArrisC4.php
*
* Ciena Service Delivery Switch
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -19,29 +19,33 @@
*
* @package LibreNMS
* @link http://librenms.org
* @author Dan Baker
* @copyright 2016 Neil Lathwood
* @author Neil Lathwood <neil@lathwood.co.uk>
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\OS;
class CienaSds extends OS implements OSDiscovery
class ArrisC4 extends OS implements OSDiscovery
{
public function discoverOS(): void
public function discoverOS(Device $device): void
{
$device = $this->getDeviceModel();
$device = $this->getDevice();
$oids = [
'serial' => '.1.3.6.1.4.1.1271.2.1.5.1.1.4.0',
'version' => '.1.3.6.1.4.1.1271.2.1.2.1.2.4.2.1.2.1.1.31',
'hardware' => '.1.3.6.1.4.1.1271.2.1.5.1.1.3.0',
'features' => '.1.3.6.1.4.1.1271.2.1.2.1.2.1.1.6.1.1'
];
$os_data = snmp_get_multi_oid($this->getDevice(), $oids);
foreach ($oids as $var => $oid) {
$device->$var = $os_data[$oid];
preg_match("/CMTS_V([\d.]+),/", $device->sysDescr, $match);
$device->version = $match[1];
$data = explode(".", $device->sysObjectID);
$id = end($data);
if ($id == "1") {
$device->hardware = "C4";
} elseif ($id == "2") {
$device->hardware = "C4c";
}
}
}

View File

@ -1,13 +1,16 @@
<?php
namespace LibreNMS\OS;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessQualityDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRssiDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessSnrDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessQualityDiscovery;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\OS;
class ArrisDsr4410md extends OS implements WirelessRssiDiscovery, WirelessSnrDiscovery, WirelessQualityDiscovery
class ArrisDsr4410md extends OS implements
WirelessRssiDiscovery,
WirelessSnrDiscovery,
WirelessQualityDiscovery
{
public function discoverWirelessRssi()
{
@ -43,6 +46,7 @@ class ArrisDsr4410md extends OS implements WirelessRssiDiscovery, WirelessSnrDis
)
);
}
public function discoverWirelessQuality()
{
$oid = '.1.3.6.1.4.1.1166.1.621.11.8.0';

View File

@ -26,8 +26,10 @@
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Device\Processor;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\Interfaces\Discovery\ProcessorDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessApCountDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessClientsDiscovery;
@ -42,6 +44,7 @@ use LibreNMS\OS;
use LibreNMS\Util\Rewrite;
class ArubaInstant extends OS implements
OSDiscovery,
ProcessorDiscovery,
WirelessApCountDiscovery,
WirelessApCountPolling,
@ -53,6 +56,12 @@ class ArubaInstant extends OS implements
WirelessPowerDiscovery,
WirelessUtilizationDiscovery
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
$device->serial = snmp_getnext($this->getDeviceArray(), 'aiAPSerialNum', '-Oqv', 'AI-AP-MIB');
}
/**
* Discover processors.
* Returns an array of LibreNMS\Device\Processor objects that have been discovered
@ -85,7 +94,7 @@ class ArubaInstant extends OS implements
public function discoverWirelessClients()
{
$sensors = array();
$device = $this->getDevice();
$device = $this->getDeviceArray();
$ai_mib = 'AI-AP-MIB';
if (intval(explode('.', $device['version'])[0]) >= 8 && intval(explode('.', $device['version'])[1]) >= 4) {
@ -280,7 +289,7 @@ class ArubaInstant extends OS implements
{
$data = array();
if (!empty($sensors)) {
$device = $this->getDevice();
$device = $this->getDeviceArray();
if (intval(explode('.', $device['version'])[0]) >= 8 && intval(explode('.', $device['version'])[1]) >= 4) {
// version is at least 8.4.0.0
@ -290,7 +299,7 @@ class ArubaInstant extends OS implements
$oids[$sensor['sensor_id']] = current($sensor['sensor_oids']);
}
$snmp_data = snmp_get_multi_oid($this->getDevice(), $oids);
$snmp_data = snmp_get_multi_oid($this->getDeviceArray(), $oids);
foreach ($oids as $id => $oid) {
$data[$id] = $snmp_data[$oid];

View File

@ -25,9 +25,11 @@
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessClientsDiscovery;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessApCountDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessClientsDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessFrequencyDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessNoiseFloorDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessPowerDiscovery;
@ -36,6 +38,7 @@ use LibreNMS\Interfaces\Polling\Sensors\WirelessFrequencyPolling;
use LibreNMS\OS;
class Arubaos extends OS implements
OsDiscovery,
WirelessApCountDiscovery,
WirelessClientsDiscovery,
WirelessFrequencyDiscovery,
@ -44,6 +47,19 @@ class Arubaos extends OS implements
WirelessPowerDiscovery,
WirelessUtilizationDiscovery
{
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');
$device->features = $aruba_info[0]['wlsxSwitchRole'] == 'master' ? 'Master Controller' : "Local Controller for {$aruba_info[0]['wlsxSwitchMasterIp']}";
$device->serial = $aruba_info[0]['wlsxSwitchLicenseSerialNumber'];
}
/**
* Discover wireless client counts. Type is clients.
* Returns an array of LibreNMS\Device\Sensor objects that have been discovered
@ -149,7 +165,7 @@ class Arubaos extends OS implements
private function discoverInstantRadio($type, $oid, $desc = 'Radio %s')
{
$data = snmpwalk_cache_numerical_oid($this->getDevice(), $oid, [], 'AI-AP-MIB');
$data = snmpwalk_cache_numerical_oid($this->getDeviceArray(), $oid, [], 'AI-AP-MIB');
$sensors = [];
foreach ($data as $index => $entry) {

View File

@ -23,6 +23,7 @@
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessClientsDiscovery;
@ -40,15 +41,11 @@ class AsuswrtMerlin extends OS implements
WirelessRateDiscovery,
WirelessSnrDiscovery
{
/**
* Retrieve basic information about the OS / device
*/
public function discoverOS(): void
public function discoverOS(Device $device): void
{
$device = $this->getDeviceModel();
$info = explode(' ', trim(snmp_get($this->getDevice(), '.1.3.6.1.4.1.2021.7890.1.101.1', '-Osqnv'), '"'));
$device->hardware = $info[1];
$device->version = $info[2];
$info = explode(' ', snmp_get($this->getDeviceArray(), '.1.3.6.1.4.1.2021.7890.1.101.1', '-Osqnv'));
$device->hardware = $info[1] ?? null;
$device->version = $info[2] ?? null;
}
/**
@ -60,10 +57,10 @@ class AsuswrtMerlin extends OS implements
private function getInterfaces()
{
// Need to use PHP_EOL, found newline (\n) not near as reliable / consistent! And this is as PHP says it should be done.
$interfaces = explode(PHP_EOL, snmp_get($this->getDevice(), 'NET-SNMP-EXTEND-MIB::nsExtendOutputFull."interfaces"', '-Osqnv'));
$interfaces = explode(PHP_EOL, snmp_get($this->getDeviceArray(), 'NET-SNMP-EXTEND-MIB::nsExtendOutputFull."interfaces"', '-Osqnv'));
$arrIfaces = array();
foreach ($interfaces as $interface) {
list($k, $v) = explode(',', $interface);
[$k, $v] = explode(',', $interface);
$arrIfaces[$k] = $v;
}
return $arrIfaces;

View File

@ -28,10 +28,10 @@ namespace LibreNMS\OS;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessFrequencyDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRateDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessSnrDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessPowerDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRateDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRssiDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessSnrDiscovery;
use LibreNMS\OS;
class AviatWtm extends OS implements
@ -42,30 +42,17 @@ class AviatWtm extends OS implements
WirelessSnrDiscovery,
WirelessPowerDiscovery
{
public function discoverOS(): void
{
$device = $this->getDeviceModel();
$oids = ['entPhysicalModelName.2', 'entPhysicalSerialNum.2', 'entPhysicalSoftwareRev.2'];
$data = snmp_get_multi($this->getDevice(), $oids, '-OQUs', 'ENTITY-MIB');
$device->hardware = $data[2]['entPhysicalModelName'] ?? null;
$device->serial = $data[2]['entPhysicalSerialNum'] ?? null;
$device->version = $data[2]['entPhysicalSoftwareRev'] ?? null;
}
/**
* Discover wireless tx or rx power. This is in dBm. Type is power.
* Returns an array of LibreNMS\Device\Sensor objects that have been discovered
*
* @return array
*/
public function discoverWirelessFrequency()
{
$sensors = [];
$name = $this->getCacheByIndex('entPhysicalName', 'ENTITY-MIB');
$frequency = snmpwalk_cache_oid($this->getDevice(), 'aviatRfFreqTx', [], 'AVIAT-RF-MIB:');
$frequency = snmpwalk_cache_oid($this->getDeviceArray(), 'aviatRfFreqTx', [], 'AVIAT-RF-MIB:');
foreach ($frequency as $index => $data) {
$sensors[] = new WirelessSensor(
'frequency',
@ -95,7 +82,7 @@ class AviatWtm extends OS implements
$sensors = [];
$name = $this->getCacheByIndex('entPhysicalName', 'ENTITY-MIB');
$tx = snmpwalk_cache_oid($this->getDevice(), 'aviatModemCurCapacityTx', [], 'AVIAT-MODEM-MIB');
$tx = snmpwalk_cache_oid($this->getDeviceArray(), 'aviatModemCurCapacityTx', [], 'AVIAT-MODEM-MIB');
foreach ($tx as $index => $data) {
$sensors[] = new WirelessSensor(
'rate',
@ -109,7 +96,7 @@ class AviatWtm extends OS implements
);
}
$rx = snmpwalk_cache_oid($this->getDevice(), 'aviatModemCurCapacityRx', [], 'AVIAT-MODEM-MIB');
$rx = snmpwalk_cache_oid($this->getDeviceArray(), 'aviatModemCurCapacityRx', [], 'AVIAT-MODEM-MIB');
foreach ($rx as $index => $data) {
$sensors[] = new WirelessSensor(
'rate',
@ -136,7 +123,7 @@ class AviatWtm extends OS implements
{
$sensors = [];
$name = $this->getCacheByIndex('entPhysicalName', 'ENTITY-MIB');
$rsl = snmpwalk_cache_oid($this->getDevice(), 'aviatRxPerformRslReadingCurrent', [], 'AVIAT-RXPERFORMANCE-MIB');
$rsl = snmpwalk_cache_oid($this->getDeviceArray(), 'aviatRxPerformRslReadingCurrent', [], 'AVIAT-RXPERFORMANCE-MIB');
foreach ($rsl as $index => $data) {
$sensors[] = new WirelessSensor(
@ -165,7 +152,7 @@ class AviatWtm extends OS implements
{
$sensors = [];
$name = $this->getCacheByIndex('entPhysicalName', 'ENTITY-MIB');
$snr = snmpwalk_cache_oid($this->getDevice(), 'aviatRxPerformCinrReadingCurrent', [], 'AVIAT-RXPERFORMANCE-EX-MIB');
$snr = snmpwalk_cache_oid($this->getDeviceArray(), 'aviatRxPerformCinrReadingCurrent', [], 'AVIAT-RXPERFORMANCE-EX-MIB');
foreach ($snr as $index => $data) {
$sensors[] = new WirelessSensor(
@ -194,7 +181,7 @@ class AviatWtm extends OS implements
{
$sensors = [];
$name = $this->getCacheByIndex('entPhysicalName', 'ENTITY-MIB');
$power = snmpwalk_cache_oid($this->getDevice(), 'aviatRxPerformTxpowReadingCurrent', [], 'AVIAT-RXPERFORMANCE-EX-MIB');
$power = snmpwalk_cache_oid($this->getDeviceArray(), 'aviatRxPerformTxpowReadingCurrent', [], 'AVIAT-RXPERFORMANCE-EX-MIB');
foreach ($power as $index => $data) {
$sensors[] = new WirelessSensor(

65
LibreNMS/OS/Avocent.php Normal file
View File

@ -0,0 +1,65 @@
<?php
/**
* Avocent.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
use Illuminate\Support\Str;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\OS;
class Avocent extends OS implements OSDiscovery
{
public function discoverOS(Device $device): void
{
$avocent_tmp = snmp_get_multi_oid($this->getDeviceArray(), [
'pmProductModel.0',
'pmSerialNumber.0',
'pmFirmwareVersion.0'
], '-OUQs', 'PM-MIB');
$hardware = $avocent_tmp['pmProductModel.0'] ?? null;
$serial = $avocent_tmp['pmSerialNumber.0'] ?? null;
$version = $avocent_tmp['pmFirmwareVersion.0'] ?? null;
if (empty($hardware)) {
if (Str::startsWith($device->sysObjectID, '.1.3.6.1.4.1.10418.16')) {
$avocent_oid = '.1.3.6.1.4.1.10418.16.2.1';
} elseif (Str::startsWith($device->sysObjectID, '.1.3.6.1.4.1.10418.26')) {
$avocent_oid = '.1.3.6.1.4.1.10418.26.2.1';
}
if ($avocent_oid) {
$avocent_tmp = snmp_get_multi_oid($this->getDeviceArray(), "$avocent_oid.2.0 $avocent_oid.4.0 $avocent_oid.7.0");
$hardware = explode(' ', $avocent_tmp["$avocent_oid.2.0"] ?? '', 2)[0] ?: null;
$serial = $avocent_tmp["$avocent_oid.4.0"] ?? null;
$version = $avocent_tmp["$avocent_oid.7.0"] ?? null;
}
}
$device->hardware = $hardware ?? null;
$device->serial = $serial ?? null;
$device->version = $version ?? null;
}
}

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

@ -0,0 +1,70 @@
<?php
/**
* Awplus.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
use Illuminate\Support\Str;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\OS;
class Awplus extends OS implements OSDiscovery
{
public function discoverOS(Device $device): void
{
//$hardware and $serial use snmp_getnext as the OID for these is not always fixed.
//However, the first OID is the device baseboard.
$data = snmp_getnext_multi($this->getDeviceArray(), ['rscBoardName', 'rscBoardSerialNumber'], '-OQs', 'AT-RESOURCE-MIB');
$hardware = $data['rscBoardName'];
$serial = $data['rscBoardSerialNumber'];
// SBx8100 platform has line cards show up first in "rscBoardName" above.
//Instead use sysObjectID.0
if (Str::contains($hardware, 'SBx81')) {
$data_array = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'rscBoardName', [], 'AT-RESOURCE-MIB', '-OUsb');
$data_array = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'rscBoardSerialNumber', $data_array, 'AT-RESOURCE-MIB', '-OUsb');
$hardware = snmp_translate($device->sysObjectID, 'AT-PRODUCT-MIB', null, null, $this->getDeviceArray());
$hardware = str_replace('at', 'AT-', $hardware);
// Features and Serial is set to Controller card 1.5
$features = $data_array['5.6']['rscBoardName'];
$serial = $data_array['5.6']['rscBoardSerialNumber'];
// If bay 1.5 is empty, set to Controller card 1.6
if (!$features && !$serial) {
$features = $data_array['6.6']['rscBoardName'];
$serial = $data_array['6.6']['rscBoardSerialNumber'];
}
}
$device->version = snmp_get($this->getDeviceArray(), "currSoftVersion.0", "-OQv", "AT-SETUP-MIB");
$device->serial = $serial;
$device->hardware = $hardware;
$device->features = $features ?? null;
}
}

View File

@ -0,0 +1,58 @@
<?php
/**
* Barracudangfirewall.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\OS;
use LibreNMS\RRD\RrdDefinition;
class Barracudangfirewall extends OS implements OSDiscovery, OSPolling
{
public function discoverOS(Device $device): void
{
if ($device->sysObjectID == '.1.3.6.1.4.1.10704.1.10') {
$device->hardware = $device->sysName;
}
}
public function pollOS()
{
// TODO move to count sensor
$sessions = snmp_get($this->getDeviceArray(), 'firewallSessions64.8.102.119.83.116.97.116.115.0', '-OQv', 'PHION-MIB');
if (is_numeric($sessions)) {
$rrd_def = RrdDefinition::make()->addDataset('fw_sessions', 'GAUGE', 0);
$fields = ['fw_sessions' => $sessions];
$tags = compact('rrd_def');
app('Datastore')->put($this->getDeviceArray(), 'barracuda_firewall_sessions', $tags, $fields);
$this->enableGraph('barracuda_firewall_sessions');
}
}
}

View File

@ -23,6 +23,7 @@
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\OS;
@ -32,11 +33,10 @@ class Beagleboard extends OS implements
/**
* Retrieve basic information about the OS / device
*/
public function discoverOS(): void
public function discoverOS(Device $device): void
{
$device = $this->getDeviceModel();
$oids = ['NET-SNMP-EXTEND-MIB::nsExtendOutputFull."distro"', 'NET-SNMP-EXTEND-MIB::nsExtendOutputFull."hardware"'];
$info = snmp_get_multi($this->getDevice(), $oids);
$info = snmp_get_multi($this->getDeviceArray(), $oids);
$device->version = str_replace("BeagleBoard.org ", "", $info['"distro"']['nsExtendOutputFull']);
$device->hardware = $info['"hardware"']['nsExtendOutputFull'];
}

View File

@ -25,12 +25,46 @@
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Device\Processor;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\Interfaces\Discovery\ProcessorDiscovery;
use LibreNMS\OS;
class Boss extends OS implements ProcessorDiscovery
class Boss extends OS implements OSDiscovery, ProcessorDiscovery
{
public function discoverOS(Device $device): void
{
// Try multiple ways of getting firmware version
$version = null;
preg_match('/SW:v?([^ ]+) /', $device->sysDescr, $version_matches);
$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;
}
if (empty($version)) {
$version = snmp_get($this->getDeviceArray(), '.1.3.6.1.4.1.45.1.6.4.2.1.10.0', '-Oqvn') ?? null;
}
$device->version = $version;
// Get hardware details, expand ERS to normalize
$details = str_replace('ERS', 'Ethernet Routing Switch', $device->sysDescr);
// 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;
// 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');
$stack = explode("\n", $stack);
$stack_size = count($stack);
if ($stack_size > 1) {
$device->features = "Stack of $stack_size units";
}
}
/**
* Discover processors.
* Returns an array of LibreNMS\Device\Processor objects that have been discovered
@ -39,9 +73,9 @@ class Boss extends OS implements ProcessorDiscovery
*/
public function discoverProcessors()
{
$data = snmpwalk_group($this->getDevice(), 's5ChasUtilCPUUsageLast10Minutes', 'S5-CHASSIS-MIB');
$data = snmpwalk_group($this->getDeviceArray(), 's5ChasUtilCPUUsageLast10Minutes', 'S5-CHASSIS-MIB');
$processors = array();
$processors = [];
$count = 1;
foreach ($data as $index => $entry) {
$processors[] = Processor::discover(

57
LibreNMS/OS/Brother.php Normal file
View File

@ -0,0 +1,57 @@
<?php
/**
* Brother.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\OS;
class Brother extends OS implements OSDiscovery
{
public function discoverOS(Device $device): void
{
$data = snmp_get_multi($this->getDeviceArray(), [
'brmDNSPrinterName.0', // Brother HL-2070N series
'brInfoSerialNumber.0', // 000A5J431816
'brpsFirmwareDescription.0', // Firmware Ver.1.33 (06.07.21)
'brieee1284id.0', // MFG:Brother;CMD:HBP,PJL,PCL,PCLXL,POSTSCRIPT;MDL:MFC-8440;CLS:PRINTER;
], '-OQUs', 'BROTHER-MIB');
$device->serial = $data[0]['brInfoSerialNumber'] ?? null;
if (isset($data[0]['brmDNSPrinterName'])) {
$device->hardware = str_replace(['Brother ', ' series'], '', $data[0]['brmDNSPrinterName']);
} elseif (isset($data[0]['brieee1284id'])) {
preg_match('/MDL:([^;]+)/', $data[0]['brieee1284id'], $matches);
$device->hardware = $matches[1] ?? null;
}
if (isset($data[0]['brpsFirmwareDescription'])) {
preg_match('/Ver\.([^ ]+)/', $data[0]['brpsFirmwareDescription'], $matches);
$device->version = $matches[1] ?? null;
}
}
}

View File

@ -25,17 +25,47 @@
namespace LibreNMS\OS;
use App\Models\Device;
use Illuminate\Support\Str;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessFrequencyDiscovery;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessErrorsDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessFrequencyDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessMseDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessPowerDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRateDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessXpiDiscovery;
use LibreNMS\OS;
class Ceraos extends OS implements WirelessXpiDiscovery, WirelessFrequencyDiscovery, WirelessErrorsDiscovery, WirelessMseDiscovery, WirelessPowerDiscovery, WirelessRateDiscovery
class Ceraos extends OS implements OSDiscovery, WirelessXpiDiscovery, WirelessFrequencyDiscovery, WirelessErrorsDiscovery, WirelessMseDiscovery, WirelessPowerDiscovery, WirelessRateDiscovery
{
public function discoverOS(Device $device): void
{
$device->hardware = $this->fetchHardware();
$sn_oid = Str::contains($device->hardware, 'IP10') ? 'genEquipUnitIDUSerialNumber.0' : 'genEquipInventorySerialNumber.127';
$device->serial = snmp_get($this->getDeviceArray(), $sn_oid, '-Oqv', 'MWRM-UNIT-MIB');
$data = snmp_get_multi($this->getDeviceArray(), ['genEquipMngSwIDUVersionsRunningVersion.1', 'genEquipUnitLatitude.0', 'genEquipUnitLongitude.0'], '-OQU', 'MWRM-RADIO-MIB');
$device->version = $data[1]['MWRM-UNIT-MIB::genEquipMngSwIDUVersionsRunningVersion'] ?? null;
// update location lat/lng
if ($device->location && (!empty($multi_get_array[0]['MWRM-UNIT-MIB::genEquipUnitLatitude']) || !empty($multi_get_array[0]['MWRM-UNIT-MIB::genEquipUnitLongitude']))) {
$device->location->lat = $multi_get_array[0]['MWRM-UNIT-MIB::genEquipUnitLatitude'] ?? $device->location->lat;
$device->location->lng = $multi_get_array[0]['MWRM-UNIT-MIB::genEquipUnitLongitude'] ?? $device->location->lng;
$device->location->save();
}
$num_radios = 0;
foreach (snmpwalk_group($this->getDeviceArray(), 'ifDescr', 'IF-MIB') as $interface) {
if ($interface['ifDescr'] == 'Radio') {
$num_radios++;
}
}
$device->features = $num_radios . " radios in unit";
}
public function discoverWirelessXpi()
{
$ifNames = $this->getCacheByIndex('ifName', 'IF-MIB');
@ -43,7 +73,7 @@ class Ceraos extends OS implements WirelessXpiDiscovery, WirelessFrequencyDiscov
$sensors = [];
$divisor = 100;
$xpi = snmpwalk_group($this->getDevice(), 'genEquipRadioStatusXPI', 'MWRM-RADIO-MIB');
$xpi = snmpwalk_group($this->getDeviceArray(), 'genEquipRadioStatusXPI', 'MWRM-RADIO-MIB');
foreach ($xpi as $index => $data) {
$sensors[] = new WirelessSensor(
'xpi',
@ -65,7 +95,7 @@ class Ceraos extends OS implements WirelessXpiDiscovery, WirelessFrequencyDiscov
{
$sensors = [];
// MWRM-RADIO-MIB::genEquipRfuCfgTxFreq
$tx = snmpwalk_group($this->getDevice(), 'genEquipRfuCfgTxFreq', 'MWRM-RADIO-MIB');
$tx = snmpwalk_group($this->getDeviceArray(), 'genEquipRfuCfgTxFreq', 'MWRM-RADIO-MIB');
$TxRadio = 0;
foreach ($tx as $index => $data) {
$TxRadio++;
@ -82,7 +112,7 @@ class Ceraos extends OS implements WirelessXpiDiscovery, WirelessFrequencyDiscov
);
}
// MWRM-RADIO-MIB::genEquipRfuCfgRxFreq
$rx = snmpwalk_group($this->getDevice(), 'genEquipRfuCfgRxFreq', 'MWRM-RADIO-MIB');
$rx = snmpwalk_group($this->getDeviceArray(), 'genEquipRfuCfgRxFreq', 'MWRM-RADIO-MIB');
$RxRadio = 0;
foreach ($rx as $index => $data) {
$RxRadio++;
@ -113,7 +143,7 @@ class Ceraos extends OS implements WirelessXpiDiscovery, WirelessFrequencyDiscov
$sensors = [];
$tx = snmpwalk_group($this->getDevice(), 'genEquipRadioMRMCCurrTxBitrate', 'MWRM-RADIO-MIB');
$tx = snmpwalk_group($this->getDeviceArray(), 'genEquipRadioMRMCCurrTxBitrate', 'MWRM-RADIO-MIB');
foreach ($tx as $index => $data) {
$sensors[] = new WirelessSensor(
'rate',
@ -127,7 +157,7 @@ class Ceraos extends OS implements WirelessXpiDiscovery, WirelessFrequencyDiscov
);
}
$rx = snmpwalk_group($this->getDevice(), 'genEquipRadioMRMCCurrRxBitrate', 'MWRM-RADIO-MIB');
$rx = snmpwalk_group($this->getDeviceArray(), 'genEquipRadioMRMCCurrRxBitrate', 'MWRM-RADIO-MIB');
foreach ($rx as $index => $data) {
$sensors[] = new WirelessSensor(
'rate',
@ -156,7 +186,7 @@ class Ceraos extends OS implements WirelessXpiDiscovery, WirelessFrequencyDiscov
$sensors = [];
$mse = snmpwalk_group($this->getDevice(), 'genEquipRadioStatusDefectedBlocks', 'MWRM-RADIO-MIB');
$mse = snmpwalk_group($this->getDeviceArray(), 'genEquipRadioStatusDefectedBlocks', 'MWRM-RADIO-MIB');
foreach ($mse as $index => $data) {
$sensors[] = new WirelessSensor(
'errors',
@ -185,7 +215,7 @@ class Ceraos extends OS implements WirelessXpiDiscovery, WirelessFrequencyDiscov
$sensors = [];
$divisor = 100;
$mse = snmpwalk_group($this->getDevice(), 'genEquipRadioStatusMSE', 'MWRM-RADIO-MIB');
$mse = snmpwalk_group($this->getDeviceArray(), 'genEquipRadioStatusMSE', 'MWRM-RADIO-MIB');
foreach ($mse as $index => $data) {
$sensors[] = new WirelessSensor(
'mse',
@ -215,7 +245,7 @@ class Ceraos extends OS implements WirelessXpiDiscovery, WirelessFrequencyDiscov
$sensors = [];
$tx = snmpwalk_group($this->getDevice(), 'genEquipRfuStatusTxLevel', 'MWRM-RADIO-MIB');
$tx = snmpwalk_group($this->getDeviceArray(), 'genEquipRfuStatusTxLevel', 'MWRM-RADIO-MIB');
foreach ($tx as $index => $data) {
$sensors[] = new WirelessSensor(
'power',
@ -228,7 +258,7 @@ class Ceraos extends OS implements WirelessXpiDiscovery, WirelessFrequencyDiscov
);
}
$rx = snmpwalk_group($this->getDevice(), 'genEquipRfuStatusRxLevel', 'MWRM-RADIO-MIB');
$rx = snmpwalk_group($this->getDeviceArray(), 'genEquipRfuStatusRxLevel', 'MWRM-RADIO-MIB');
foreach ($rx as $index => $data) {
$sensors[] = new WirelessSensor(
'power',
@ -243,4 +273,39 @@ class Ceraos extends OS implements WirelessXpiDiscovery, WirelessFrequencyDiscov
return $sensors;
}
private function fetchHardware()
{
$sysObjectID = $this->getDevice()->sysObjectID;
if (Str::contains($sysObjectID, '.2281.1.10')) {
return 'IP10 Family';
} elseif (Str::contains($sysObjectID, '.2281.1.20.1.1.2')) {
return 'IP-20A 1RU';
} elseif (Str::contains($sysObjectID, '.2281.1.20.1.1.4')) {
return 'IP-20 Evolution LH 1RU';
} elseif (Str::contains($sysObjectID, '.2281.1.20.1.1')) {
return 'IP-20N 1RU';
} elseif (Str::contains($sysObjectID, '.2281.1.20.1.2.2')) {
return 'IP-20A 2RU';
} elseif (Str::contains($sysObjectID, '.2281.1.20.1.2.4')) {
return 'IP-20 Evolution 2RU';
} elseif (Str::contains($sysObjectID, '.2281.1.20.1.2')) {
return 'IP-20N 2RU';
} elseif (Str::contains($sysObjectID, '.2281.1.20.1.3.1')) {
return 'IP-20G';
} elseif (Str::contains($sysObjectID, '.2281.1.20.1.3.2')) {
return 'IP-20GX';
} elseif (Str::contains($sysObjectID, '.2281.1.20.2.2.2')) {
return 'IP-20S';
} elseif (Str::contains($sysObjectID, '.2281.1.20.2.2.3')) {
return 'IP-20E (hardware release 1)';
} elseif (Str::contains($sysObjectID, '.2281.1.20.2.2.4')) {
return 'IP-20E (hardware release 2)';
} elseif (Str::contains($sysObjectID, '.2281.1.20.2.2')) {
return 'IP-20C';
}
return snmp_get($this->getDeviceArray(), 'genEquipInventoryCardName', '-Oqv', 'MWRM-UNIT-NAME');
}
}

View File

@ -12,7 +12,7 @@ class Ciscosat extends OS implements WirelessErrorsDiscovery, WirelessRssiDiscov
{
public function discoverWirelessErrors()
{
$oids = snmpwalk_cache_oid($this->getDevice(), 'satSignalUncorErrCnt', [], 'CISCO-DMN-DSG-TUNING-MIB', null, '-Ob');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'satSignalUncorErrCnt', [], 'CISCO-DMN-DSG-TUNING-MIB', null, '-Ob');
$sensors = [];
foreach ($oids as $index => $entry) {
$sensors[] = new WirelessSensor(
@ -29,7 +29,7 @@ class Ciscosat extends OS implements WirelessErrorsDiscovery, WirelessRssiDiscov
public function discoverWirelessRssi()
{
$oids = snmpwalk_cache_oid($this->getDevice(), 'satSignalLevel', [], 'CISCO-DMN-DSG-TUNING-MIB', null, '-Ob');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'satSignalLevel', [], 'CISCO-DMN-DSG-TUNING-MIB', null, '-Ob');
$sensors = [];
foreach ($oids as $index => $entry) {
$sensors[] = new WirelessSensor(
@ -50,7 +50,7 @@ class Ciscosat extends OS implements WirelessErrorsDiscovery, WirelessRssiDiscov
$sensors = [];
// snr - Discover C/N Link Margin
$cnmargin = snmpwalk_cache_oid($this->getDevice(), 'satSignalCnMargin', [], 'CISCO-DMN-DSG-TUNING-MIB', null, '-OQUsb');
$cnmargin = snmpwalk_cache_oid($this->getDeviceArray(), 'satSignalCnMargin', [], 'CISCO-DMN-DSG-TUNING-MIB', null, '-OQUsb');
foreach ($cnmargin as $index => $entry) {
$sensors[] = new WirelessSensor(
'snr',
@ -64,7 +64,7 @@ class Ciscosat extends OS implements WirelessErrorsDiscovery, WirelessRssiDiscov
}
// snr - Discover C/N Ratio
$cnratio = snmpwalk_cache_oid($this->getDevice(), 'satSignalCndisp', [], 'CISCO-DMN-DSG-TUNING-MIB', null, '-OQUsb');
$cnratio = snmpwalk_cache_oid($this->getDeviceArray(), 'satSignalCndisp', [], 'CISCO-DMN-DSG-TUNING-MIB', null, '-OQUsb');
foreach ($cnratio as $index => $entry) {
$sensors[] = new WirelessSensor(
'snr',

67
LibreNMS/OS/Ciscosb.php Normal file
View File

@ -0,0 +1,67 @@
<?php
/*
* Ciscosb.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\OS;
class Ciscosb extends OS implements OSDiscovery
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
$data = snmp_get_multi($this->getDeviceArray(), ['rlPhdUnitGenParamModelName.1', 'genGroupHWVersion.0', 'rlPhdUnitGenParamHardwareVersion.1', 'rlPhdUnitGenParamSoftwareVersion.1', 'rlPhdUnitGenParamFirmwareVersion.1', 'rndBaseBootVersion.0'], '-OQUs', 'CISCOSB-DEVICEPARAMS-MIB:CISCOSB-Physicaldescription-MIB');
if (empty($device->hardware)) {
if (preg_match('/\.1\.3\.6\.1\.4\.1\.9\.6\.1\.72\.(....).+/', $device->sysObjectID, $model)) {
$hardware = 'SGE' . $model[1] . '-' . substr($device->sysDescr, 0, 2);
} 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']);
}
$device->hardware = $hardware;
}
$hwversion = $data['0']['genGroupHWVersion'] ?? $data['1']['rlPhdUnitGenParamHardwareVersion'] ?? null;
if ($hwversion) {
$device->hardware = trim("$device->hardware $hwversion");
}
$device->version = isset($data['1']['rlPhdUnitGenParamSoftwareVersion']) ? ('Software ' . $data['1']['rlPhdUnitGenParamSoftwareVersion']) : null;
$boot = $data['0']['rndBaseBootVersion'];
$firmware = $data['1']['rlPhdUnitGenParamFirmwareVersion'];
if ($boot) {
$device->version .= ", Bootldr $boot";
}
if ($firmware) {
$device->version .= ", Firmware $firmware";
}
$device->version = trim($device->version, ', ');
}
}

View File

@ -26,10 +26,8 @@
namespace LibreNMS\OS;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\ProcessorDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessApCountDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessClientsDiscovery;
use LibreNMS\OS;
use LibreNMS\OS\Shared\Cisco;
class Ciscowlc extends Cisco implements
@ -93,7 +91,7 @@ class Ciscowlc extends Cisco implements
'CISCO-LWAPP-SYS-MIB::clsSysApConnectCount.0',
'AIRESPACE-SWITCHING-MIB::agentInventoryMaxNumberOfAPsSupported.0',
);
$data = snmp_get_multi($this->getDevice(), $oids);
$data = snmp_get_multi($this->getDeviceArray(), $oids);
if (isset($data[0]['clsSysApConnectCount'])) {
return array(

View File

@ -25,12 +25,22 @@
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Device\Processor;
use LibreNMS\Interfaces\Discovery\ProcessorDiscovery;
use LibreNMS\OS;
class Comware extends OS implements ProcessorDiscovery
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
// serial
$serial_nums = explode("\n", snmp_walk($this->getDeviceArray(), 'hh3cEntityExtManuSerialNum', '-Osqv', 'HH3C-ENTITY-EXT-MIB'));
$this->getDevice()->serial = $serial_nums[0]; // use the first s/n
}
/**
* Discover processors.
* Returns an array of LibreNMS\Device\Processor objects that have been discovered

74
LibreNMS/OS/Coriant.php Normal file
View File

@ -0,0 +1,74 @@
<?php
/*
* Coriant.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\TnmsneInfo;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\Util\ModuleModelObserver;
use Log;
class Coriant extends \LibreNMS\OS implements OSPolling
{
public function pollOS()
{
echo 'TNMS-NBI-MIB: enmsNETable';
/*
* Coriant have done some SQL over SNMP, since we have to populate and update all the tables
* before using it, we have to do ugly stuff
*/
$c_list = [];
ModuleModelObserver::observe('\App\Models\MplsLsp\TnmsneInfo');
foreach (snmpwalk_cache_multi_oid($this->getDeviceArray(), 'enmsNETable', [], 'TNMS-NBI-MIB') as $index => $ne) {
$ne = TnmsneInfo::firstOrNew(['device_id' => $this->getDeviceId(), 'neID' => $index], [
'device_id' => $this->getDeviceId(),
'neID' => $index,
'neType' => $ne['enmsNeType'],
'neName' => $ne['enmsNeName'],
'neLocation' => $ne['enmsNeLocation'],
'neAlarm' => $ne['enmsNeAlarmSeverity'],
'neOpMode' => $ne['enmsNeOperatingMode'],
'neOpState' => $ne['enmsNeOpState']
]);
if ($ne->isDirty()) {
$ne->save();
Log::event("Coriant enmsNETable Hardware $ne->neType : $ne->neName ($index) at $ne->neLocation Discovered", $this->getDevice(), 'system', 2);
}
$c_list[] = $index;
}
foreach (TnmsneInfo::where('device_id', $this->getDeviceId())->whereNotIn('neID', $c_list)->get() as $ne) {
/** @var TnmsneInfo $ne */
$ne->delete();
Log::event("Coriant enmsNETable Hardware $ne->neName at $ne->neLocation Removed", $this->getDevice(), 'system', $ne->neID);
}
}
}

View File

@ -1,6 +1,8 @@
<?php
/**
* FsNmu.php
/*
* Cumulus.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -17,23 +19,21 @@
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Hans Erasmus
* @author Jozef Rebjak <jozefrebjak@icloud.com>
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\OS;
use App\Models\Device;
class FsNmu extends OS implements OSDiscovery
class Cumulus extends \LibreNMS\OS
{
public function discoverOS(): void
public function discoverOS(Device $device): void
{
$device = $this->getDeviceModel();
$info = snmp_get_multi($this->getDevice(), ['vSerialNumber.0', 'vDeviceType.0', 'vSoftwareVerion.0'], '-OQUs', 'OAP-C1-OEO');
$device->serial = $info[0]['vSerialNumber'] ?? null;
$device->hardware = $info[0]['vDeviceType'] ?? null;
$device->version = $info[0]['vSoftwareVerion'] ?? null;
$data = snmp_getnext_multi($this->getDeviceArray(), ['entPhysicalDescr', 'entPhysicalSoftwareRev', 'entPhysicalSerialNum'], '-OQUs', 'ENTITY-MIB');
$device->hardware = $data['entPhysicalDescr'];
$device->serial = $data['entPhysicalSerialNum'];
$device->version = preg_replace('/^Cumulus Linux /', '', $data['entPhysicalSoftwareRev']);
}
}

39
LibreNMS/OS/DdWrt.php Normal file
View File

@ -0,0 +1,39 @@
<?php
/*
* DdWrt.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
class DdWrt extends \LibreNMS\OS
{
public function discoverOS(Device $device): void
{
// dd-wrt, cannot use exec with OID specified. Options are extend (w/OID), or exec (w/o OID)
// -> extend seems to be the recommended approach, so use that (changes OID, which "spells out" name)
[, $device->version] = explode(' ', snmp_get($this->getDeviceArray(), 'NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."distro"', '-Osqnv'));
$device->hardware = snmp_get($this->getDeviceArray(), 'NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."hardware"', '-Osqnv');
}
}

View File

@ -39,7 +39,7 @@ class Deliberant extends OS implements WirelessClientsDiscovery
*/
public function discoverWirelessClients()
{
$device = $this->getDevice();
$device = $this->getDeviceArray();
$clients_data = snmpwalk_cache_oid($device, 'dlbDot11IfAssocNodeCount', array(), 'DLB-802DOT11-EXT-MIB');
$sensors = array();

54
LibreNMS/OS/DellLaser.php Normal file
View File

@ -0,0 +1,54 @@
<?php
/*
* DellLaser.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
class DellLaser extends \LibreNMS\OS
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // 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', '', '')));
$dell_laser = [];
foreach ($modelinfo as $line) {
[$key, $value] = explode(':', $line);
$dell_laser[$key] = $value;
}
$device->hardware = $dell_laser['MDL'] ?: $dell_laser['MODEL'];
}
}

View File

@ -0,0 +1,49 @@
<?php
/*
* Dhcpatriot.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
use DateTime;
use Illuminate\Support\Str;
class Dhcpatriot extends Shared\Unix
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
$license = snmp_get($this->getDeviceArray(), '.1.3.6.1.4.1.2021.51.12.4.1.2.7.76.73.67.69.78.83.69.1', '-Oqv');
if (!empty($license)) {
if ($license === 'FULL:0') {
$device->features = 'Non-Expiry License';
} elseif (Str::contains($license, 'LIMITED:')) {
$ft_epoch = str_replace('LIMITED:', '', $license);
$ft_dt = new DateTime("@$ft_epoch");
$device->features = 'License Expires '.$ft_dt->format('Y-m-d');
}
}
}
}

View File

@ -1,8 +1,8 @@
<?php
/**
* axisaudio.inc.php
* Dlink.php
*
* LibreNMS OS poller module for Axis Audio Appliances
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -17,18 +17,23 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2017 Lorenzo Zafra
* @author Lorenzo Zafra<zafra@ualberta.ca>
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
$data = explode('; ', $device['sysDescr']);
namespace LibreNMS\OS;
if (isset($data[1])) {
$hardware = $data[1];
}
use App\Models\Device;
if (isset($data[3])) {
$version = $data[3];
class Dlink extends \LibreNMS\OS
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
if (!empty($device->hardware) && $rev = snmp_get($this->getDeviceArray(), '.1.3.6.1.2.1.16.19.3.0', '-Oqv')) {
$device->hardware .= ' Rev. ' . $rev;
}
}
}

View File

@ -25,12 +25,22 @@
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Device\Processor;
use LibreNMS\Interfaces\Discovery\ProcessorDiscovery;
use LibreNMS\OS;
class Dlinkap extends OS implements ProcessorDiscovery
{
public function discoverOS(Device $device): void
{
$firmware_oid = $device->sysObjectID . '.5.1.1.0';
$hardware_oid = $device->sysObjectID . '.5.1.5.0';
$device->version = snmp_get($device, $firmware_oid, '-Oqv') ?: null;
$device->hardware = trim($device->sysDescr . ' ' . snmp_get($device, $hardware_oid, '-Oqv'));
}
/**
* Discover processors.
* Returns an array of LibreNMS\Device\Processor objects that have been discovered
@ -39,15 +49,15 @@ class Dlinkap extends OS implements ProcessorDiscovery
*/
public function discoverProcessors()
{
return array(
return [
Processor::discover(
'dlinkap-cpu',
$this->getDeviceId(),
$this->getDevice()['sysObjectID'] . '.5.1.3.0', // different OID for each model
$this->getDeviceArray()['sysObjectID'] . '.5.1.3.0', // different OID for each model
0,
'Processor',
100
)
);
];
}
}

View File

@ -40,7 +40,7 @@ class Dnos extends OS implements ProcessorDiscovery
*/
public function discoverProcessors()
{
$device = $this->getDevice();
$device = $this->getDeviceArray();
$processors = array();
if (Str::startsWith($device['sysObjectID'], '.1.3.6.1.4.1.6027.1.3')) {

View File

@ -25,6 +25,7 @@
namespace LibreNMS\OS;
use App\Models\Device;
use Illuminate\Support\Str;
use LibreNMS\Device\Processor;
use LibreNMS\Interfaces\Discovery\ProcessorDiscovery;
@ -32,6 +33,37 @@ use LibreNMS\OS;
class Edgecos extends OS implements ProcessorDiscovery
{
public function discoverOS(Device $device): void
{
if (Str::startsWith($device->sysObjectID, '.1.3.6.1.4.1.259.6.')) { //ES3528M0
$tmp_mib = 'ES3528MO-MIB';
} elseif (Str::startsWith($device->sysObjectID, '.1.3.6.1.4.1.259.10.1.22.')) { //ES3528MV2
$tmp_mib = 'ES3528MV2-MIB';
} elseif (Str::startsWith($device->sysObjectID, '.1.3.6.1.4.1.259.10.1.24.')) { //ECS4510
$tmp_mib = 'ECS4510-MIB';
} elseif (Str::startsWith($device->sysObjectID, '.1.3.6.1.4.1.259.10.1.39.')) { //ECS4110
$tmp_mib = 'ECS4110-MIB';
} elseif (Str::startsWith($device->sysObjectID, '.1.3.6.1.4.1.259.10.1.42.')) { //ECS4210
$tmp_mib = 'ECS4210-MIB';
} elseif (Str::startsWith($device->sysObjectID, '.1.3.6.1.4.1.259.10.1.27.')) { //ECS3510
$tmp_mib = 'ECS3510-MIB';
} elseif (Str::startsWith($device->sysObjectID, '.1.3.6.1.4.1.259.10.1.45.')) { //ECS4120
$tmp_mib = 'ECS4120-MIB';
} elseif (Str::startsWith($device->sysObjectID, '.1.3.6.1.4.1.259.8.1.11')) { //ES3510MA
$tmp_mib = 'ES3510MA-MIB';
} elseif (Str::startsWith($device->sysObjectID, '.1.3.6.1.4.1.259.10.1.43.')) { //ECS2100
$tmp_mib = 'ECS2100-MIB';
} else {
return;
}
$data = snmp_get_multi($this->getDeviceArray(), ['swOpCodeVer.1', 'swProdName.0', 'swSerialNumber.1', 'swHardwareVer.1'], '-OQUs', $tmp_mib);
$device->version = trim($data[1]['swHardwareVer'] . ' ' . $data[1]['swOpCodeVer']) ?: null;
$device->hardware = $data[0]['swProdName'] ?? null;
$device->serial = $data[1]['swSerialNumber'] ?? null;
}
/**
* Discover processors.
* Returns an array of LibreNMS\Device\Processor objects that have been discovered
@ -42,19 +74,19 @@ class Edgecos extends OS implements ProcessorDiscovery
{
$device = $this->getDevice();
if (Str::startsWith($device['sysObjectID'], '.1.3.6.1.4.1.259.10.1.24.')) { //ECS4510
if (Str::startsWith($device->sysObjectID, '.1.3.6.1.4.1.259.10.1.24.')) { //ECS4510
$oid = '.1.3.6.1.4.1.259.10.1.24.1.39.2.1.0';
} elseif (Str::startsWith($device['sysObjectID'], '.1.3.6.1.4.1.259.10.1.22.')) { //ECS3528
} elseif (Str::startsWith($device->sysObjectID, '.1.3.6.1.4.1.259.10.1.22.')) { //ECS3528
$oid = '.1.3.6.1.4.1.259.10.1.22.1.39.2.1.0';
} elseif (Str::startsWith($device['sysObjectID'], '.1.3.6.1.4.1.259.10.1.39.')) { //ECS4110
} elseif (Str::startsWith($device->sysObjectID, '.1.3.6.1.4.1.259.10.1.39.')) { //ECS4110
$oid = '.1.3.6.1.4.1.259.10.1.39.1.39.2.1.0';
} elseif (Str::startsWith($device['sysObjectID'], '.1.3.6.1.4.1.259.10.1.45.')) { //ECS4120
} elseif (Str::startsWith($device->sysObjectID, '.1.3.6.1.4.1.259.10.1.45.')) { //ECS4120
$oid = '.1.3.6.1.4.1.259.10.1.45.1.39.2.1.0';
} elseif (Str::startsWith($device['sysObjectID'], '.1.3.6.1.4.1.259.10.1.42.')) { //ECS4210
} elseif (Str::startsWith($device->sysObjectID, '.1.3.6.1.4.1.259.10.1.42.')) { //ECS4210
$oid = '.1.3.6.1.4.1.259.10.1.42.101.1.39.2.1.0';
} elseif (Str::startsWith($device['sysObjectID'], '.1.3.6.1.4.1.259.10.1.27.')) { //ECS3510
} elseif (Str::startsWith($device->sysObjectID, '.1.3.6.1.4.1.259.10.1.27.')) { //ECS3510
$oid = '.1.3.6.1.4.1.259.10.1.27.1.39.2.1.0';
} elseif (Str::startsWith($device['sysObjectID'], '.1.3.6.1.4.1.259.8.1.11.')) { //ES3510MA
} elseif (Str::startsWith($device->sysObjectID, '.1.3.6.1.4.1.259.8.1.11.')) { //ES3510MA
$oid = '.1.3.6.1.4.1.259.8.1.11.1.39.2.1.0';
};

View File

@ -1,8 +1,8 @@
<?php
/**
* microsemipdsine.inc.php
* Edgeos.php
*
* LibreNMS OS poller module for Microsemi PowerDsine PoE Midspans
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -19,20 +19,23 @@
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2017 Lorenzo Zafra
* @author Lorenzo Zafra<zafra@ualberta.;a>
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
preg_match('~(?<hardware>.*)\..*=(?<serial>\d*)\.\s+\w+\s+\w+=(?<version>.*)~', $device['sysDescr'], $matches);
if ($matches['hardware'] == 'Midspan') {
$hardware = 'PoE Midspan';
}
namespace LibreNMS\OS;
if ($matches['serial']) {
$serial = $matches['serial'];
}
use App\Models\Device;
if ($matches['version']) {
$data = explode(', ', $matches['version']);
$version = $data[0];
class Edgeos extends \LibreNMS\OS
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
$hw = snmp_get($this->getDeviceArray(), ['.1.3.6.1.2.1.25.4.2.1.5.3818', '.1.3.6.1.2.1.25.4.2.1.5.3819'], '-Ovq');
if (preg_match('/(?<=UBNT )(.*)(?= running on)/', $hw, $matches)) {
$this->getDevice()->hardware = $matches[0];
}
}
}

View File

@ -25,27 +25,26 @@
namespace LibreNMS\OS;
use App\Models\Device;
use Illuminate\Support\Str;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\OS;
class Endrun extends OS implements OSDiscovery
{
public function discoverOS(): void
public function discoverOS(Device $device): void
{
$device = $this->getDeviceModel();
$sysDescr = snmp_get($this->getDevice(), 'sysDescr.0', '-OvQ', 'SNMPv2-MIB');
if (strpos($sysDescr, "Sonoma") !==false) {
$info = snmp_get_multi($this->getDevice(), ['gntpVersion.0', 'snmpSetSerialNo.0'], '-OQUs', 'SONOMA-MIB:SNMPv2-MIB');
if (Str::contains($device->sysDescr, 'Sonoma')) {
$info = snmp_get_multi($this->getDeviceArray(), ['gntpVersion.0', 'snmpSetSerialNo.0'], '-OQUs', 'SONOMA-MIB:SNMPv2-MIB');
// The gntpVersion string output is rather long. Ex. Sonoma_D12 GPS 6010-0065-000 v 3.04 - Sep 24 22:58:19 2019
preg_match('/(.+) v (.+) - /', $info[0]['gntpVersion'], $matches);
$device->hardware = $matches[1] ?? null;
// The EndRun Sonoma D12 does not report a system capbility (cdmaVersion) like the Tempus devices.
// The EndRun Sonoma D12 does not report a system capability (cdmaVersion) like the Tempus devices.
$device->serial = $info[0]['snmpSetSerialNo'] ?? null;
} else {
$info = snmp_get_multi($this->getDevice(), ['cntpVersion.0', 'cdmaVersion.0', 'snmpSetSerialNo.0'], '-OQUs', 'TEMPUSLXUNISON-MIB:SNMPv2-MIB');
$info = snmp_get_multi($this->getDeviceArray(), ['cntpVersion.0', 'cdmaVersion.0', 'snmpSetSerialNo.0'], '-OQUs', 'TEMPUSLXUNISON-MIB:SNMPv2-MIB');
$device->features = $info[0]['cdmaVersion'] ?? null;
$device->serial = $info[0]['snmpSetSerialNo'] ?? null;
// The cntpVersion string output is rather long. Ex. Tempus LX CDMA 6010-0042-000 v 5.70 - Wed Oct 1 04:39:21 UTC 2014

View File

@ -59,7 +59,7 @@ class Ewc extends OS implements
'HIPATH-WIRELESS-HWC-MIB::licenseLocalAP.0',
'HIPATH-WIRELESS-HWC-MIB::licenseForeignAP.0'
);
$data = snmp_get_multi($this->getDevice(), $oids);
$data = snmp_get_multi($this->getDeviceArray(), $oids);
$licCount = $data[0]['licenseLocalAP'] + $data[0]['licenseForeignAP'];
return array(
new WirelessSensor(
@ -105,7 +105,7 @@ class Ewc extends OS implements
)
);
$apstats = snmpwalk_cache_oid($this->getDevice(), 'apStatsMuCounts', array(), 'HIPATH-WIRELESS-HWC-MIB');
$apstats = snmpwalk_cache_oid($this->getDeviceArray(), 'apStatsMuCounts', array(), 'HIPATH-WIRELESS-HWC-MIB');
$apnames = $this->getCacheByIndex('apName', 'HIPATH-WIRELESS-HWC-MIB');
foreach ($apstats as $index => $entry) {
@ -122,7 +122,7 @@ class Ewc extends OS implements
);
}
$wlanstats = snmpwalk_cache_oid($this->getDevice(), 'wlanStatsAssociatedClients', array(), 'HIPATH-WIRELESS-HWC-MIB');
$wlanstats = snmpwalk_cache_oid($this->getDeviceArray(), 'wlanStatsAssociatedClients', array(), 'HIPATH-WIRELESS-HWC-MIB');
$wlannames = $this->getCacheByIndex('wlanName', 'HIPATH-WIRELESS-HWC-MIB');
foreach ($wlanstats as $index => $entry) {
@ -147,7 +147,7 @@ class Ewc extends OS implements
*/
public function discoverWirelessErrors()
{
$oids = snmpwalk_cache_oid($this->getDevice(), 'apPerfRadioPktRetx', array(), 'HIPATH-WIRELESS-HWC-MIB');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'apPerfRadioPktRetx', array(), 'HIPATH-WIRELESS-HWC-MIB');
$ap_interfaces = $this->getCacheByIndex('apName', 'HIPATH-WIRELESS-HWC-MIB');
$sensors = array();
@ -173,7 +173,7 @@ class Ewc extends OS implements
*/
public function discoverWirelessFrequency()
{
$oids = snmpwalk_cache_oid($this->getDevice(), 'apRadioStatusChannel', array(), 'HIPATH-WIRELESS-HWC-MIB');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'apRadioStatusChannel', array(), 'HIPATH-WIRELESS-HWC-MIB');
$ap_interfaces = $this->getCacheByIndex('ifName', 'IF-MIB');
$sensors = array();
@ -199,7 +199,7 @@ class Ewc extends OS implements
*/
public function discoverWirelessNoiseFloor()
{
$oids = snmpwalk_cache_oid($this->getDevice(), 'dot11ExtRadioMaxNfCount', array(), 'HIPATH-WIRELESS-DOT11-EXTNS-MIB');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'dot11ExtRadioMaxNfCount', array(), 'HIPATH-WIRELESS-DOT11-EXTNS-MIB');
$ap_interfaces = $this->getCacheByIndex('ifName', 'IF-MIB');
$sensors = array();
@ -232,7 +232,7 @@ class Ewc extends OS implements
*/
public function discoverWirelessRssi()
{
$oids = snmpwalk_cache_oid($this->getDevice(), 'apPerfRadioCurrentRSS', array(), 'HIPATH-WIRELESS-HWC-MIB');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'apPerfRadioCurrentRSS', array(), 'HIPATH-WIRELESS-HWC-MIB');
$ap_interfaces = $this->getCacheByIndex('apName', 'HIPATH-WIRELESS-HWC-MIB');
$sensors = array();
@ -258,7 +258,7 @@ class Ewc extends OS implements
*/
public function discoverWirelessSnr()
{
$oids = snmpwalk_cache_oid($this->getDevice(), 'apPerfRadioCurrentSNR', array(), 'HIPATH-WIRELESS-HWC-MIB');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'apPerfRadioCurrentSNR', array(), 'HIPATH-WIRELESS-HWC-MIB');
$ap_interfaces = $this->getCacheByIndex('apName', 'HIPATH-WIRELESS-HWC-MIB');
$sensors = array();
@ -284,7 +284,7 @@ class Ewc extends OS implements
*/
public function discoverWirelessUtilization()
{
$oids = snmpwalk_cache_oid($this->getDevice(), 'apPerfRadioCurrentChannelUtilization', array(), 'HIPATH-WIRELESS-HWC-MIB');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'apPerfRadioCurrentChannelUtilization', array(), 'HIPATH-WIRELESS-HWC-MIB');
$ap_interfaces = $this->getCacheByIndex('apName', 'HIPATH-WIRELESS-HWC-MIB');
$sensors = array();

View File

@ -25,20 +25,20 @@
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\OS;
class Exa extends OS implements OSDiscovery
{
public function discoverOS(): void
public function discoverOS(Device $device): void
{
$device = $this->getDeviceModel();
$info = snmp_getnext_multi($this->getDevice(), 'e7CardSoftwareVersion e7CardSerialNumber', '-OQUs', 'E7-Calix-MIB');
$info = snmp_getnext_multi($this->getDeviceArray(), ['e7CardSoftwareVersion', 'e7CardSerialNumber'], '-OQUs', 'E7-Calix-MIB');
$device->version = $info['e7CardSoftwareVersion'];
$device->serial = $info['e7CardSerialNumber'];
$device->hardware = "Calix " . $device->sysDescr;
$cards = explode("\n", snmp_walk($this->getDevice(), 'e7CardProvType', '-OQv', 'E7-Calix-MIB'));
$cards = explode("\n", snmp_walk($this->getDeviceArray(), 'e7CardProvType', '-OQv', 'E7-Calix-MIB'));
$card_count = [];
foreach ($cards as $card) {
$card_count[$card] = ($card_count[$card] ?? 0) + 1;

View File

@ -1,8 +1,8 @@
<?php
/**
* coriant.inc.php
/*
* Extremeware.php
*
* LibreNMS os poller module for Coriant
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -19,8 +19,13 @@
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2017 Neil Lathwood
* @author Neil Lathwood <neil@lathwood.co.uk>
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
require 'includes/polling/os/misc/tnms-nbi.inc.php';
namespace LibreNMS\OS;
class Extremeware extends Shared\Extreme
{
}

120
LibreNMS/OS/Fabos.php Normal file
View File

@ -0,0 +1,120 @@
<?php
/**
* Fabos.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\OS;
class Fabos extends OS implements OSDiscovery
{
public function discoverOS(Device $device): void
{
$device->version = snmp_get($this->getDeviceArray(), 'swFirmwareVersion.0', '-Ovq', 'SYSTEM-MIB');
$module = snmp_get($this->getDeviceArray(), 'fcFeModuleObjectID.1', '-Ovqn', 'FIBRE-CHANNEL-FE-MIB');
$revboard = str_replace('.1.3.6.1.4.1.1588.2.1.1.', '', $module);
$device->hardware = $this->fcSwitchModelToName($revboard);
}
protected function fcSwitchModelToName($model)
{
$models = [
'1' => 'Brocade 1000 Switch',
'2' => 'Brocade 2800 Switch',
'3' => 'Brocade 2100/2400 Switch',
'4' => 'Brocade 20x0 Switch',
'5' => 'Brocade 22x0 Switch',
'6' => 'Brocade 2800 Switch',
'7' => 'Brocade 2000 Switch',
'9' => 'Brocade 3800 Switch',
'10' => 'Brocade 12000 Director',
'12' => 'Brocade 3900 Switch',
'16' => 'Brocade 3200 Switch',
'18' => 'Brocade 3000 Switch',
'21' => 'Brocade 24000 Director',
'22' => 'Brocade 3016 Switch',
'26' => 'Brocade 3850 Switch',
'27' => 'Brocade 3250 Switch',
'29' => 'Brocade 4012 Embedded Switch',
'32' => 'Brocade 4100 Switch',
'33' => 'Brocade 3014 Switch',
'34' => 'Brocade 200E Switch',
'37' => 'Brocade 4020 Embedded Switch',
'38' => 'Brocade 7420 SAN Router',
'40' => 'Fibre Channel Routing (FCR) Front Domain',
'41' => 'Fibre Channel Routing (FCR) Xlate Domain',
'42' => 'Brocade 48000 Director',
'43' => 'Brocade 4024 Embedded Switch',
'44' => 'Brocade 4900 Switch',
'45' => 'Brocade 4016 Embedded Switch',
'46' => 'Brocade 7500 Switch',
'51' => 'Brocade 4018 Embedded Switch',
'55.2' => 'Brocade 7600 Switch',
'58' => 'Brocade 5000 Switch',
'61' => 'Brocade 4424 Embedded Switch',
'62' => 'Brocade DCX Backbone',
'64' => 'Brocade 5300 Switch',
'66' => 'Brocade 5100 Switch',
'67' => 'Brocade Encryption Switch',
'69' => 'Brocade 5410 Blade',
'70' => 'Brocade 5410 Embedded Switch',
'71' => 'Brocade 300 Switch',
'72' => 'Brocade 5480 Embedded Switch',
'73' => 'Brocade 5470 Embedded Switch',
'75' => 'Brocade M5424 Embedded Switch',
'76' => 'Brocade 8000 Switch',
'77' => 'Brocade DCX-4S Backbone',
'83' => 'Brocade 7800 Extension Switch',
'86' => 'Brocade 5450 Embedded Switch',
'87' => 'Brocade 5460 Embedded Switch',
'90' => 'Brocade 8470 Embedded Switch',
'92' => 'Brocade VA-40FC Switch',
'95' => 'Brocade VDX 6720-24 Data Center Switch',
'96' => 'Brocade VDX 6730-32 Data Center Switch',
'97' => 'Brocade VDX 6720-60 Data Center Switch',
'98' => 'Brocade VDX 6720-76 Data Center Switch',
'108' => 'Dell M84280k FCoE Embedded Switch',
'109' => 'Brocade 6510 Switch',
'116' => 'Brocade VDX 6710 Data Center Switch',
'117' => 'Brocade 6547 Embedded Switch',
'118' => 'Brocade 6505 Switch',
'120' => 'Brocade DCX 8510-8 Backbone',
'121' => 'Brocade DCX 8510-4 Backbone',
'124' => 'Brocade 5430 Switch',
'125' => 'Brocade 5431 Switch',
'129' => 'Brocade 6548 Switch',
'130' => 'Brocade M6505 Switch',
'133' => 'Brocade 6520 Switch',
'134' => 'Brocade 5432 Switch',
'148' => 'Brocade 7840 Switch',
'162' => 'Brocade G620 Switch',
'170' => 'Brocade G610 Switch',
];
return $models[$model] ?? 'Unknown Brocade FC Switch';
}
}

72
LibreNMS/OS/Fortigate.php Normal file
View File

@ -0,0 +1,72 @@
<?php
/*
* Fortigate.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\OS\Shared\Fortinet;
use LibreNMS\RRD\RrdDefinition;
class Fortigate extends Fortinet implements OSPolling
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
$device->hardware = $device->hardware ?: $this->getHardwareName();
}
public function pollOS()
{
$sessions = snmp_get($this->getDeviceArray(), 'FORTINET-FORTIGATE-MIB::fgSysSesCount.0', '-Ovq');
if (is_numeric($sessions)) {
$rrd_def = RrdDefinition::make()->addDataset('sessions', 'GAUGE', 0, 3000000);
print "Sessions: $sessions\n";
$fields = [
'sessions' => $sessions,
];
$tags = compact('rrd_def');
app()->make('Datastore')->put($this->getDeviceArray(), 'fortigate_sessions', $tags, $fields);
$this->enableGraph('fortigate_sessions');
}
$cpu_usage = snmp_get($this->getDeviceArray(), 'FORTINET-FORTIGATE-MIB::fgSysCpuUsage.0', '-Ovq');
if (is_numeric($cpu_usage)) {
$rrd_def = RrdDefinition::make()->addDataset('LOAD', 'GAUGE', -1, 100);
echo "CPU: $cpu_usage%\n";
$fields = [
'LOAD' => $cpu_usage,
];
$tags = compact('rrd_def');
app()->make('Datastore')->put($this->getDeviceArray(), 'fortigate_cpu', $tags, $fields);
$this->enableGraph('fortigate_cpu');
}
}
}

56
LibreNMS/OS/Fortios.php Normal file
View File

@ -0,0 +1,56 @@
<?php
/*
* Fortios.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\OS\Shared\Fortinet;
use LibreNMS\RRD\RrdDefinition;
class Fortios extends Fortinet implements OSPolling
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
$device->hardware = $device->hardware ?: $this->getHardwareName();
$device->features = snmp_get($this->getDeviceArray(), 'fmDeviceEntMode.1', '-OQv', 'FORTINET-FORTIMANAGER-FORTIANALYZER-MIB') == 'fmg-faz' ? 'with Analyzer features' : null;
}
public function pollOS()
{
// Log rate only for FortiAnalyzer features enabled FortiManagers
if ($this->getDevice()->features == 'with Analyzer features') {
$log_rate = snmp_get($this->getDeviceArray(), '.1.3.6.1.4.1.12356.103.2.1.9.0', '-Ovq');
$log_rate = str_replace(' logs per second', '', $log_rate);
$rrd_def = RrdDefinition::make()->addDataset('lograte', 'GAUGE', 0, 100000000);
$fields = ['lograte' => $log_rate,];
$tags = compact('rrd_def');
app()->make('Datastore')->put($this->getDeviceArray(), 'fortios_lograte', $tags, $fields);
$this->enableGraph('fortios_lograte');
}
}
}

View File

@ -42,8 +42,8 @@ class FsGbn extends OS implements ProcessorDiscovery
$processors = [];
// Test first pair of OIDs from GBNPlatformOAM-MIB
$processors_data = snmpwalk_cache_oid($this->getDevice(), 'cpuDescription', [], 'GBNPlatformOAM-MIB', 'fs');
$processors_data = snmpwalk_cache_oid($this->getDevice(), 'cpuIdle', $processors_data, 'GBNPlatformOAM-MIB', 'fs');
$processors_data = snmpwalk_cache_oid($this->getDeviceArray(), 'cpuDescription', [], 'GBNPlatformOAM-MIB', 'fs');
$processors_data = snmpwalk_cache_oid($this->getDeviceArray(), 'cpuIdle', $processors_data, 'GBNPlatformOAM-MIB', 'fs');
foreach ($processors_data as $index => $entry) {
$processors[] = Processor::discover(
$this->getName(),

View File

@ -42,7 +42,7 @@ class FsSwitch extends OS implements ProcessorDiscovery
$processors = [];
// Tests OID from SWITCH MIB.
$processors_data = snmpwalk_cache_oid($this->getDevice(), 'ssCpuIdle', [], 'SWITCH', 'fs');
$processors_data = snmpwalk_cache_oid($this->getDeviceArray(), 'ssCpuIdle', [], 'SWITCH', 'fs');
foreach ($processors_data as $index => $entry) {
$processors[] = Processor::discover(

View File

@ -25,7 +25,41 @@
namespace LibreNMS\OS;
use App\Models\Device;
class Ftos extends Dnos
{
// not sure why this is a separate OS
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
$device = $this->getDevice();
$device->hardware = $this->getHardware();
}
protected function getHardware()
{
$hardware = [
'.1.3.6.1.4.1.6027.1.1.1' => 'E1200',
'.1.3.6.1.4.1.6027.1.1.2' => 'E600',
'.1.3.6.1.4.1.6027.1.1.3' => 'E300',
'.1.3.6.1.4.1.6027.1.1.4' => 'E610',
'.1.3.6.1.4.1.6027.1.1.5' => 'E1200i',
'.1.3.6.1.4.1.6027.1.2.1' => 'C300',
'.1.3.6.1.4.1.6027.1.2.2' => 'C150',
'.1.3.6.1.4.1.6027.1.3.1' => 'S50',
'.1.3.6.1.4.1.6027.1.3.2' => 'S50E',
'.1.3.6.1.4.1.6027.1.3.3' => 'S50V',
'.1.3.6.1.4.1.6027.1.3.4' => 'S25P-AC',
'.1.3.6.1.4.1.6027.1.3.5' => 'S2410CP',
'.1.3.6.1.4.1.6027.1.3.6' => 'S2410P',
'.1.3.6.1.4.1.6027.1.3.7' => 'S50N-AC',
'.1.3.6.1.4.1.6027.1.3.8' => 'S50N-DC',
'.1.3.6.1.4.1.6027.1.3.9' => 'S25P-DC',
'.1.3.6.1.4.1.6027.1.3.10' => 'S25V',
'.1.3.6.1.4.1.6027.1.3.11' => 'S25N',
];
return $hardware[$this->getDevice()->sysObjectID] ?? null;
}
}

View File

@ -24,15 +24,15 @@
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\OS;
class Gepulsar extends OS implements OSDiscovery
{
public function discoverOS(): void
public function discoverOS(Device $device): void
{
$device = $this->getDeviceModel();
$info = snmp_getnext_multi($this->getDevice(), 'ne843Ps1Sn ne843Ps1Verw ne843Ps1Brc', '-OQUs', 'NE843-MIB');
$info = snmp_getnext_multi($this->getDeviceArray(), ['ne843Ps1Sn','ne843Ps1Verw','ne843Ps1Brc'], '-OQUs', 'NE843-MIB');
$device->version = $info['ne843Ps1Verw'];
$device->hardware = $info['ne843Ps1Brc'];
$device->serial = $info['ne843Ps1Sn'];

View File

@ -2,18 +2,18 @@
namespace LibreNMS\OS;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessErrorsDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessPowerDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRssiDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessSnrDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessPowerDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessErrorsDiscovery;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\OS;
class HarmonyEnhanced extends OS implements WirelessRssiDiscovery, WirelessSnrDiscovery, WirelessPowerDiscovery, WirelessErrorsDiscovery
{
public function discoverWirelessRssi()
{
$oids = snmpwalk_cache_oid($this->getDevice(), 'mwrEmcRadioRSL', array(), 'MWR-RADIO-MC-MIB', null, '-Ob');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'mwrEmcRadioRSL', array(), 'MWR-RADIO-MC-MIB', null, '-Ob');
$sensors = array();
foreach ($oids as $index => $entry) {
$sensors[] = new WirelessSensor(
@ -33,7 +33,7 @@ class HarmonyEnhanced extends OS implements WirelessRssiDiscovery, WirelessSnrDi
public function discoverWirelessSnr()
{
$oids = snmpwalk_cache_oid($this->getDevice(), 'mwrEmcRadioSNR', array(), 'MWR-RADIO-MC-MIB', null, '-Ob');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'mwrEmcRadioSNR', array(), 'MWR-RADIO-MC-MIB', null, '-Ob');
$sensors = array();
foreach ($oids as $index => $entry) {
$sensors[] = new WirelessSensor(
@ -53,7 +53,7 @@ class HarmonyEnhanced extends OS implements WirelessRssiDiscovery, WirelessSnrDi
public function discoverWirelessPower()
{
$oids = snmpwalk_cache_oid($this->getDevice(), 'mwrEmcRadioActualTxPower', array(), 'MWR-RADIO-MC-MIB', null, '-Ob');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'mwrEmcRadioActualTxPower', array(), 'MWR-RADIO-MC-MIB', null, '-Ob');
$sensors = array();
foreach ($oids as $index => $entry) {
$sensors[] = new WirelessSensor(
@ -73,7 +73,7 @@ class HarmonyEnhanced extends OS implements WirelessRssiDiscovery, WirelessSnrDi
public function discoverWirelessErrors()
{
$oids = snmpwalk_cache_oid($this->getDevice(), 'mwrEmcRadioRxErrsFrames', array(), 'MWR-RADIO-MC-MIB', null, '-Ob');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'mwrEmcRadioRxErrsFrames', array(), 'MWR-RADIO-MC-MIB', null, '-Ob');
$sensors = array();
foreach ($oids as $index => $entry) {
$sensors[] = new WirelessSensor(

View File

@ -69,7 +69,7 @@ class Helios extends OS implements WirelessFrequencyDiscovery, WirelessPowerDisc
private function discoverOid($type, $oid, $oid_prefix)
{
$oids = snmpwalk_cache_oid($this->getDevice(), $oid, array(), 'IGNITENET-MIB');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), $oid, array(), 'IGNITENET-MIB');
$sensors = array();
foreach ($oids as $index => $data) {

View File

@ -27,11 +27,11 @@ namespace LibreNMS\OS;
use LibreNMS\Device\Processor;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\ProcessorDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessClientsDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessFrequencyDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessNoiseFloorDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessPowerDiscovery;
use LibreNMS\Interfaces\Discovery\ProcessorDiscovery;
use LibreNMS\Interfaces\Polling\Sensors\WirelessFrequencyPolling;
use LibreNMS\Interfaces\Polling\Sensors\WirelessNoiseFloorPolling;
use LibreNMS\OS;
@ -53,7 +53,7 @@ class HiveosWireless extends OS implements
*/
public function discoverProcessors()
{
$device = $this->getDevice();
$device = $this->getDeviceArray();
return array(
Processor::discover(
$this->getName(),
@ -92,7 +92,7 @@ class HiveosWireless extends OS implements
public function discoverWirelessFrequency()
{
$ahRadioName = $this->getCacheByIndex('ahIfName', 'AH-INTERFACE-MIB');
$data = snmpwalk_group($this->getDevice(), 'ahRadioChannel', 'AH-INTERFACE-MIB');
$data = snmpwalk_group($this->getDeviceArray(), 'ahRadioChannel', 'AH-INTERFACE-MIB');
foreach ($data as $index => $frequency) {
$sensors[] = new WirelessSensor(
'frequency',
@ -118,7 +118,7 @@ class HiveosWireless extends OS implements
$sensors = array();
$ahRadioName = $this->getCacheByIndex('ahIfName', 'AH-INTERFACE-MIB');
$ahTxPow = snmpwalk_group($this->getDevice(), 'ahRadioTxPower', 'AH-INTERFACE-MIB');
$ahTxPow = snmpwalk_group($this->getDeviceArray(), 'ahRadioTxPower', 'AH-INTERFACE-MIB');
foreach ($ahTxPow as $index => $entry) {
$sensors[] = new WirelessSensor(
'power',
@ -136,7 +136,7 @@ class HiveosWireless extends OS implements
public function discoverWirelessNoiseFloor()
{
$ahRadioName = $this->getCacheByIndex('ahIfName', 'AH-INTERFACE-MIB');
$ahRadioNoiseFloor = snmpwalk_group($this->getDevice(), 'ahRadioNoiseFloor', 'AH-INTERFACE-MIB');
$ahRadioNoiseFloor = snmpwalk_group($this->getDeviceArray(), 'ahRadioNoiseFloor', 'AH-INTERFACE-MIB');
$sensors = array();
foreach ($ahRadioNoiseFloor as $index => $entry) {
$sensors[] = new WirelessSensor(
@ -162,7 +162,7 @@ class HiveosWireless extends OS implements
public function pollWirelessNoiseFloor(array $sensors)
{
$data = [];
$ahRadioNoiseFloor = snmpwalk_group($this->getDevice(), 'ahRadioNoiseFloor', 'AH-INTERFACE-MIB');
$ahRadioNoiseFloor = snmpwalk_group($this->getDeviceArray(), 'ahRadioNoiseFloor', 'AH-INTERFACE-MIB');
foreach ($sensors as $sensor) {
$data[$sensor['sensor_id']] = $ahRadioNoiseFloor[$sensor['sensor_index']]['ahRadioNoiseFloor'] - 256;
}

View File

@ -25,18 +25,17 @@
namespace LibreNMS\OS;
use App\Models\Device;
use Illuminate\Support\Str;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\OS;
class Ifotec extends OS implements OSDiscovery
{
public function discoverOS(): void
public function discoverOS(Device $device): void
{
$device = $this->getDeviceModel();
if (Str::startsWith($device->sysObjectID, '.1.3.6.1.4.1.21362.100.')) {
$ifoSysProductIndex = snmp_get($this->getDevice(), 'ifoSysProductIndex.0', '-Oqv', 'IFOTEC-SMI');
$ifoSysProductIndex = snmp_get($this->getDeviceArray(), 'ifoSysProductIndex.0', '-Oqv', 'IFOTEC-SMI');
if ($ifoSysProductIndex !== null) {
$oids = [
@ -44,7 +43,7 @@ class Ifotec extends OS implements OSDiscovery
'ifoSysFirmware.' . $ifoSysProductIndex,
'ifoSysBootloader.' . $ifoSysProductIndex
];
$data = snmp_get_multi($this->getDevice(), $oids, ['-OQUs'], 'IFOTEC-SMI');
$data = snmp_get_multi($this->getDeviceArray(), $oids, ['-OQUs'], 'IFOTEC-SMI');
$device->version = $data[1]['ifoSysFirmware'] . " (Bootloader " . $data[1]['ifoSysBootloader'] . ")";
$device->serial = $data[1]['ifoSysSerialNumber'];
@ -52,6 +51,6 @@ class Ifotec extends OS implements OSDiscovery
}
// sysDecr struct = (<product_reference> . ' : ' . <product_description>) OR (<product_reference>)
list($device->hardware) = explode(' : ', $device->sysDescr, 2);
[$device->hardware] = explode(' : ', $device->sysDescr, 2);
}
}

View File

@ -0,0 +1,54 @@
<?php
/*
* InfineraGroove.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
class InfineraGroove extends \LibreNMS\OS
{
public function discoverOS(Device $device): void
{
$oid_list = [
'neType.0',
'softwareloadSwloadState.1',
'softwareloadSwloadState.2',
'softwareloadSwloadVersion.1',
'softwareloadSwloadVersion.2',
'inventoryManufacturerNumber.shelf.1.0.0.0',
];
$data = snmp_get_multi($this->getDeviceArray(), $oid_list, '-OUQs', 'CORIANT-GROOVE-MIB');
foreach ($data as $value) {
if (isset($value['softwareloadSwloadState']) && $value['softwareloadSwloadState'] == 'active') {
$device->version = $value['softwareloadSwloadVersion'];
break;
}
}
$device->hardware = $data[0]['neType'] ?? null;
$device->serial = $data['shelf.1.0.0.0']['inventoryManufacturerNumber'] ?? null;
}
}

View File

@ -43,15 +43,15 @@ class Ios extends Cisco implements
*/
public function discoverWirelessClients()
{
$device = $this->getDevice();
$device = $this->getDeviceArray();
if (!Str::startsWith($device['hardware'], 'AIR-') && !Str::contains($device['hardware'], 'ciscoAIR')) {
// unsupported IOS hardware
return array();
return [];
}
$data = snmpwalk_cache_oid($device, 'cDot11ActiveWirelessClients', array(), 'CISCO-DOT11-ASSOCIATION-MIB');
$entPhys = snmpwalk_cache_oid($device, 'entPhysicalDescr', array(), 'ENTITY-MIB');
$data = snmpwalk_cache_oid($device, 'cDot11ActiveWirelessClients', [], 'CISCO-DOT11-ASSOCIATION-MIB');
$entPhys = snmpwalk_cache_oid($device, 'entPhysicalDescr', [], 'ENTITY-MIB');
// fixup incorrect/missing entPhysicalIndex mapping
foreach ($data as $index => $_unused) {
@ -68,7 +68,7 @@ class Ios extends Cisco implements
}
}
$sensors = array();
$sensors = [];
foreach ($data as $index => $entry) {
$sensors[] = new WirelessSensor(
'clients',

59
LibreNMS/OS/Iosxr.php Normal file
View File

@ -0,0 +1,59 @@
<?php
/**
* Iosxr.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
class Iosxr extends Shared\Cisco implements OSDiscovery
{
public function discoverOS(Device $device): void
{
$device->serial = $this->getMainSerial();
if (preg_match('/^Cisco IOS XR Software \(Cisco ([^\)]+)\),\s+Version ([^\[]+)\[([^\]]+)\]/', $device->sysDescr, $regexp_result)) {
$device->hardware = $regexp_result[1];
$device->features = $regexp_result[3];
$device->version = $regexp_result[2];
} elseif (preg_match('/^Cisco IOS XR Software \(([^\)]+)\),\s+Version\s+([^\s]+)/', $device->sysDescr, $regexp_result)) {
$device->hardware = $regexp_result[1];
$device->version = $regexp_result[2];
}
$oids = ['entPhysicalSoftwareRev.1', 'entPhysicalModelName.8384513', 'entPhysicalModelName.8384518'];
$data = snmp_get_multi($this->getDeviceArray(), $oids, '-OQUs', 'ENTITY-MIB');
if (!empty($data[1]['entPhysicalSoftwareRev'])) {
$device->version = $data[1]['entPhysicalSoftwareRev'];
}
if (!empty($data[8384513]['entPhysicalModelName'])) {
$device->hardware = $data[8384513]['entPhysicalModelName'];
} elseif (!empty($data[8384518]['entPhysicalModelName'])) {
$device->hardware = $data[8384518]['entPhysicalModelName'];
}
}
}

View File

@ -6,7 +6,7 @@ use LibreNMS\Interfaces\Discovery\Sensors\WirelessFrequencyDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRateDiscovery;
use LibreNMS\OS;
class Ird extends OS implements
class Ird extends OS\Shared\Unix implements
WirelessFrequencyDiscovery,
WirelessRateDiscovery
{

View File

@ -25,9 +25,444 @@
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\OS\Shared\Foundry;
class Ironware extends Foundry
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
$device->hardware = $this->getHardware();
}
private function getHardware()
{
$rewrite_ironware_hardware = [
'snFIWGSwitch' => 'Stackable FastIron workgroup',
'snFIBBSwitch' => 'Stackable FastIron backbone',
'snNIRouter' => 'Stackable NetIron',
'snSI' => 'Stackable ServerIron',
'snSIXL' => 'Stackable ServerIronXL',
'snSIXLTCS' => 'Stackable ServerIronXL TCS',
'snTISwitch' => 'Stackable TurboIron',
'snTIRouter' => 'Stackable TurboIron',
'snT8Switch' => 'Stackable TurboIron 8',
'snT8Router' => 'Stackable TurboIron 8',
'snT8SIXLG' => 'Stackable ServerIronXLG',
'snBI4000Switch' => 'BigIron 4000',
'snBI4000Router' => 'BigIron 4000',
'snBI4000SI' => 'BigServerIron',
'snBI8000Switch' => 'BigIron 8000',
'snBI8000Router' => 'BigIron 8000',
'snBI8000SI' => 'BigServerIron',
'snFI2Switch' => 'FastIron II',
'snFI2Router' => 'FastIron II',
'snFI2PlusSwitch' => 'FastIron II Plus',
'snFI2PlusRouter' => 'FastIron II Plus',
'snNI400Router' => 'NetIron 400',
'snNI800Router' => 'NetIron 800',
'snFI2GCSwitch' => 'FastIron II GC',
'snFI2GCRouter' => 'FastIron II GC',
'snFI2PlusGCSwitch' => 'FastIron II Plus GC',
'snFI2PlusGCRouter' => 'FastIron II Plus GC',
'snBI15000Switch' => 'BigIron 15000',
'snBI15000Router' => 'BigIron 15000',
'snNI1500Router' => 'NetIron 1500',
'snFI3Switch' => 'FastIron III',
'snFI3Router' => 'FastIron III',
'snFI3GCSwitch' => 'FastIron III GC',
'snFI3GCRouter' => 'FastIron III GC',
'snSI400Switch' => 'ServerIron 400',
'snSI400Router' => 'ServerIron 400',
'snSI800Switch' => 'ServerIron800',
'snSI800Router' => 'ServerIron800',
'snSI1500Switch' => 'ServerIron1500',
'snSI1500Router' => 'ServerIron1500',
'sn4802Switch' => 'Stackable 4802',
'sn4802Router' => 'Stackable 4802',
'sn4802SI' => 'Stackable 4802 ServerIron',
'snFI400Switch' => 'FastIron 400',
'snFI400Router' => 'FastIron 400',
'snFI800Switch' => 'FastIron800',
'snFI800Router' => 'FastIron800',
'snFI1500Switch' => 'FastIron1500',
'snFI1500Router' => 'FastIron1500',
'snFES2402' => 'FES 2402',
'snFES2402Switch' => 'FES2402',
'snFES2402Router' => 'FES2402',
'snFES4802' => 'FES 4802',
'snFES4802Switch' => 'FES4802',
'snFES4802Router' => 'FES4802',
'snFES9604' => 'FES 9604',
'snFES9604Switch' => 'FES9604',
'snFES9604Router' => 'FES9604',
'snFES12GCF' => 'FES 12GCF ',
'snFES12GCFSwitch' => 'FES12GCF ',
'snFES12GCFRouter' => 'FES12GCF',
'snFES2402P' => 'FES 2402 POE ',
'snFES4802P' => 'FES 4802 POE ',
'snNI4802Switch' => 'NetIron 4802',
'snNI4802Router' => 'NetIron 4802',
'snBIMG8Switch' => 'BigIron MG8',
'snBIMG8Router' => 'BigIron MG8',
'snNI40GRouter' => 'NetIron 40G',
'snFESX424' => 'FES 24G',
'snFESX424Switch' => 'FESX424',
'snFESX424Router' => 'FESX424',
'snFESX424Prem' => 'FES 24G-PREM',
'snFESX424PremSwitch' => 'FESX424-PREM',
'snFESX424PremRouter' => 'FESX424-PREM',
'snFESX424Plus1XG' => 'FES 24G + 1 10G',
'snFESX424Plus1XGSwitch' => 'FESX424+1XG',
'snFESX424Plus1XGRouter' => 'FESX424+1XG',
'snFESX424Plus1XGPrem' => 'FES 24G + 1 10G-PREM',
'snFESX424Plus1XGPremSwitch' => 'FESX424+1XG-PREM',
'snFESX424Plus1XGPremRouter' => 'FESX424+1XG-PREM',
'snFESX424Plus2XG' => 'FES 24G + 2 10G',
'snFESX424Plus2XGSwitch' => 'FESX424+2XG',
'snFESX424Plus2XGRouter' => 'FESX424+2XG',
'snFESX424Plus2XGPrem' => 'FES 24G + 2 10G-PREM',
'snFESX424Plus2XGPremSwitch' => 'FESX424+2XG-PREM',
'snFESX424Plus2XGPremRouter' => 'FESX424+2XG-PREM',
'snFESX448' => 'FES 48G',
'snFESX448Switch' => 'FESX448',
'snFESX448Router' => 'FESX448',
'snFESX448Prem' => 'FES 48G-PREM',
'snFESX448PremSwitch' => 'FESX448-PREM',
'snFESX448PremRouter' => 'FESX448-PREM',
'snFESX448Plus1XG' => 'FES 48G + 1 10G',
'snFESX448Plus1XGSwitch' => 'FESX448+1XG',
'snFESX448Plus1XGRouter' => 'FESX448+1XG',
'snFESX448Plus1XGPrem' => 'FES 48G + 1 10G-PREM',
'snFESX448Plus1XGPremSwitch' => 'FESX448+1XG-PREM',
'snFESX448Plus1XGPremRouter' => 'FESX448+1XG-PREM',
'snFESX448Plus2XG' => 'FES 48G + 2 10G',
'snFESX448Plus2XGSwitch' => 'FESX448+2XG',
'snFESX448Plus2XGRouter' => 'FESX448+2XG',
'snFESX448Plus2XGPrem' => 'FES 48G + 2 10G-PREM',
'snFESX448Plus2XGPremSwitch' => 'FESX448+2XG-PREM',
'snFESX448Plus2XGPremRouter' => 'FESX448+2XG-PREM',
'snFESX424Fiber' => 'FESFiber 24G',
'snFESX424FiberSwitch' => 'FESX424Fiber',
'snFESX424FiberRouter' => 'FESX424Fiber',
'snFESX424FiberPrem' => 'FESFiber 24G-PREM',
'snFESX424FiberPremSwitch' => 'FESX424Fiber-PREM',
'snFESX424FiberPremRouter' => 'FESX424Fiber-PREM',
'snFESX424FiberPlus1XG' => 'FESFiber 24G + 1 10G',
'snFESX424FiberPlus1XGSwitch' => 'FESX424Fiber+1XG',
'snFESX424FiberPlus1XGRouter' => 'FESX424Fiber+1XG',
'snFESX424FiberPlus1XGPrem' => 'FESFiber 24G + 1 10G-PREM',
'snFESX424FiberPlus1XGPremSwitch' => 'FESX424Fiber+1XG-PREM',
'snFESX424FiberPlus1XGPremRouter' => 'FESX424Fiber+1XG-PREM',
'snFESX424FiberPlus2XG' => 'FESFiber 24G + 2 10G',
'snFESX424FiberPlus2XGSwitch' => 'FESX424Fiber+2XG',
'snFESX424FiberPlus2XGRouter' => 'FESX424Fiber+2XG',
'snFESX424FiberPlus2XGPrem' => 'FESFiber 24G + 2 10G-PREM',
'snFESX424FiberPlus2XGPremSwitch' => 'FESX424Fiber+2XG-PREM',
'snFESX424FiberPlus2XGPremRouter' => 'FESX424Fiber+2XG-PREM',
'snFESX448Fiber' => 'FESFiber 48G',
'snFESX448FiberSwitch' => 'FESX448Fiber',
'snFESX448FiberRouter' => 'FESX448Fiber',
'snFESX448FiberPrem' => 'FESFiber 48G-PREM',
'snFESX448FiberPremSwitch' => 'FESX448Fiber-PREM',
'snFESX448FiberPremRouter' => 'FESX448Fiber-PREM',
'snFESX448FiberPlus1XG' => 'FESFiber 48G + 1 10G',
'snFESX448FiberPlus1XGSwitch' => 'FESX448Fiber+1XG',
'snFESX448FiberPlus1XGRouter' => 'FESX448Fiber+1XG',
'snFESX448FiberPlus1XGPrem' => 'FESFiber 48G + 1 10G-PREM',
'snFESX448FiberPlus1XGPremSwitch' => 'FESX448Fiber+1XG-PREM',
'snFESX448FiberPlus1XGPremRouter' => 'FESX448Fiber+1XG-PREM',
'snFESX448FiberPlus2XG' => 'FESFiber 48G + 2 10G',
'snFESX448FiberPlus2XGSwitch' => 'FESX448Fiber+2XG',
'snFESX448FiberPlus2XGRouter' => 'FESX448+2XG',
'snFESX448FiberPlus2XGPrem' => 'FESFiber 48G + 2 10G-PREM',
'snFESX448FiberPlus2XGPremSwitch' => 'FESX448Fiber+2XG-PREM',
'snFESX448FiberPlus2XGPremRouter' => 'FESX448Fiber+2XG-PREM',
'snFESX424P' => 'FES 24G POE',
'snFESX624' => 'FastIron Edge V6 Switch(FES) 24G',
'snFESX624Switch' => 'FESX624',
'snFESX624Router' => 'FESX624',
'snFESX624Prem' => 'FastIron Edge V6 Switch(FES) 24G-PREM',
'snFESX624PremSwitch' => 'FESX624-PREM',
'snFESX624PremRouter' => 'FESX624-PREM',
'snFESX624Plus1XG' => 'FastIron Edge V6 Switch(FES) 24G + 1 10G',
'snFESX624Plus1XGSwitch' => 'FESX624+1XG',
'snFESX624Plus1XGRouter' => 'FESX624+1XG',
'snFESX624Plus1XGPrem' => 'FastIron Edge V6 Switch(FES) 24G + 1 10G-PREM',
'snFESX624Plus1XGPremSwitch' => 'FESX624+1XG-PREM',
'snFESX624Plus1XGPremRouter' => 'FESX624+1XG-PREM',
'snFESX624Plus2XG' => 'FastIron Edge V6 Switch(FES) 24G + 2 10G',
'snFESX624Plus2XGSwitch' => 'FESX624+2XG',
'snFESX624Plus2XGRouter' => 'FESX624+2XG',
'snFESX624Plus2XGPrem' => 'FastIron Edge V6 Switch(FES) 24G + 2 10G-PREM',
'snFESX624Plus2XGPremSwitch' => 'FESX624+2XG-PREM',
'snFESX624Plus2XGPremRouter' => 'FESX624+2XG-PREM',
'snFESX648' => 'FastIron Edge V6 Switch(FES) 48G',
'snFESX648Switch' => 'FESX648',
'snFESX648Router' => 'FESX648',
'snFESX648Prem' => 'FastIron Edge V6 Switch(FES) 48G-PREM',
'snFESX648PremSwitch' => 'FESX648-PREM',
'snFESX648PremRouter' => 'FESX648-PREM',
'snFESX648Plus1XG' => 'FastIron Edge V6 Switch(FES) 48G + 1 10G',
'snFESX648Plus1XGSwitch' => 'FESX648+1XG',
'snFESX648Plus1XGRouter' => 'FESX648+1XG',
'snFESX648Plus1XGPrem' => 'FastIron Edge V6 Switch(FES) 48G + 1 10G-PREM',
'snFESX648Plus1XGPremSwitch' => 'FESX648+1XG-PREM',
'snFESX648Plus1XGPremRouter' => 'FESX648+1XG-PREM',
'snFESX648Plus2XG' => 'FastIron Edge V6 Switch(FES) 48G + 2 10G',
'snFESX648Plus2XGSwitch' => 'FESX648+2XG',
'snFESX648Plus2XGRouter' => 'FESX648+2XG',
'snFESX648Plus2XGPrem' => 'FastIron Edge V6 Switch(FES) 48G + 2 10G-PREM',
'snFESX648Plus2XGPremSwitch' => 'FESX648+2XG-PREM',
'snFESX648Plus2XGPremRouter' => 'FESX648+2XG-PREM',
'snFESX624Fiber' => 'FastIron V6 Edge Switch(FES)Fiber 24G',
'snFESX624FiberSwitch' => 'FESX624Fiber',
'snFESX624FiberRouter' => 'FESX624Fiber',
'snFESX624FiberPrem' => 'FastIron Edge V6 Switch(FES)Fiber 24G-PREM',
'snFESX624FiberPremSwitch' => 'FESX624Fiber-PREM',
'snFESX624FiberPremRouter' => 'FESX624Fiber-PREM',
'snFESX624FiberPlus1XG' => 'FastIron Edge V6 Switch(FES)Fiber 24G + 1 10G',
'snFESX624FiberPlus1XGSwitch' => 'FESX624Fiber+1XG',
'snFESX624FiberPlus1XGRouter' => 'FESX624Fiber+1XG',
'snFESX624FiberPlus1XGPrem' => 'FastIron Edge V6 Switch(FES)Fiber 24G + 1 10G-PREM',
'snFESX624FiberPlus1XGPremSwitch' => 'FESX624Fiber+1XG-PREM',
'snFESX624FiberPlus1XGPremRouter' => 'FESX624Fiber+1XG-PREM',
'snFESX624FiberPlus2XG' => 'FastIron Edge V6 Switch(FES)Fiber 24G + 2 10G',
'snFESX624FiberPlus2XGSwitch' => 'FESX624Fiber+2XG',
'snFESX624FiberPlus2XGRouter' => 'FESX624Fiber+2XG',
'snFESX624FiberPlus2XGPrem' => 'FastIron Edge V6 Switch(FES)Fiber 24G + 2 10G-PREM',
'snFESX624FiberPlus2XGPremSwitch' => 'FESX624Fiber+2XG-PREM',
'snFESX624FiberPlus2XGPremRouter' => 'FESX624Fiber+2XG-PREM',
'snFESX648Fiber' => 'FastIron Edge V6 Switch(FES)Fiber 48G',
'snFESX648FiberSwitch' => 'FESX648Fiber',
'snFESX648FiberRouter' => 'FESX648Fiber',
'snFESX648FiberPrem' => 'FastIron Edge V6 Switch(FES)Fiber 48G-PREM',
'snFESX648FiberPremSwitch' => 'FESX648Fiber-PREM',
'snFESX648FiberPremRouter' => 'FESX648Fiber-PREM',
'snFESX648FiberPlus1XG' => 'FastIron Edge V6 Switch(FES)Fiber 48G + 1 10G',
'snFESX648FiberPlus1XGSwitch' => 'FESX648Fiber+1XG',
'snFESX648FiberPlus1XGRouter' => 'FESX648Fiber+1XG',
'snFESX648FiberPlus1XGPrem' => 'FastIron Edge V6 Switch(FES)Fiber 48G + 1 10G-PREM',
'snFESX648FiberPlus1XGPremSwitch' => 'FESX648Fiber+1XG-PREM',
'snFESX648FiberPlus1XGPremRouter' => 'FESX648Fiber+1XG-PREM',
'snFESX648FiberPlus2XG' => 'FastIron Edge V6 Switch(FES)Fiber 48G + 2 10G',
'snFESX648FiberPlus2XGSwitch' => 'FESX648Fiber+2XG',
'snFESX648FiberPlus2XGRouter' => 'FESX648+2XG',
'snFESX648FiberPlus2XGPrem' => 'FastIron Edge V6 Switch(FES)Fiber 48G + 2 10G-PREM',
'snFESX648FiberPlus2XGPremSwitch' => 'FESX648Fiber+2XG-PREM',
'snFESX648FiberPlus2XGPremRouter' => 'FESX648Fiber+2XG-PREM',
'snFESX624P' => 'FastIron Edge V6 Switch(FES) 24G POE',
'snFWSX424' => 'FWSX24G',
'snFWSX424Switch' => 'FWSX424',
'FWSX24GSwitch' => 'FWSX424',
'snFWSX424Router' => 'FWSX424',
'snFWSX424Plus1XG' => 'FWSX24G + 1 10G',
'snFWSX424Plus1XGSwitch' => 'FWSX424+1XG',
'snFWSX424Plus1XGRouter' => 'FWSX424+1XG',
'snFWSX424Plus2XG' => 'FWSX24G + 2 10G',
'snFWSX424Plus2XGSwitch' => 'FWSX424+2XG',
'snFWSX424Plus2XGRouter' => 'FWSX424+2XG',
'snFWSX448' => 'FWSX48G',
'snFWSX448Switch' => 'FWSX448',
'snFWSX448Router' => 'FWSX448',
'snFWSX448Plus1XG' => 'FWSX48G + 1 10G',
'snFWSX448Plus1XGSwitch' => 'FWSX448+1XG',
'snFWSX448Plus1XGRouter' => 'FWSX448+1XG',
'snFWSX448Plus2XG' => 'FWSX448G+2XG',
'snFWSX448Plus2XGSwitch' => 'FWSX448+2XG',
'snFWSX448Plus2XGRouter' => 'FWSX448+2XG',
'snFastIronSuperXFamily' => 'FastIron SuperX Family',
'snFastIronSuperX' => 'FastIron SuperX',
'snFastIronSuperXSwitch' => 'FastIron SuperX Switch',
'snFastIronSuperXRouter' => 'FastIron SuperX Router',
'snFastIronSuperXBaseL3Switch' => 'FastIron SuperX Base L3 Switch',
'snFastIronSuperXPrem' => 'FastIron SuperX Premium',
'snFastIronSuperXPremSwitch' => 'FastIron SuperX Premium Switch',
'snFastIronSuperXPremRouter' => 'FastIron SuperX Premium Router',
'snFastIronSuperXPremBaseL3Switch' => 'FastIron SuperX Premium Base L3 Switch',
'snFastIronSuperX800' => 'FastIron SuperX 800 ',
'snFastIronSuperX800Switch' => 'FastIron SuperX 800 Switch',
'snFastIronSuperX800Router' => 'FastIron SuperX 800 Router',
'snFastIronSuperX800BaseL3Switch' => 'FastIron SuperX 800 Base L3 Switch',
'snFastIronSuperX800Prem' => 'FastIron SuperX 800 Premium',
'snFastIronSuperX800PremSwitch' => 'FastIron SuperX 800 Premium Switch',
'snFastIronSuperX800PremRouter' => 'FastIron SuperX 800 Premium Router',
'snFastIronSuperX800PremBaseL3Switch' => 'FastIron SuperX 800 Premium Base L3 Switch',
'snFastIronSuperX1600' => 'FastIron SuperX 1600 ',
'snFastIronSuperX1600Switch' => 'FastIron SuperX 1600 Switch',
'snFastIronSuperX1600Router' => 'FastIron SuperX 1600 Router',
'snFastIronSuperX1600BaseL3Switch' => 'FastIron SuperX 1600 Base L3 Switch',
'snFastIronSuperX1600Prem' => 'FastIron SuperX 1600 Premium',
'snFastIronSuperX1600PremSwitch' => 'FastIron SuperX 1600 Premium Switch',
'snFastIronSuperX1600PremRouter' => 'FastIron SuperX 1600 Premium Router',
'snFastIronSuperX1600PremBaseL3Switch' => 'FastIron SuperX 1600 Premium Base L3 Switch',
'snFastIronSuperXV6' => 'FastIron SuperX V6 ',
'snFastIronSuperXV6Switch' => 'FastIron SuperX V6 Switch',
'snFastIronSuperXV6Router' => 'FastIron SuperX V6 Router',
'snFastIronSuperXV6BaseL3Switch' => 'FastIron SuperX V6 Base L3 Switch',
'snFastIronSuperXV6Prem' => 'FastIron SuperX V6 Premium',
'snFastIronSuperXV6PremSwitch' => 'FastIron SuperX V6 Premium Switch',
'snFastIronSuperXV6PremRouter' => 'FastIron SuperX V6 Premium Router',
'snFastIronSuperXV6PremBaseL3Switch' => 'FastIron SuperX V6 Premium Base L3 Switch',
'snFastIronSuperX800V6' => 'FastIron SuperX 800 V6 ',
'snFastIronSuperX800V6Switch' => 'FastIron SuperX 800 V6 Switch',
'snFastIronSuperX800V6Router' => 'FastIron SuperX 800 V6 Router',
'snFastIronSuperX800V6BaseL3Switch' => 'FastIron SuperX 800 V6 Base L3 Switch',
'snFastIronSuperX800V6Prem' => 'FastIron SuperX 800 V6 Premium',
'snFastIronSuperX800V6PremSwitch' => 'FastIron SuperX 800 Premium V6 Switch',
'snFastIronSuperX800V6PremRouter' => 'FastIron SuperX 800 Premium V6 Router',
'snFastIronSuperX800V6PremBaseL3Switch' => 'FastIron SuperX 800 Premium V6 Base L3 Switch',
'snFastIronSuperX1600V6' => 'FastIron SuperX 1600 V6 ',
'snFastIronSuperX1600V6Switch' => 'FastIron SuperX 1600 V6 Switch',
'snFastIronSuperX1600V6Router' => 'FastIron SuperX 1600 V6 Router',
'snFastIronSuperX1600V6BaseL3Switch' => 'FastIron SuperX 1600 V6 Base L3 Switch',
'snFastIronSuperX1600V6Prem' => 'FastIron SuperX 1600 Premium V6',
'snFastIronSuperX1600V6PremSwitch' => 'FastIron SuperX 1600 Premium V6 Switch',
'snFastIronSuperX1600V6PremRouter' => 'FastIron SuperX 1600 Premium V6 Router',
'snFastIronSuperX1600V6PremBaseL3Switch' => 'FastIron SuperX 1600 Premium V6 Base L3 Switch',
'snBigIronSuperXFamily' => 'BigIron SuperX Family',
'snBigIronSuperX' => 'BigIron SuperX',
'snBigIronSuperXSwitch' => 'BigIron SuperX Switch',
'snBigIronSuperXRouter' => 'BigIron SuperX Router',
'snBigIronSuperXBaseL3Switch' => 'BigIron SuperX Base L3 Switch',
'snTurboIronSuperXFamily' => 'TurboIron SuperX Family',
'snTurboIronSuperX' => 'TurboIron SuperX',
'snTurboIronSuperXSwitch' => 'TurboIron SuperX Switch',
'snTurboIronSuperXRouter' => 'TurboIron SuperX Router',
'snTurboIronSuperXBaseL3Switch' => 'TurboIron SuperX Base L3 Switch',
'snTurboIronSuperXPrem' => 'TurboIron SuperX Premium',
'snTurboIronSuperXPremSwitch' => 'TurboIron SuperX Premium Switch',
'snTurboIronSuperXPremRouter' => 'TurboIron SuperX Premium Router',
'snTurboIronSuperXPremBaseL3Switch' => 'TurboIron SuperX Premium Base L3 Switch',
'snNIIMRRouter' => 'NetIron IMR',
'snBIRX16Switch' => 'BigIron RX16',
'snBIRX16Router' => 'BigIron RX16',
'snBIRX8Switch' => 'BigIron RX8',
'snBIRX8Router' => 'BigIron RX8',
'snBIRX4Switch' => 'BigIron RX4',
'snBIRX4Router' => 'BigIron RX4',
'snBIRX32Switch' => 'BigIron RX32',
'snBIRX32Router' => 'BigIron RX32',
'snNIXMR16000Router' => 'NetIron XMR16000',
'snNIXMR8000Router' => 'NetIron XMR8000',
'snNIXMR4000Router' => 'NetIron XMR4000',
'snNIXMR32000Router' => 'NetIron XMR32000',
'snSecureIronLS100' => 'SecureIronLS 100',
'snSecureIronLS100Switch' => 'SecureIronLS 100 Switch',
'snSecureIronLS100Router' => 'SecureIronLS 100 Router',
'snSecureIronLS300' => 'SecureIronLS 300',
'snSecureIronLS300Switch' => 'SecureIronLS 300 Switch',
'snSecureIronLS300Router' => 'SecureIronLS 300 Router',
'snSecureIronTM100' => 'SecureIronTM 100',
'snSecureIronTM100Switch' => 'SecureIronTM 100 Switch',
'snSecureIronTM100Router' => 'SecureIronTM 100 Router',
'snSecureIronTM300' => 'SecureIronTM 300',
'snSecureIronTM300Switch' => 'SecureIronTM 300 Switch',
'snSecureIronTM300Router' => 'SecureIronTM 300 Router',
'snNetIronMLX16Router' => 'NetIron MLX-16',
'snNetIronMLX8Router' => 'NetIron MLX-8',
'snNetIronMLX4Router' => 'NetIron MLX-4',
'snNetIronMLX32Router' => 'NetIron MLX-32',
'snFGS624P' => 'FastIron FGS624P',
'snFGS624PSwitch' => 'FGS624P',
'snFGS624PRouter' => 'FGS624P',
'snFGS624XGP' => 'FastIron FGS624XGP',
'snFGS624XGPSwitch' => 'FGS624XGP',
'snFGS624XGPRouter' => 'FGS624XGP',
'snFGS624PP' => 'FastIron FGS624XGP',
'snFGS624XGPP' => 'FGS624XGP-POE',
'snFGS648P' => 'FastIron GS FGS648P',
'snFGS648PSwitch' => 'FastIron FGS648P',
'snFGS648PRouter' => 'FastIron FGS648P',
'snFGS648PP' => 'FastIron FGS648P-POE',
'snFLS624' => 'FastIron FLS624',
'snFLS624Switch' => 'FastIron FLS624',
'snFLS624Router' => 'FastIron FLS624',
'snFLS648' => 'FastIron FLS648',
'snFLS648Switch' => 'FastIron FLS648',
'snFLS648Router' => 'FastIron FLS648',
'snSI100' => 'ServerIron SI100',
'snSI100Switch' => 'ServerIron SI100',
'snSI100Router' => 'ServerIron SI100',
'snSI350' => 'ServerIron 350 series',
'snSI350Switch' => 'SI350',
'snSI350Router' => 'SI350',
'snSI450' => 'ServerIron 450 series',
'snSI450Switch' => 'SI450',
'snSI450Router' => 'SI450',
'snSI850' => 'ServerIron 850 series',
'snSI850Switch' => 'SI850',
'snSI850Router' => 'SI850',
'snSI350Plus' => 'ServerIron 350 Plus series',
'snSI350PlusSwitch' => 'SI350 Plus',
'snSI350PlusRouter' => 'SI350 Plus',
'snSI450Plus' => 'ServerIron 450 Plus series',
'snSI450PlusSwitch' => 'SI450 Plus',
'snSI450PlusRouter' => 'SI450 Plus',
'snSI850Plus' => 'ServerIron 850 Plus series',
'snSI850PlusSwitch' => 'SI850 Plus',
'snSI850PlusRouter' => 'SI850 Plus',
'snServerIronGTc' => 'ServerIronGT C series',
'snServerIronGTcSwitch' => 'ServerIronGT C',
'snServerIronGTcRouter' => 'ServerIronGT C',
'snServerIronGTe' => 'ServerIronGT E series',
'snServerIronGTeSwitch' => 'ServerIronGT E',
'snServerIronGTeRouter' => 'ServerIronGT E',
'snServerIronGTePlus' => 'ServerIronGT E Plus series',
'snServerIronGTePlusSwitch' => 'ServerIronGT E Plus',
'snServerIronGTePlusRouter' => 'ServerIronGT E Plus',
'snServerIron4G' => 'ServerIron4G series',
'snServerIron4GSwitch' => 'ServerIron4G',
'snServerIron4GRouter' => 'ServerIron4G',
'wirelessAp' => 'wireless access point',
'wirelessProbe' => 'wireless probe',
'ironPointMobility' => 'IronPoint Mobility Series',
'ironPointMC' => 'IronPoint Mobility Controller',
'dcrs7504Switch' => 'DCRS-7504',
'dcrs7504Router' => 'DCRS-7504',
'dcrs7508Switch' => 'DCRS-7508',
'dcrs7508Router' => 'DCRS-7508',
'dcrs7515Switch' => 'DCRS-7515',
'dcrs7515Router' => 'DCRS-7515',
'snCes2024F' => 'NetIron CES 2024F',
'snCes2024C' => 'NetIron CES 2024C',
'snCes2048F' => 'NetIron CES 2048F',
'snCes2048C' => 'NetIron CES 2048C',
'snCes2048FX' => 'NetIron CES 2048F + 2x10G',
'snCes2048CX' => 'NetIron CES 2048C + 2x10G',
'snCer2024F' => 'NetIron CER 2024F',
'snCer2024C' => 'NetIron CER 2024C',
'snCer2048F' => 'NetIron CER 2048F',
'snCer2048C' => 'NetIron CER 2048C',
'snCer2048FX' => 'NetIron CER 2048F + 2x10G',
'snCer2048CX' => 'NetIron CER 2048C + 2x10G',
'snTI2X24Router' => 'Stackable TurboIron-X24',
'snBrocadeMLXe4Router' => 'NetIron MLXe-4',
'snBrocadeMLXe8Router' => 'NetIron MLXe-8',
'snBrocadeMLXe16Router' => 'NetIron MLXe-16',
'snBrocadeMLXe32Router' => 'NetIron MLXe-32',
'snICX643024Switch' => 'Brocade ICX 6430 24-port Switch',
'snICX643048Switch' => 'Brocade ICX 6430 48-port Switch',
'snICX645024Switch' => 'Brocade ICX 6450 24-port Switch',
'snICX645048Switch' => 'Brocade ICX 6450 48-port Switch',
'snICX661024Switch' => 'Brocade ICX 6610 24-port Switch',
'snICX661048Switch' => 'Brocade ICX 6610 48-port Switch',
'snICX665064Switch' => 'Brocade ICX 6650 64-port Switch',
'snICX725024Switch' => 'Brocade ICX 7250 24-port Switch',
'snICX725048Switch' => 'Brocade ICX 7250 48-port Switch',
'snICX745024Switch' => 'Brocade ICX 7450 24-port Switch',
'snICX745048Switch' => 'Brocade ICX 7450 48-port Switch',
'snFastIronStackICX6430Switch' => 'Brocade ICX 6430 Switch stack',
'snFastIronStackICX6450Switch' => 'Brocade ICX 6450 Switch stack',
'snFastIronStackICX6610Switch' => 'Brocade ICX 6610 Switch stack',
'snFastIronStackICX7250Switch' => 'Brocade ICX 7250 Switch stack',
'snFastIronStackICX7450Switch' => 'Brocade ICX 7450 Switch stack',
'snFastIronStackICX7750Switch' => 'Brocade ICX 7750 Switch stack',
];
$hardware = snmp_translate($this->getDevice()->sysObjectID, 'FOUNDRY-SN-ROOT-MIB', null, null, $this->getDeviceArray());
return array_str_replace($rewrite_ironware_hardware, $hardware);
}
}

48
LibreNMS/OS/Jetdirect.php Normal file
View File

@ -0,0 +1,48 @@
<?php
/*
* Jetdirect.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
class Jetdirect extends \LibreNMS\OS\Shared\Printer
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
$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'];
if (!empty($hardware)) {
$hardware = str_ireplace([
'HP ',
'Hewlett-Packard ',
' Series',
], '', $hardware);
$device->hardware = ucfirst($hardware);
}
}
}

67
LibreNMS/OS/Junos.php Normal file
View File

@ -0,0 +1,67 @@
<?php
/*
* Junos.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\RRD\RrdDefinition;
class Junos extends \LibreNMS\OS implements OSPolling
{
public function discoverOS(Device $device): void
{
$data = snmp_get_multi($this->getDeviceArray(), [
'JUNIPER-MIB::jnxBoxDescr.0',
'JUNIPER-MIB::jnxBoxSerialNo.0',
'JUNIPER-VIRTUALCHASSIS-MIB::jnxVirtualChassisMemberSWVersion.0',
'HOST-RESOURCES-MIB::hrSWInstalledName.2',
], '-OQUs');
preg_match('/Juniper Networks, Inc. (?<hardware>\S+) .* kernel JUNOS (?<version>[^, ]+)[, ]/', $device->sysDescr, $parsed);
if (isset($data[2]['hrSWInstalledName'])) {
preg_match('/\[(.+)]/', $data[2]['hrSWInstalledName'], $parsedVersion);
}
$device->hardware = $data[0]['jnxBoxDescr'] ?? (isset($parsed['hardware']) ? 'Juniper ' . strtoupper($parsed['hardware']) : null);
$device->serial = $data[0]['jnxBoxSerialNo'] ?? null;
$device->version = $data[0]['jnxVirtualChassisMemberSWVersion'] ?? $parsedVersion[1] ?? $parsed['version'] ?? null;
}
public function pollOS()
{
$data = snmp_get_multi($this->getDeviceArray(), 'jnxJsSPUMonitoringCurrentFlowSession.0', '-OUQs', 'JUNIPER-SRX5000-SPU-MONITORING-MIB');
if (is_numeric($data[0]['jnxJsSPUMonitoringCurrentFlowSession'])) {
data_update($this->getDeviceArray(), 'junos_jsrx_spu_sessions', [
'rrd_def' => RrdDefinition::make()->addDataset('spu_flow_sessions', 'GAUGE', 0),
], [
'spu_flow_sessions' => $data[0]['jnxJsSPUMonitoringCurrentFlowSession'],
]);
$this->enableGraph('junos_jsrx_spu_sessions');
}
}
}

View File

@ -26,14 +26,14 @@
namespace LibreNMS\OS;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessFrequencyDiscovery;
use LibreNMS\Interfaces\Polling\Sensors\WirelessFrequencyPolling;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessCapacityDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessCcqDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessFrequencyDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessNoiseFloorDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessPowerDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessCcqDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRateDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRssiDiscovery;
use LibreNMS\Interfaces\Polling\Sensors\WirelessFrequencyPolling;
use LibreNMS\OS;
use LibreNMS\Util\Rewrite;
@ -69,7 +69,7 @@ class Lcos extends OS implements
*/
public function discoverWirelessFrequency()
{
$data = snmpwalk_cache_oid($this->getDevice(), 'lcsStatusWlanRadiosEntryRadioChannel', [], 'LCOS-MIB');
$data = snmpwalk_cache_oid($this->getDeviceArray(), 'lcsStatusWlanRadiosEntryRadioChannel', [], 'LCOS-MIB');
$radios = $this->getCacheByIndex('lcsStatusWlanRadiosEntryIfc', 'LCOS-MIB');
$sensors = [];
@ -111,7 +111,7 @@ class Lcos extends OS implements
*/
public function discoverWirelessCapacity()
{
$data = snmpwalk_cache_oid($this->getDevice(), 'lcsStatusWlanRadiosEntryModemLoad', [], 'LCOS-MIB');
$data = snmpwalk_cache_oid($this->getDeviceArray(), 'lcsStatusWlanRadiosEntryModemLoad', [], 'LCOS-MIB');
$radios = $this->getCacheByIndex('lcsStatusWlanRadiosEntryIfc', 'LCOS-MIB');
$sensors = [];
@ -141,7 +141,7 @@ class Lcos extends OS implements
*/
public function discoverWirelessNoiseFloor()
{
$data = snmpwalk_cache_oid($this->getDevice(), 'lcsStatusWlanRadiosEntryNoiseLevel', [], 'LCOS-MIB');
$data = snmpwalk_cache_oid($this->getDeviceArray(), 'lcsStatusWlanRadiosEntryNoiseLevel', [], 'LCOS-MIB');
$radios = $this->getCacheByIndex('lcsStatusWlanRadiosEntryIfc', 'LCOS-MIB');
$sensors = [];
@ -171,7 +171,7 @@ class Lcos extends OS implements
*/
public function discoverWirelessPower()
{
$data = snmpwalk_cache_oid($this->getDevice(), 'lcsStatusWlanRadiosEntryTransmitPower', [], 'LCOS-MIB');
$data = snmpwalk_cache_oid($this->getDeviceArray(), 'lcsStatusWlanRadiosEntryTransmitPower', [], 'LCOS-MIB');
$radios = $this->getCacheByIndex('lcsStatusWlanRadiosEntryIfc', 'LCOS-MIB');
$sensors = [];
@ -202,8 +202,8 @@ class Lcos extends OS implements
*/
public function discoverWirelessCcq()
{
$data = snmpwalk_cache_oid($this->getDevice(), 'lcsStatusWlanCompetingNetworksEntryPhySignal', [], 'LCOS-MIB');
$data = snmpwalk_cache_oid($this->getDevice(), 'lcsStatusWlanCompetingNetworksEntryInterpointPeerName', $data, 'LCOS-MIB');
$data = snmpwalk_cache_oid($this->getDeviceArray(), 'lcsStatusWlanCompetingNetworksEntryPhySignal', [], 'LCOS-MIB');
$data = snmpwalk_cache_oid($this->getDeviceArray(), 'lcsStatusWlanCompetingNetworksEntryInterpointPeerName', $data, 'LCOS-MIB');
$bssids = $this->getCacheByIndex('lcsStatusWlanCompetingNetworksEntryBssid', 'LCOS-MIB');
$sensors = [];
@ -234,8 +234,8 @@ class Lcos extends OS implements
*/
public function discoverWirelessRate()
{
$data = snmpwalk_cache_oid($this->getDevice(), 'lcsStatusWlanCompetingNetworksEntryEffRate', [], 'LCOS-MIB');
$data = snmpwalk_cache_oid($this->getDevice(), 'lcsStatusWlanCompetingNetworksEntryInterpointPeerName', $data, 'LCOS-MIB');
$data = snmpwalk_cache_oid($this->getDeviceArray(), 'lcsStatusWlanCompetingNetworksEntryEffRate', [], 'LCOS-MIB');
$data = snmpwalk_cache_oid($this->getDeviceArray(), 'lcsStatusWlanCompetingNetworksEntryInterpointPeerName', $data, 'LCOS-MIB');
$bssids = $this->getCacheByIndex('lcsStatusWlanCompetingNetworksEntryBssid', 'LCOS-MIB');
$sensors = [];
@ -267,8 +267,8 @@ class Lcos extends OS implements
*/
public function discoverWirelessRssi()
{
$data = snmpwalk_cache_oid($this->getDevice(), 'lcsStatusWlanCompetingNetworksEntrySignalLevel', [], 'LCOS-MIB');
$data = snmpwalk_cache_oid($this->getDevice(), 'lcsStatusWlanCompetingNetworksEntryInterpointPeerName', $data, 'LCOS-MIB');
$data = snmpwalk_cache_oid($this->getDeviceArray(), 'lcsStatusWlanCompetingNetworksEntrySignalLevel', [], 'LCOS-MIB');
$data = snmpwalk_cache_oid($this->getDeviceArray(), 'lcsStatusWlanCompetingNetworksEntryInterpointPeerName', $data, 'LCOS-MIB');
$bssids = $this->getCacheByIndex('lcsStatusWlanCompetingNetworksEntryBssid', 'LCOS-MIB');
$sensors = [];

View File

@ -25,6 +25,7 @@
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessErrorRatioDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessFrequencyDiscovery;
@ -42,6 +43,13 @@ class Mimosa extends OS implements
WirelessRateDiscovery,
WirelessSnrDiscovery
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
$device->hardware = snmp_translate($device->sysObjectID, 'MIMOSA-NETWORKS-BASE-MIB', null, null, $this->getDeviceArray());
}
/**
* 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
@ -113,7 +121,7 @@ class Mimosa extends OS implements
// ptmp radios
$ptmpRadioName = $this->getCacheByIndex('mimosaPtmpChPwrRadioName', 'MIMOSA-NETWORKS-PTMP-MIB');
$ptmpFreq = snmpwalk_group($this->getDevice(), 'mimosaPtmpChPwrCntrFreqCur', 'MIMOSA-NETWORKS-PTMP-MIB');
$ptmpFreq = snmpwalk_group($this->getDeviceArray(), 'mimosaPtmpChPwrCntrFreqCur', 'MIMOSA-NETWORKS-PTMP-MIB');
foreach ($ptmpFreq as $index => $frequency) {
$sensors[] = new WirelessSensor(
@ -145,7 +153,7 @@ class Mimosa extends OS implements
{
// FIXME: is Noise different from Noise Floor?
$polar = $this->getCacheByIndex('mimosaPolarization', 'MIMOSA-NETWORKS-BFIVE-MIB');
$oids = snmpwalk_cache_oid($this->getDevice(), 'mimosaRxNoise', array(), 'MIMOSA-NETWORKS-BFIVE-MIB');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'mimosaRxNoise', array(), 'MIMOSA-NETWORKS-BFIVE-MIB');
$sensors = array();
foreach ($oids as $index => $entry) {
@ -176,8 +184,8 @@ class Mimosa extends OS implements
// ptp radios
$polar = $this->getCacheByIndex('mimosaPolarization', 'MIMOSA-NETWORKS-BFIVE-MIB');
$oids = snmpwalk_cache_oid($this->getDevice(), 'mimosaTxPower', array(), 'MIMOSA-NETWORKS-BFIVE-MIB');
$oids = snmpwalk_cache_oid($this->getDevice(), 'mimosaRxPower', $oids, 'MIMOSA-NETWORKS-BFIVE-MIB');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'mimosaTxPower', array(), 'MIMOSA-NETWORKS-BFIVE-MIB');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'mimosaRxPower', $oids, 'MIMOSA-NETWORKS-BFIVE-MIB');
foreach ($oids as $index => $entry) {
$sensors[] = new WirelessSensor(
@ -206,7 +214,7 @@ class Mimosa extends OS implements
// ptmp radios
$ptmpRadioName = $this->getCacheByIndex('mimosaPtmpChPwrRadioName', 'MIMOSA-NETWORKS-PTMP-MIB');
$ptmpTxPow = snmpwalk_group($this->getDevice(), 'mimosaPtmpChPwrTxPowerCur', 'MIMOSA-NETWORKS-PTMP-MIB');
$ptmpTxPow = snmpwalk_group($this->getDeviceArray(), 'mimosaPtmpChPwrTxPowerCur', 'MIMOSA-NETWORKS-PTMP-MIB');
foreach ($ptmpTxPow as $index => $entry) {
$sensors[] = new WirelessSensor(
@ -220,7 +228,7 @@ class Mimosa extends OS implements
);
}
$ptmpRxPow = snmpwalk_group($this->getDevice(), 'mimosaPtmpChPwrMinRxPower', 'MIMOSA-NETWORKS-PTMP-MIB');
$ptmpRxPow = snmpwalk_group($this->getDeviceArray(), 'mimosaPtmpChPwrMinRxPower', 'MIMOSA-NETWORKS-PTMP-MIB');
foreach ($ptmpRxPow as $index => $entry) {
$sensors[] = new WirelessSensor(
@ -245,8 +253,8 @@ class Mimosa extends OS implements
*/
public function discoverWirelessRate()
{
$oids = snmpwalk_cache_oid($this->getDevice(), 'mimosaTxPhy', array(), 'MIMOSA-NETWORKS-BFIVE-MIB');
$oids = snmpwalk_cache_oid($this->getDevice(), 'mimosaRxPhy', $oids, 'MIMOSA-NETWORKS-BFIVE-MIB');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'mimosaTxPhy', array(), 'MIMOSA-NETWORKS-BFIVE-MIB');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'mimosaRxPhy', $oids, 'MIMOSA-NETWORKS-BFIVE-MIB');
$sensors = array();
foreach ($oids as $index => $entry) {
@ -284,7 +292,7 @@ class Mimosa extends OS implements
public function discoverWirelessSnr()
{
$polar = $this->getCacheByIndex('mimosaPolarization', 'MIMOSA-NETWORKS-BFIVE-MIB');
$oids = snmpwalk_cache_oid($this->getDevice(), 'mimosaSNR', array(), 'MIMOSA-NETWORKS-BFIVE-MIB');
$oids = snmpwalk_cache_oid($this->getDeviceArray(), 'mimosaSNR', array(), 'MIMOSA-NETWORKS-BFIVE-MIB');
$sensors = array();
foreach ($oids as $index => $entry) {

View File

@ -39,7 +39,7 @@ class MoxaEtherdevice extends OS implements ProcessorDiscovery
*/
public function discoverProcessors()
{
$device = $this->getDevice();
$device = $this->getDeviceArray();
// Moxa people enjoy creating MIBs for each model!
// .1.3.6.1.4.1.8691.7.116.1.54.0 = MOXA-IKS6726A-MIB::cpuLoading30s.0

167
LibreNMS/OS/Netscaler.php Normal file
View File

@ -0,0 +1,167 @@
<?php
/*
* Netscaler.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\RRD\RrdDefinition;
class Netscaler extends \LibreNMS\OS implements OSPolling
{
public function pollOS()
{
echo ' IP';
// These are at the start of large trees that we don't want to walk the entirety of, so we snmp_get_multi them
$oids_gauge = [
'tcpCurServerConn',
'tcpCurClientConn',
'tcpActiveServerConn',
'tcpCurClientConnClosing',
'tcpCurServerConnEstablished',
'tcpCurClientConnOpening',
'tcpCurClientConnEstablished',
'tcpCurServerConnClosing',
'tcpSpareConn',
'tcpSurgeQueueLen',
'tcpCurServerConnOpening',
'tcpCurPhysicalServers',
'tcpReuseHit',
];
$oids_counter = [
'tcpTotServerConnOpened',
'tcpTotServerConnClosed',
'tcpTotClientConnOpened',
'tcpTotClientConnClosed',
'tcpTotSyn',
'tcpTotSynProbe',
'tcpTotSvrFin',
'tcpTotCltFin',
'tcpTotRxPkts',
'tcpTotRxBytes',
'tcpTotTxPkts',
'tcpTotTxBytes',
'tcpWaitToSyn',
'tcpTotZombieCltConnFlushed',
'tcpTotZombieSvrConnFlushed',
'tcpTotZombieHalfOpenCltConnFlushed',
'tcpTotZombieHalfOpenSvrConnFlushed',
'tcpTotZombieActiveHalfCloseCltConnFlushed',
'tcpTotZombieActiveHalfCloseSvrConnFlushed',
'tcpTotZombiePassiveHalfCloseCltConnFlushed',
'tcpTotZombiePassiveHalfCloseSrvConnFlushed',
'tcpErrBadCheckSum',
'tcpErrSynInSynRcvd',
'tcpErrSynInEst',
'tcpErrSynGiveUp',
'tcpErrSynSentBadAck',
'tcpErrSynRetry',
'tcpErrFinRetry',
'tcpErrFinGiveUp',
'tcpErrFinDup',
'tcpErrRst',
'tcpErrRstNonEst',
'tcpErrRstOutOfWindow',
'tcpErrRstInTimewait',
'tcpErrSvrRetrasmit',
'tcpErrCltRetrasmit',
'tcpErrFullRetrasmit',
'tcpErrPartialRetrasmit',
'tcpErrSvrOutOfOrder',
'tcpErrCltOutOfOrder',
'tcpErrCltHole',
'tcpErrSvrHole',
'tcpErrCookiePktSeqReject',
'tcpErrCookiePktSigReject',
'tcpErrCookiePktSeqDrop',
'tcpErrCookiePktMssReject',
'tcpErrRetransmit',
'tcpErrRetransmitGiveUp',
'pcbTotZombieCall',
'tcpTotSynHeld',
'tcpTotSynFlush',
'tcpTotFinWaitClosed',
'tcpErrAnyPortFail',
'tcpErrIpPortFail',
'tcpErrSentRst',
'tcpErrBadStateConn',
'tcpErrFastRetransmissions',
'tcpErrFirstRetransmissions',
'tcpErrSecondRetransmissions',
'tcpErrThirdRetransmissions',
'tcpErrForthRetransmissions',
'tcpErrFifthRetransmissions',
'tcpErrSixthRetransmissions',
'tcpErrSeventhRetransmissions',
'tcpErrDataAfterFin',
'tcpErrRstThreshold',
'tcpErrOutOfWindowPkts',
'tcpErrSynDroppedCongestion',
'tcpWaitData',
'tcpErrStrayPkt',
];
$oids = array_merge($oids_gauge, $oids_counter);
$data = snmpwalk_cache_oid($this->getDeviceArray(), 'nsTcpStatsGroup', [], 'NS-ROOT-MIB');
$shorten = [
'tcp',
'Active',
'Passive',
'Zombie',
];
$short_replacement = [
'',
'Ac',
'Ps',
'Zom',
];
$rrd_def = new RrdDefinition();
foreach ($oids_gauge as $oid) {
$oid_ds = str_replace($shorten, $short_replacement, $oid);
$rrd_def->addDataset($oid_ds, 'GAUGE', null, 100000000000);
}
foreach ($oids_counter as $oid) {
$oid_ds = str_replace($shorten, $short_replacement, $oid);
$rrd_def->addDataset($oid_ds, 'COUNTER', null, 100000000000);
}
$fields = [];
foreach ($oids as $oid) {
$fields[$oid] = is_numeric($data[0][$oid]) ? ':' . $data[0][$oid] : 'U';
}
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'netscaler-stats-tcp', $tags, $fields);
$this->enableGraph('netscaler_tcp_conn');
$this->enableGraph('netscaler_tcp_bits');
$this->enableGraph('netscaler_tcp_pkts');
}
}

View File

@ -24,15 +24,14 @@
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\OS;
class Netsure extends OS implements OSDiscovery
{
public function discoverOS(): void
public function discoverOS(Device $device): void
{
$device = $this->getDeviceModel();
$info = snmp_getnext_multi($this->getDevice(), 'vecFirmwareVersion', '-OQUs', 'VEC-MIBv5-9');
$device->version = $info['vecFirmwareVersion'];
$device->version = snmp_getnext($this->getDeviceArray(), 'vecFirmwareVersion', '-Oqv', 'VEC-MIBv5-9');
}
}

167
LibreNMS/OS/Nios.php Normal file
View File

@ -0,0 +1,167 @@
<?php
/*
* Nios.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\RRD\RrdDefinition;
class Nios extends \LibreNMS\OS implements OSPolling
{
public function pollOS()
{
##############
# Create ddns update rrd
##############
$mibs = 'IB-DNSONE-MIB';
$oids = [
'ibDDNSUpdateSuccess.0',
'ibDDNSUpdateFailure.0',
'ibDDNSUpdatePrerequisiteReject.0',
'ibDDNSUpdateReject.0',
];
$data = snmp_get_multi($this->getDeviceArray(), $oids, '-OQUs', $mibs);
$rrd_def = RrdDefinition::make()
->addDataset('success', 'DERIVE', 0)
->addDataset('failure', 'DERIVE', 0)
->addDataset('reject', 'DERIVE', 0)
->addDataset('prereq_reject', 'DERIVE', 0);
$fields = [
'success' => $data[0]['ibDDNSUpdateSuccess'],
'failure' => $data[0]['ibDDNSUpdateFailure'],
'reject' => $data[0]['ibDDNSUpdateReject'],
'prereq_reject' => $data[0]['ibDDNSUpdatePrerequisiteReject'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'ib_dns_dyn_updates', $tags, $fields);
$this->enableGraph('ib_dns_dyn_updates');
##################
# Create dns performance graph (latency)
##################
$mibs = 'IB-PLATFORMONE-MIB';
$oids = [
'ibNetworkMonitorDNSNonAAT1AvgLatency.0',
'ibNetworkMonitorDNSAAT1AvgLatency.0',
];
$data = snmp_get_multi($this->getDeviceArray(), $oids, '-OQUs', $mibs);
$rrd_def = RrdDefinition::make()
->addDataset('PerfAA', 'GAUGE', 0)
->addDataset('PerfnonAA', 'GAUGE', 0);
$fields = [
'PerfAA' => $data[0]['ibNetworkMonitorDNSAAT1AvgLatency'],
'PerfnonAA' => $data[0]['ibNetworkMonitorDNSNonAAT1AvgLatency'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'ib_dns_performance', $tags, $fields);
$this->enableGraph('ib_dns_performance');
##################
# Create dns request return code graph
##################
$mibs = 'IB-DNSONE-MIB';
$oids = [
'ibBindZoneFailure."summary"',
'ibBindZoneNxDomain."summary"',
'ibBindZoneNxRRset."summary"',
'ibBindZoneSuccess."summary"',
];
$data = snmp_get_multi($this->getDeviceArray(), $oids, '-OQUs', $mibs);
$rrd_def = RrdDefinition::make()
->addDataset('success', 'DERIVE', 0)
->addDataset('failure', 'DERIVE', 0)
->addDataset('nxdomain', 'DERIVE', 0)
->addDataset('nxrrset', 'DERIVE', 0);
$fields = [
'success' => $data['"summary"']['ibBindZoneSuccess'],
'failure' => $data['"summary"']['ibBindZoneFailure'],
'nxdomain' => $data['"summary"']['ibBindZoneNxDomain'],
'nxrrset' => $data['"summary"']['ibBindZoneNxRRset'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'ib_dns_request_return_codes', $tags, $fields);
$this->enableGraph('ib_dns_request_return_codes');
##################
# Create dhcp messages graph
##################
$mibs = 'IB-DHCPONE-MIB';
$oids = [
'ibDhcpTotalNoOfAcks.0',
'ibDhcpTotalNoOfDeclines.0',
'ibDhcpTotalNoOfDiscovers.0',
'ibDhcpTotalNoOfInforms.0',
'ibDhcpTotalNoOfNacks.0',
'ibDhcpTotalNoOfOffers.0',
'ibDhcpTotalNoOfOthers.0',
'ibDhcpTotalNoOfReleases.0',
'ibDhcpTotalNoOfRequests.0',
];
$data = snmp_get_multi($this->getDeviceArray(), $oids, '-OQUs', $mibs);
$rrd_def = RrdDefinition::make()
->addDataset('ack', 'DERIVE', 0)
->addDataset('decline', 'DERIVE', 0)
->addDataset('discover', 'DERIVE', 0)
->addDataset('inform', 'DERIVE', 0)
->addDataset('nack', 'DERIVE', 0)
->addDataset('offer', 'DERIVE', 0)
->addDataset('other', 'DERIVE', 0)
->addDataset('release', 'DERIVE', 0)
->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'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'ib_dhcp_messages', $tags, $fields);
$this->enableGraph('ib_dhcp_messages');
}
}

90
LibreNMS/OS/Openbsd.php Normal file
View File

@ -0,0 +1,90 @@
<?php
/*
* Openbsd.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\OS\Shared\Unix;
use LibreNMS\RRD\RrdDefinition;
class Openbsd extends Unix implements OSPolling
{
public function pollOS()
{
$oids = snmp_get_multi($this->getDeviceArray(), ['pfStateCount.0', 'pfStateSearches.0', 'pfStateInserts.0', 'pfStateRemovals.0'], '-OQUs', 'OPENBSD-PF-MIB');
if (is_numeric($oids[0]['pfStateCount'])) {
$rrd_def = RrdDefinition::make()->addDataset('states', 'GAUGE', 0);
$fields = [
'states' => $oids[0]['pfStateCount'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'pf_states', $tags, $fields);
$this->enableGraph('pf_states');
}
if (is_numeric($oids[0]['pfStateSearches'])) {
$rrd_def = RrdDefinition::make()->addDataset('searches', 'COUNTER', 0);
$fields = [
'searches' => $oids[0]['pfStateSearches'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'pf_searches', $tags, $fields);
$this->enableGraph('pf_searches');
}
if (is_numeric($oids[0]['pfStateInserts'])) {
$rrd_def = RrdDefinition::make()->addDataset('inserts', 'COUNTER', 0);
$fields = [
'inserts' => $oids[0]['pfStateInserts'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'pf_inserts', $tags, $fields);
$this->enableGraph('pf_inserts');
}
if (is_numeric($oids[0]['pfStateCount'])) {
$rrd_def = RrdDefinition::make()->addDataset('removals', 'COUNTER', 0);
$fields = [
'removals' => $oids[0]['pfStateCount'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'pf_removals', $tags, $fields);
$this->enableGraph('pf_removals');
}
}
}

View File

@ -23,6 +23,7 @@
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessClientsDiscovery;
@ -43,11 +44,10 @@ class Openwrt extends OS implements
/**
* Retrieve basic information about the OS / device
*/
public function discoverOS(): void
public function discoverOS(Device $device): void
{
$device = $this->getDeviceModel();
$device->version = explode(' ', trim(snmp_get($this->getDevice(), '.1.3.6.1.4.1.2021.7890.1.101.1', '-Osqnv'), '"'))[1];
$device->hardware = trim(snmp_get($this->getDevice(), '.1.3.6.1.4.1.2021.7890.2.101.1', '-Osqnv'), '"');
$device->version = explode(' ', trim(snmp_get($this->getDeviceArray(), '.1.3.6.1.4.1.2021.7890.1.101.1', '-Osqnv'), '"'))[1];
$device->hardware = trim(snmp_get($this->getDeviceArray(), '.1.3.6.1.4.1.2021.7890.2.101.1', '-Osqnv'), '"');
}
/**
@ -59,10 +59,10 @@ class Openwrt extends OS implements
private function getInterfaces()
{
// Need to use PHP_EOL, found newline (\n) not near as reliable / consistent! And this is as PHP says it should be done.
$interfaces = explode(PHP_EOL, snmp_get($this->getDevice(), 'NET-SNMP-EXTEND-MIB::nsExtendOutputFull."interfaces"', '-Osqnv'));
$interfaces = explode(PHP_EOL, snmp_get($this->getDeviceArray(), 'NET-SNMP-EXTEND-MIB::nsExtendOutputFull."interfaces"', '-Osqnv'));
$arrIfaces = array();
foreach ($interfaces as $interface) {
list($k, $v) = explode(',', $interface);
[$k, $v] = explode(',', $interface);
$arrIfaces[$k] = $v;
}
return $arrIfaces;

136
LibreNMS/OS/Panos.php Normal file
View File

@ -0,0 +1,136 @@
<?php
/*
* Panos.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\RRD\RrdDefinition;
class Panos extends \LibreNMS\OS implements OSPolling
{
public function pollOS()
{
$data = snmp_get_multi($this->getDeviceArray(), [
'panSessionActive.0',
'panSessionActiveTcp.0',
'panSessionActiveUdp.0',
'panSessionActiveICMP.0',
'panSessionActiveSslProxy.0',
'panSessionSslProxyUtilization.0',
'panGPGWUtilizationActiveTunnels.0'
], '-OQUs', 'PAN-COMMON-MIB');
if (is_numeric($data[0]['panSessionActive'])) {
$rrd_def = RrdDefinition::make()->addDataset('sessions', 'GAUGE', 0, 3000000);
$fields = [
'sessions' => $data[0]['panSessionActive'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'panos-sessions', $tags, $fields);
$this->enableGraph('panos_sessions');
}
if (is_numeric($data[0]['panSessionActiveTcp'])) {
$rrd_def = RrdDefinition::make()->addDataset('sessions_tcp', 'GAUGE', 0, 3000000);
$fields = [
'sessions_tcp' => $data[0]['panSessionActiveTcp'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'panos-sessions-tcp', $tags, $fields);
$this->enableGraph('panos_sessions_tcp');
}
if (is_numeric($data[0]['panSessionActiveUdp'])) {
$rrd_def = RrdDefinition::make()->addDataset('sessions_udp', 'GAUGE', 0, 3000000);
$fields = [
'sessions_udp' => $data[0]['panSessionActiveUdp'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'panos-sessions-udp', $tags, $fields);
$this->enableGraph('panos_sessions_udp');
}
if (is_numeric($data[0]['panSessionActiveICMP'])) {
$rrd_def = RrdDefinition::make()->addDataset('sessions_icmp', 'GAUGE', 0, 3000000);
$fields = [
'sessions_icmp' => $data[0]['panSessionActiveICMP'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'panos-sessions-icmp', $tags, $fields);
$this->enableGraph('panos_sessions_icmp');
}
if (is_numeric($data[0]['panSessionActiveSslProxy'])) {
$rrd_def = RrdDefinition::make()->addDataset('sessions_ssl', 'GAUGE', 0, 3000000);
$fields = [
'sessions_ssl' => $data[0]['panSessionActiveSslProxy'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'panos-sessions-ssl', $tags, $fields);
$this->enableGraph('panos_sessions_ssl');
}
if (is_numeric($data[0]['panSessionSslProxyUtilization'])) {
$rrd_def = RrdDefinition::make()->addDataset('sessions_sslutil', 'GAUGE', 0, 3000000);
$fields = [
'sessions_sslutil' => $data[0]['panSessionSslProxyUtilization'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'panos-sessions-sslutil', $tags, $fields);
$this->enableGraph('panos_sessions_sslutil');
}
if (is_numeric($data[0]['panGPGWUtilizationActiveTunnels'])) {
$rrd_def = RrdDefinition::make()->addDataset('activetunnels', 'GAUGE', 0, 3000000);
$fields = [
'activetunnels' => $data[0]['panGPGWUtilizationActiveTunnels'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'panos-activetunnels', $tags, $fields);
$this->enableGraph('panos_activetunnels');
}
}
}

View File

@ -27,11 +27,11 @@ namespace LibreNMS\OS;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessClientsDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessSnrDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRssiDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessSinrDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRsrpDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRsrqDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRssiDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessSinrDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessSnrDiscovery;
use LibreNMS\OS;
class Pepwave extends OS implements
@ -53,7 +53,7 @@ class Pepwave extends OS implements
public function discoverWirelessRssi()
{
$data = snmpwalk_group($this->getDevice(), 'cellularSignalRssi', 'CELLULAR');
$data = snmpwalk_group($this->getDeviceArray(), 'cellularSignalRssi', 'CELLULAR');
$sensors = [];
foreach ($data as $index => $rssi_value) {
if ($rssi_value['cellularSignalRssi'] != '-9999') {
@ -65,7 +65,7 @@ class Pepwave extends OS implements
public function discoverWirelessSnr()
{
$data = snmpwalk_group($this->getDevice(), 'cellularSignalSnr', 'CELLULAR');
$data = snmpwalk_group($this->getDeviceArray(), 'cellularSignalSnr', 'CELLULAR');
$sensors = [];
foreach ($data as $index => $snr_value) {
if ($snr_value['cellularSignalSnr'] != '-9999') {
@ -77,7 +77,7 @@ class Pepwave extends OS implements
public function discoverWirelessSinr()
{
$data = snmpwalk_group($this->getDevice(), 'cellularSignalSinr', 'CELLULAR');
$data = snmpwalk_group($this->getDeviceArray(), 'cellularSignalSinr', 'CELLULAR');
$sensors = [];
foreach ($data as $index => $sinr_value) {
if ($sinr_value['cellularSignalSinr'] != '-9999') {
@ -89,7 +89,7 @@ class Pepwave extends OS implements
public function discoverWirelessRsrp()
{
$data = snmpwalk_group($this->getDevice(), 'cellularSignalRsrp', 'CELLULAR');
$data = snmpwalk_group($this->getDeviceArray(), 'cellularSignalRsrp', 'CELLULAR');
$sensors = [];
foreach ($data as $index => $rsrp_value) {
if ($rsrp_value['cellularSignalRsrp'] != '-9999') {
@ -101,7 +101,7 @@ class Pepwave extends OS implements
public function discoverWirelessRsrq()
{
$data = snmpwalk_group($this->getDevice(), 'cellularSignalRsrq', 'CELLULAR');
$data = snmpwalk_group($this->getDeviceArray(), 'cellularSignalRsrq', 'CELLULAR');
$sensors = [];
foreach ($data as $index => $rsrq_value) {
if ($rsrq_value['cellularSignalRsrq'] != '-9999') {

179
LibreNMS/OS/Pfsense.php Normal file
View File

@ -0,0 +1,179 @@
<?php
/*
* Pfsense.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\OS\Shared\Unix;
use LibreNMS\RRD\RrdDefinition;
class Pfsense extends Unix implements OSPolling
{
public function pollOS()
{
$oids = snmp_get_multi($this->getDeviceArray(), [
'pfStateTableCount.0',
'pfStateTableSearches.0',
'pfStateTableInserts.0',
'pfStateTableRemovals.0',
'pfCounterMatch.0',
'pfCounterBadOffset.0',
'pfCounterFragment.0',
'pfCounterShort.0',
'pfCounterNormalize.0',
'pfCounterMemDrop.0'
], '-OQUs', 'BEGEMOT-PF-MIB');
if (is_numeric($oids[0]['pfStateTableCount'])) {
$rrd_def = RrdDefinition::make()->addDataset('states', 'GAUGE', 0);
$fields = [
'states' => $oids[0]['pfStateTableCount'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'pf_states', $tags, $fields);
$this->enableGraph('pf_states');
}
if (is_numeric($oids[0]['pfStateTableSearches'])) {
$rrd_def = RrdDefinition::make()->addDataset('searches', 'COUNTER', 0);
$fields = [
'searches' => $oids[0]['pfStateTableSearches'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'pf_searches', $tags, $fields);
$this->enableGraph('pf_searches');
}
if (is_numeric($oids[0]['pfStateTableInserts'])) {
$rrd_def = RrdDefinition::make()->addDataset('inserts', 'COUNTER', 0);
$fields = [
'inserts' => $oids[0]['pfStateTableInserts'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'pf_inserts', $tags, $fields);
$this->enableGraph('pf_inserts');
}
if (is_numeric($oids[0]['pfStateTableCount'])) {
$rrd_def = RrdDefinition::make()->addDataset('removals', 'COUNTER', 0);
$fields = [
'removals' => $oids[0]['pfStateTableCount'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'pf_removals', $tags, $fields);
$this->enableGraph('pf_removals');
}
if (is_numeric($oids[0]['pfCounterMatch'])) {
$rrd_def = RrdDefinition::make()->addDataset('matches', 'COUNTER', 0);
$fields = [
'matches' => $oids[0]['pfCounterMatch'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'pf_matches', $tags, $fields);
$this->enableGraph('pf_matches');
}
if (is_numeric($oids[0]['pfCounterBadOffset'])) {
$rrd_def = RrdDefinition::make()->addDataset('badoffset', 'COUNTER', 0);
$fields = [
'badoffset' => $oids[0]['pfCounterBadOffset'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'pf_badoffset', $tags, $fields);
$this->enableGraph('pf_badoffset');
}
if (is_numeric($oids[0]['pfCounterFragment'])) {
$rrd_def = RrdDefinition::make()->addDataset('fragmented', 'COUNTER', 0);
$fields = [
'fragmented' => $oids[0]['pfCounterFragment'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'pf_fragmented', $tags, $fields);
$this->enableGraph('pf_fragmented');
}
if (is_numeric($oids[0]['pfCounterShort'])) {
$rrd_def = RrdDefinition::make()->addDataset('short', 'COUNTER', 0);
$fields = [
'short' => $oids[0]['pfCounterShort'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'pf_short', $tags, $fields);
$this->enableGraph('pf_short');
}
if (is_numeric($oids[0]['pfCounterNormalize'])) {
$rrd_def = RrdDefinition::make()->addDataset('normalized', 'COUNTER', 0);
$fields = [
'normalized' => $oids[0]['pfCounterNormalize'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'pf_normalized', $tags, $fields);
$this->enableGraph('pf_normalized');
}
if (is_numeric($oids[0]['pfCounterMemDrop'])) {
$rrd_def = RrdDefinition::make()->addDataset('memdropped', 'COUNTER', 0);
$fields = [
'memdropped' => $oids[0]['pfCounterMemDrop'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'pf_memdropped', $tags, $fields);
$this->enableGraph('pf_memdropped');
}
}
}

View File

@ -25,18 +25,22 @@
namespace LibreNMS\OS;
use App\Models\Device;
use Illuminate\Support\Str;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRssiDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessSnrDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessFrequencyDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessUtilizationDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessSsrDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessClientsDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessErrorsDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessFrequencyDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRssiDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessSnrDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessSsrDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessUtilizationDiscovery;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\OS;
use LibreNMS\RRD\RrdDefinition;
class Pmp extends OS implements
OSPolling,
WirelessRssiDiscovery,
WirelessSnrDiscovery,
WirelessFrequencyDiscovery,
@ -45,6 +49,204 @@ class Pmp extends OS implements
WirelessClientsDiscovery,
WirelessErrorsDiscovery
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
$data = snmp_get_multi_oid($this->getDeviceArray(), ['boxDeviceType.0', 'bhTimingMode.0', 'boxDeviceTypeID.0'], '-OQUs', 'WHISP-BOX-MIBV2-MIB');
$device->features = $data['boxDeviceType.0'] ?? null;
$ptp = [
'BHUL450' => 'PTP 450',
'BHUL' => 'PTP 230',
'BH20' => 'PTP 100'
];
foreach ($ptp as $desc => $model) {
if (Str::contains($device->features, $desc)) {
$hardware = $model . ' ' . str_replace(['timing', 'timeing'], '', $data['bhTimingMode.0']);
$device->version = $data['boxDeviceTypeID.0'] ?? $device->version;
break;
}
}
$pmp = [
'MU-MIMO OFDM' => 'PMP 450m',
'MIMO OFDM' => 'PMP 450',
'OFDM' => 'PMP 430'
];
if (!isset($hardware)) {
$hardware = 'PMP 100';
foreach ($pmp as $desc => $model) {
if (Str::contains($device->features, $desc)) {
$hardware = $model;
break;
}
}
if (Str::contains($device->sysDescr, "AP")) {
$hardware .= ' AP';
} elseif (Str::contains($device->sysDescr, "SM")) {
$hardware .= ' SM';
}
}
$device->hardware = $hardware;
}
public function pollOS()
{
// 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'])) {
$rrd_def = RrdDefinition::make()
->addDataset('fecInErrorsCount', 'GAUGE', 0, 100000)
->addDataset('fecOutErrorsCount', 'GAUGE', 0, 100000);
$fields = array(
'fecInErrorsCount' => $fec['fecInErrorsCount.0'],
'fecOutErrorsCount' => $fec['fecOutErrorsCount.0'],
);
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'canopy-generic-errorCount', $tags, $fields);
$this->enableGraph('canopy_generic_errorCount');
}
// Migrated to Wireless Sensor
if (is_numeric($fec['fecCRCError.0'])) {
$rrd_def = RrdDefinition::make()->addDataset('crcErrors', 'GAUGE', 0, 100000);
$fields = array(
'crcErrors' => $fec['fecCRCError.0'],
);
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'canopy-generic-crcErrors', $tags, $fields);
$this->enableGraph('canopy_generic_crcErrors');
}
$jitter = snmp_get($this->getDeviceArray(), "jitter.0", "-Ovqn", "WHISP-SM-MIB");
if (is_numeric($jitter)) {
$rrd_def = RrdDefinition::make()->addDataset('jitter', 'GAUGE', 0, 20);
$fields = [
'jitter' => $jitter,
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'canopy-generic-jitter', $tags, $fields);
$this->enableGraph('canopy_generic_jitter');
unset($rrd_filename, $jitter);
}
$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"];
if (is_numeric($registered) && is_numeric($failed)) {
$rrd_def = RrdDefinition::make()
->addDataset('regCount', 'GAUGE', 0, 15000)
->addDataset('failed', 'GAUGE', 0, 15000);
$fields = [
'regCount' => $registered,
'failed' => $failed,
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'canopy-generic-regCount', $tags, $fields);
$this->enableGraph('canopy_generic_regCount');
unset($rrd_filename, $registered, $failed);
}
$visible = str_replace('"', "", snmp_get($this->getDeviceArray(), ".1.3.6.1.4.1.161.19.3.4.4.7.0", "-Ovqn", ""));
$tracked = str_replace('"', "", snmp_get($this->getDeviceArray(), ".1.3.6.1.4.1.161.19.3.4.4.8.0", "-Ovqn", ""));
if (is_numeric($visible) && is_numeric($tracked)) {
$rrd_def = RrdDefinition::make()
->addDataset('visible', 'GAUGE', 0, 1000)
->addDataset('tracked', 'GAUGE', 0, 1000);
$fields = [
'visible' => floatval($visible),
'tracked' => floatval($tracked),
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'canopy-generic-gpsStats', $tags, $fields);
$this->enableGraph('canopy_generic_gpsStats');
}
$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'])) {
$rrd_def = RrdDefinition::make()
->addDataset('dbm', 'GAUGE', -100, 0)
->addDataset('min', 'GAUGE', -100, 0)
->addDataset('max', 'GAUGE', -100, 0)
->addDataset('avg', 'GAUGE', -100, 0);
$fields = [
'dbm' => $radio['radioDbmInt.0'],
'min' => $radio['minRadioDbm.0'],
'max' => $radio['maxRadioDbm.0'],
'avg' => $radio['radioDbmAvg.0'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'canopy-generic-radioDbm', $tags, $fields);
$this->enableGraph('canopy_generic_radioDbm');
}
$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'])) {
$rrd_def = RrdDefinition::make()
->addDataset('horizontal', 'GAUGE', -100, 0)
->addDataset('vertical', 'GAUGE', -100, 0);
$fields = [
'horizontal' => $dbm['linkRadioDbmHorizontal.2'],
'vertical' => $dbm['linkRadioDbmVertical.2'],
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'canopy-generic-450-linkRadioDbm', $tags, $fields);
$this->enableGraph('canopy_generic_450_linkRadioDbm');
}
$lastLevel = str_replace('"', "", snmp_get($this->getDeviceArray(), "lastPowerLevel.2", "-Ovqn", "WHISP-APS-MIB"));
if (is_numeric($lastLevel)) {
$rrd_def = RrdDefinition::make()->addDataset('last', 'GAUGE', -100, 0);
$fields = [
'last' => $lastLevel,
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'canopy-generic-450-powerlevel', $tags, $fields);
$this->enableGraph('canopy_generic_450_powerlevel');
}
$vertical = str_replace('"', "", snmp_get($this->getDeviceArray(), ".1.3.6.1.4.1.161.19.3.2.2.117.0", "-Ovqn", ""));
$horizontal = str_replace('"', "", snmp_get($this->getDeviceArray(), ".1.3.6.1.4.1.161.19.3.2.2.118.0", "-Ovqn", ""));
$combined = snmp_get($this->getDeviceArray(), "1.3.6.1.4.1.161.19.3.2.2.21.0", "-Ovqn", "");
if (is_numeric($vertical) && is_numeric($horizontal) && is_numeric($combined)) {
$rrd_def = RrdDefinition::make()
->addDataset('vertical', 'GAUGE', -150, 0)
->addDataset('horizontal', 'GAUGE', -150, 0)
->addDataset('combined', 'GAUGE', -150, 0);
$fields = [
'vertical' => floatval($vertical),
'horizontal' => floatval($horizontal),
'combined' => $combined,
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'canopy-generic-signalHV', $tags, $fields);
$this->enableGraph('canopy_generic_signalHV');
unset($rrd_filename, $vertical, $horizontal, $combined);
}
$horizontal = str_replace('"', "", snmp_get($this->getDeviceArray(), "radioDbmHorizontal.0", "-Ovqn", "WHISP-SM-MIB"));
$vertical = str_replace('"', "", snmp_get($this->getDeviceArray(), "radioDbmVertical.0", "-Ovqn", "WHISP-SM-MIB"));
if (is_numeric($horizontal) && is_numeric($vertical)) {
$rrd_def = RrdDefinition::make()
->addDataset('horizontal', 'GAUGE', -100, 100)
->addDataset('vertical', 'GAUGE', -100, 100);
$fields = [
'horizontal' => $horizontal,
'vertical' => $vertical,
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'canopy-generic-450-slaveHV', $tags, $fields);
$this->enableGraph('canopy_generic_450_slaveHV');
}
}
/**
* Discover wireless bit/packet error ratio. This is in percent. Type is error-ratio.
@ -55,7 +257,7 @@ class Pmp extends OS implements
public function discoverWirelessRssi()
{
$rssi_oid = '.1.3.6.1.4.1.161.19.3.2.2.2.0';
return array(
return [
new WirelessSensor(
'rssi',
$this->getDeviceId(),
@ -65,7 +267,7 @@ class Pmp extends OS implements
'Cambium RSSI',
null
)
);
];
}
/**
@ -85,7 +287,7 @@ class Pmp extends OS implements
$snr_vertical = '.1.3.6.1.4.1.161.19.3.2.2.95.0'; //WHISP-SMS-MIB::signalToNoiseRatioSMVertical.0
}
return array(
return [
new WirelessSensor(
'snr',
$this->getDeviceId(),
@ -104,9 +306,10 @@ class Pmp extends OS implements
'Cambium SNR Vertical',
null
)
);
];
}
/**
* Discover wireless frequency. This is in MHz. Type is frequency.
* Returns an array of LibreNMS\Device\Sensor objects that have been discovered
@ -116,7 +319,7 @@ class Pmp extends OS implements
public function discoverWirelessFrequency()
{
$frequency = '.1.3.6.1.4.1.161.19.3.1.7.37.0'; //WHISP-APS-MIB::currentRadioFreqCarrier
return array(
return [
new WirelessSensor(
'frequency',
$this->getDeviceId(),
@ -128,10 +331,9 @@ class Pmp extends OS implements
1,
$this->freqDivisor()
)
);
];
}
/**
* Discover wireless utilization. This is in %. Type is utilization.
* Returns an array of LibreNMS\Device\Sensor objects that have been discovered
@ -152,7 +354,7 @@ class Pmp extends OS implements
$muDownlink = '.1.3.6.1.4.1.161.19.3.1.12.2.30.0'; // WHISP-APS-MIB::frUtlMedMumimoDownlinkMumimoUtilization
$suDownlink = '.1.3.6.1.4.1.161.19.3.1.12.2.31.0'; // WHISP-APS-MIB::frUtlMedMumimoDownlinkSumimoUtilization
return array(
return [
new WirelessSensor(
'utilization',
$this->getDeviceId(),
@ -234,7 +436,7 @@ class Pmp extends OS implements
'SU-MIMO Downlink Utilization',
null
)
);
];
}
/**
@ -250,7 +452,7 @@ class Pmp extends OS implements
} else {
$ssr = '.1.3.6.1.4.1.161.19.3.2.2.108.0'; //WHISP-SMSSM-MIB::signalStrengthRatio.0
}
return array(
return [
new WirelessSensor(
'ssr',
$this->getDeviceId(),
@ -260,7 +462,7 @@ class Pmp extends OS implements
'Cambium Signal Strength Ratio',
null
)
);
];
}
/**
@ -270,7 +472,7 @@ class Pmp extends OS implements
*/
private function isAp()
{
$device = $this->getDevice();
$device = $this->getDeviceArray();
return Str::contains($device['hardware'], 'AP') || Str::contains($device['hardware'], 'Master');
}
@ -283,16 +485,16 @@ class Pmp extends OS implements
*/
private function freqDivisor()
{
$device = $this->getDevice();
$device = $this->getDeviceArray();
$types = array(
$types = [
'OFDM' => 1000,
'5.4GHz' => 1,
'5.2Ghz' => 1,
'5.7Ghz' => 1,
'2.4Ghz' => 10,
'900Mhz' => 10
);
];
$boxType = snmp_get($device, 'boxDeviceType.0', '-Oqv', 'WHISP-BOX-MIBV2-MIB');
@ -314,7 +516,7 @@ class Pmp extends OS implements
public function discoverWirelessClients()
{
$registeredSM = '.1.3.6.1.4.1.161.19.3.1.7.1.0'; //WHISP-APS-MIB::regCount.0
return array(
return [
new WirelessSensor(
'clients',
$this->getDeviceId(),
@ -324,7 +526,7 @@ class Pmp extends OS implements
'Client Count',
null
)
);
];
}
/**
@ -338,7 +540,7 @@ class Pmp extends OS implements
$fecInErrorsCount = '.1.3.6.1.4.1.161.19.3.3.1.95.0';
$fecOutErrorsCount = '.1.3.6.1.4.1.161.19.3.3.1.97.0';
$fecCRCError = '.1.3.6.1.4.1.161.19.3.3.1.223.0';
return array(
return [
new WirelessSensor(
'errors',
$this->getDeviceId(),
@ -366,6 +568,6 @@ class Pmp extends OS implements
'In Error Count',
null
)
);
];
}
}

View File

@ -48,7 +48,7 @@ class Powerconnect extends OS implements ProcessorDiscovery, ProcessorPolling
*/
public function discoverProcessors()
{
$device = $this->getDevice();
$device = $this->getDeviceArray();
if (Str::startsWith($device['sysObjectID'], [
'.1.3.6.1.4.1.674.10895.3020',
'.1.3.6.1.4.1.674.10895.3021',
@ -101,7 +101,7 @@ class Powerconnect extends OS implements ProcessorDiscovery, ProcessorPolling
foreach ($processors as $processor) {
if ($processor['processor_type'] == 'powerconnect-nv') {
$data[$processor['processor_id']] = snmp_get($this->getDevice(), $processor['processor_oid'], '-Oqv');
$data[$processor['processor_id']] = snmp_get($this->getDeviceArray(), $processor['processor_oid'], '-Oqv');
} else {
$data += $this->pollVxworksProcessors(array($processor));
}

50
LibreNMS/OS/Procurve.php Normal file
View File

@ -0,0 +1,50 @@
<?php
/*
* Procurve.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\RRD\RrdDefinition;
class Procurve extends \LibreNMS\OS implements OSPolling
{
public function pollOS()
{
$FdbAddressCount = snmp_get($this->getDeviceArray(), 'hpSwitchFdbAddressCount.0', '-Ovqn', 'STATISTICS-MIB');
if (is_numeric($FdbAddressCount)) {
$rrd_def = RrdDefinition::make()->addDataset('value', 'GAUGE', -1, 100000);
$fields = [
'value' => $FdbAddressCount,
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'fdb_count', $tags, $fields);
$this->enableGraph('fdb_count');
}
}
}

View File

@ -1,8 +1,8 @@
<?php
/**
* aruba-instant.inc.php
/*
* Pulse.php
*
* LibreNMS os polling module for Aruba Instant
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -19,22 +19,31 @@
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2019 Timothy Willey
* @author Timothy Willey <developer@timothywilley.net>
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\RRD\RrdDefinition;
// ArubaOS (MODEL: 225), Version 8.4.0.0-8.4.0.0
// ArubaOS (MODEL: 105), Version 6.4.4.8-4.2.4.12
$badchars = array( '(', ')', ',',);
list(,,$hardware,,$version,) = str_replace($badchars, '', explode(' ', $device['sysDescr']));
class Pulse extends \LibreNMS\OS implements OSPolling
{
public function pollOS()
{
$users = snmp_get($this->getDeviceArray(), 'iveConcurrentUsers.0', '-OQv', 'PULSESECURE-PSG-MIB');
$ai_mib = 'AI-AP-MIB';
$oids = snmpwalk_group($device, 'aiAPSerialNum', $ai_mib);
if (is_numeric($users)) {
$rrd_def = RrdDefinition::make()->addDataset('users', 'GAUGE', 0);
if (!empty($oids)) {
foreach ($oids as $key => $value) {
$serial = $value['aiAPSerialNum'];
continue;
$fields = array(
'users' => $users,
);
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'pulse_users', $tags, $fields);
$this->enableGraph('pulse_users');
}
}
}

View File

@ -25,17 +25,16 @@
namespace LibreNMS\OS;
use Illuminate\Support\Str;
use App\Models\Device;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\OS;
class Qnap extends OS implements OSDiscovery
{
public function discoverOS(): void
public function discoverOS(Device $device): void
{
$device = $this->getDeviceModel();
$info = snmp_getnext_multi($this->getDevice(), 'enclosureModel enclosureSerialNum entPhysicalFirmwareRev', '-OQUs', 'NAS-MIB:ENTITY-MIB');
$device->version = Str::replaceFirst('\"', '', $info['entPhysicalFirmwareRev']);
$info = snmp_getnext_multi($this->getDeviceArray(), ['enclosureModel', 'enclosureSerialNum', 'entPhysicalFirmwareRev'], '-OQUs', 'NAS-MIB:ENTITY-MIB');
$device->version = trim($info['entPhysicalFirmwareRev'], '\"');
$device->hardware = $info['enclosureModel'];
$device->serial = $info['enclosureSerialNum'];
}

View File

@ -25,15 +25,15 @@
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\OS;
class Quantastor extends OS implements OSDiscovery
{
public function discoverOS(): void
public function discoverOS(Device $device): void
{
$device = $this->getDeviceModel();
$info = snmp_get_multi_oid($this->getDevice(), 'storageSystem-ServiceVersion.0 hwEnclosure-Vendor.0 hwEnclosure-Model.0 storageSystem-SerialNumber.0', '-OQUs', 'QUANTASTOR-SYS-STATS');
$info = snmp_get_multi_oid($this->getDeviceArray(), 'storageSystem-ServiceVersion.0 hwEnclosure-Vendor.0 hwEnclosure-Model.0 storageSystem-SerialNumber.0', '-OQUs', 'QUANTASTOR-SYS-STATS');
$device->version = $info['storageSystem-ServiceVersion.0'];
$device->hardware = $info['hwEnclosure-Vendor.0'] . ' ' . $info['hwEnclosure-Model.0'];
$device->serial = $info['storageSystem-SerialNumber.0'];

38
LibreNMS/OS/Radlan.php Normal file
View File

@ -0,0 +1,38 @@
<?php
/*
* Radlan.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
class Radlan extends \LibreNMS\OS
{
public function discoverOS(Device $device): void
{
$device->hardware = snmp_getnext($this->getDeviceArray(), 'entPhysicalDescr.64', '-OsvQU', 'ENTITY-MIB');
$device->version = snmp_get($this->getDeviceArray(), 'rndBrgVersion.0', '-OsvQU', 'RADLAN-MIB');
$device->serial = snmp_getnext($this->getDeviceArray(), 'entPhysicalSerialNum.64', '-OsvQU', 'ENTITY-MIB') ?: null;
}
}

View File

@ -28,18 +28,21 @@ namespace LibreNMS\OS;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessCcqDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessClientsDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessDistanceDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessFrequencyDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessNoiseFloorDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRateDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRssiDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessDistanceDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRsrqDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRsrpDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessSinrDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessQualityDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRateDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRsrpDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRsrqDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessRssiDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessSinrDiscovery;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\OS;
use LibreNMS\RRD\RrdDefinition;
class Routeros extends OS implements
OSPolling,
WirelessCcqDiscovery,
WirelessClientsDiscovery,
WirelessFrequencyDiscovery,
@ -103,7 +106,7 @@ class Routeros extends OS implements
public function discoverWirelessFrequency()
{
$data = $this->fetchData();
$sensors = array();
foreach ($data as $index => $entry) {
if ($entry['mtxrWlApFreq'] == null) {
@ -207,9 +210,9 @@ class Routeros extends OS implements
private function fetchData()
{
if (is_null($this->data)) {
$wl60 = snmpwalk_cache_oid($this->getDevice(), 'mtxrWl60GTable', array(), 'MIKROTIK-MIB');
$wlap = snmpwalk_cache_oid($this->getDevice(), 'mtxrWlApTable', array(), 'MIKROTIK-MIB');
$wl60sta = snmpwalk_cache_oid($this->getDevice(), 'mtxrWl60GStaTable', array(), 'MIKROTIK-MIB');
$wl60 = snmpwalk_cache_oid($this->getDeviceArray(), 'mtxrWl60GTable', array(), 'MIKROTIK-MIB');
$wlap = snmpwalk_cache_oid($this->getDeviceArray(), 'mtxrWlApTable', array(), 'MIKROTIK-MIB');
$wl60sta = snmpwalk_cache_oid($this->getDeviceArray(), 'mtxrWl60GStaTable', array(), 'MIKROTIK-MIB');
$this->data = $wl60+$wlap;
$this->data = $this->data+$wl60sta;
}
@ -308,4 +311,35 @@ class Routeros extends OS implements
)
);
}
public function pollOS()
{
$leases = snmp_get($this->getDeviceArray(), 'mtxrDHCPLeaseCount.0', '-OQv', 'MIKROTIK-MIB');
if (is_numeric($leases)) {
$rrd_def = RrdDefinition::make()->addDataset('leases', 'GAUGE', 0);
$fields = array(
'leases' => $leases,
);
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'routeros_leases', $tags, $fields);
$this->enableGraph('routeros_leases');
}
$pppoe_sessions = snmp_get($this->getDeviceArray(), '1.3.6.1.4.1.9.9.150.1.1.1.0', '-OQv', '', '');
if (is_numeric($pppoe_sessions)) {
$rrd_def = RrdDefinition::make()->addDataset('pppoe_sessions', 'GAUGE', 0);
$fields = array(
'pppoe_sessions' => $pppoe_sessions,
);
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'routeros_pppoe_sessions', $tags, $fields);
$this->enableGraph('routeros_pppoe_sessions');
}
}
}

View File

@ -1,19 +1,32 @@
<?php
namespace LibreNMS\OS;
use App\Models\Device;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessClientsDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessApCountDiscovery;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessClientsDiscovery;
use LibreNMS\OS;
class RuckuswirelessSz extends OS implements
WirelessClientsDiscovery,
WirelessApCountDiscovery
{
public function discoverOS(Device $device): void
{
$device->hardware = snmp_getnext($this->getDeviceArray(), '.1.3.6.1.4.1.25053.1.8.1.1.1.1.1.1.3', "-OQv");
$device->version = snmp_getnext($this->getDeviceArray(), '.1.3.6.1.4.1.25053.1.8.1.1.1.1.1.1.9', "-OQv");
$device->serial = snmp_get($this->getDeviceArray(), '.1.3.6.1.4.1.25053.1.4.1.1.1.15.13.0', "-OQv");
$device->features = "Licenses: " . snmp_get($this->getDeviceArray(), '.1.3.6.1.4.1.25053.1.4.1.1.1.15.1.0', "-OQv") . "/" . snmp_getnext($this->getDeviceArray(), '.1.3.6.1.4.1.25053.1.8.1.1.1.1.1.1.10', "-OQv");
$ruckuscountry = snmp_getnext($this->getDeviceArray(), '.1.3.6.1.4.1.25053.1.8.1.1.1.1.3.1.4', "-OQv");
if (!empty($ruckuscountry)) {
$device->version .= " ($ruckuscountry)";
}
}
public function discoverWirelessClients()
{
// clients - Discover Per SSID Client Count
// clients - Discover Per SSID Client Count
$sensors = array();
$ssids = $this->getCacheByIndex('ruckusSZWLANSSID', 'RUCKUS-SZ-WLAN-MIB');
$counts = $this->getCacheByIndex('ruckusSZWLANNumSta', 'RUCKUS-SZ-WLAN-MIB');
@ -36,16 +49,16 @@ class RuckuswirelessSz extends OS implements
);
}
// Do not get total client count if only 1 SSID
// Do not get total client count if only 1 SSID
if (count($total_oids) > 1) {
// clients - Discover System Total Client Count
// clients - Discover System Total Client Count
$oid = '.1.3.6.1.4.1.25053.1.4.1.1.1.15.2.0'; //RUCKUS-SZ-SYSTEM-MIB::ruckusSZSystemStatsNumSta.0
array_push($sensors, new WirelessSensor('clients', $this->getDeviceId(), $oid, 'ruckuswireless-sz', ($index + 1), 'System Total:'));
}
return $sensors;
}
// ap-count - Discover System Connected APs
// ap-count - Discover System Connected APs
public function discoverWirelessApCount()
{
@ -63,7 +76,7 @@ class RuckuswirelessSz extends OS implements
$connect
);
}
// ap-count - Discover System Total APs
// ap-count - Discover System Total APs
$oid = '.1.3.6.1.4.1.25053.1.4.1.1.1.15.1.0'; //RUCKUS-SZ-SYSTEM-MIB::ruckusSZSystemStatsNumAP.0
array_push($apstatus, new WirelessSensor('ap-count', $this->getDeviceId(), $oid, 'ruckuswireless-sz', ++$dbindex, 'Total APs'));
return $apstatus;

View File

@ -26,14 +26,44 @@
namespace LibreNMS\OS;
use LibreNMS\Device\WirelessSensor;
use LibreNMS\Interfaces\Discovery\Sensors\WirelessSnrDiscovery;
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 Rutos2xx extends OS implements
OSPolling,
WirelessSnrDiscovery,
WirelessRssiDiscovery
{
public function pollOS()
{
# Mobile Data Usage
$usage = snmp_get_multi_oid($this->getDeviceArray(), [
'.1.3.6.1.4.1.48690.2.11.0',
'.1.3.6.1.4.1.48690.2.10.0',
]);
$usage_sent = $usage['.1.3.6.1.4.1.48690.2.11.0'];
$usage_received = $usage['.1.3.6.1.4.1.48690.2.10.0'];
if ($usage_sent >= 0 && $usage_received >= 0) {
$rrd_def = RrdDefinition::make()
->addDataset('usage_sent', 'GAUGE', 0)
->addDataset('usage_received', 'GAUGE', 0);
$fields = [
'usage_sent' => $usage_sent,
'usage_received' => $usage_received,
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'rutos_2xx_mobileDataUsage', $tags, $fields);
$this->enableGraph('rutos_2xx_mobileDataUsage');
}
}
public function discoverWirelessSnr()
{
$oid = '.1.3.6.1.4.1.48690.2.22.0'; // TELTONIKA-MIB::SINR.0

View File

@ -0,0 +1,52 @@
<?php
/*
* Schleifenbauer.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use App\Models\Device;
class Schleifenbauer extends \LibreNMS\OS
{
public function discoverOS(Device $device): void
{
$master_unit = snmp_get($this->getDeviceArray(), ".1.3.6.1.4.1.31034.12.1.1.1.2.4.1.2.1", '-Oqv');
$oids = [
'hardware' => ".1.3.6.1.4.1.31034.12.1.1.2.1.1.1.5.$master_unit",
'serial' => ".1.3.6.1.4.1.31034.12.1.1.2.1.1.1.6.$master_unit",
'firmware' => ".1.3.6.1.4.1.31034.12.1.1.2.1.1.1.2.$master_unit",
'build' => ".1.3.6.1.4.1.31034.12.1.1.2.1.1.1.3.$master_unit"
];
$data = snmp_get_multi_oid($this->getDeviceArray(), $oids);
$device->hardware = $data[$oids['hardware']] ?? null;
$device->serial = $data[$oids['serial']] ?? null;
$device->version = $data[$oids['firmware']] ?? null;
if (!empty($data[$oids['build']])) {
$device->version = trim("$device->version ({$data[$oids['build']]})");
}
}
}

58
LibreNMS/OS/Screenos.php Normal file
View File

@ -0,0 +1,58 @@
<?php
/*
* Screenos.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\RRD\RrdDefinition;
class Screenos extends \LibreNMS\OS implements OSPolling
{
public function pollOS()
{
$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);
$fields = [
'allocate' => $sessalloc,
'max' => $sessmax,
'failed' => $sessfailed,
];
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'screenos_sessions', $tags, $fields);
$this->enableGraph('screenos_sessions');
}
}

View File

@ -0,0 +1,49 @@
<?php
/*
* Secureplatform.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\RRD\RrdDefinition;
class Secureplatform extends \LibreNMS\OS implements OSPolling
{
public function pollOS()
{
$connections = snmp_get($this->getDeviceArray(), 'fwNumConn.0', '-OQv', 'CHECKPOINT-MIB');
if (is_numeric($connections)) {
$rrd_def = RrdDefinition::make()->addDataset('NumConn', 'GAUGE', 0);
$fields = array(
'NumConn' => $connections,
);
$tags = compact('rrd_def');
data_update($this->getDeviceArray(), 'secureplatform_sessions', $tags, $fields);
$this->enableGraph('secureplatform_sessions');
}
}
}

View File

@ -39,7 +39,7 @@ class Sgos extends OS implements ProcessorDiscovery
*/
public function discoverProcessors()
{
$data = snmpwalk_group($this->getDevice(), 'sgProxyCpuCoreBusyPerCent', 'BLUECOAT-SG-PROXY-MIB');
$data = snmpwalk_group($this->getDeviceArray(), 'sgProxyCpuCoreBusyPerCent', 'BLUECOAT-SG-PROXY-MIB');
$processors = array();
$count = 1;

View File

@ -26,15 +26,90 @@
namespace LibreNMS\OS\Shared;
use App\Models\Device;
use App\Models\PortsNac;
use LibreNMS\Device\Processor;
use LibreNMS\Interfaces\Discovery\OSDiscovery;
use LibreNMS\Interfaces\Discovery\ProcessorDiscovery;
use LibreNMS\Interfaces\Polling\NacPolling;
use LibreNMS\OS;
use LibreNMS\OS\Traits\YamlOSDiscovery;
use LibreNMS\Util\IP;
class Cisco extends OS implements ProcessorDiscovery, NacPolling
class Cisco extends OS implements OSDiscovery, ProcessorDiscovery, NacPolling
{
use YamlOSDiscovery {
YamlOSDiscovery::discoverOS as discoverYamlOS;
}
public function discoverOS(Device $device): void
{
// yaml discovery overrides this
if ($this->hasYamlDiscovery('os')) {
$this->discoverYamlOS($device);
return;
}
$device->serial = $this->getMainSerial();
$hardware = null;
if (preg_match('/^Cisco IOS Software, .+? Software \([^\-]+-([^\-]+)-\w\),.+?Version ([^, ]+)/', $device->sysDescr, $regexp_result)) {
$device->features = $regexp_result[1];
$device->version = $regexp_result[2];
} elseif (preg_match('/Cisco Internetwork Operating System Software\s+IOS \(tm\) [^ ]+ Software \([^\-]+-([^\-]+)-\w\),.+?Version ([^, ]+)/', $device->sysDescr, $regexp_result)) {
$device->features = $regexp_result[1];
$device->version = $regexp_result[2];
} elseif (preg_match('/^Cisco IOS Software \[([^\]]+)\],.+Software \(([^\)]+)\), Version ([^, ]+)/', $device->sysDescr, $regexp_result)) {
$device->features = $regexp_result[1];
$device->version = $regexp_result[2] . " " . $regexp_result[3];
} elseif (preg_match('/^Cisco IOS Software.*?, .+? Software(\, )?([\s\w\d]+)? \([^\-]+-([\w\d]+)-\w\), Version ([^,]+)/', $device->sysDescr, $regexp_result)) {
$device->features = $regexp_result[3];
$device->version = $regexp_result[4];
$hardware = $regexp_result[2];
$tmp = preg_split("/\\r\\n|\\r|\\n/", $device->version);
if (!empty($tmp[0])) {
$device->version = $tmp[0];
}
}
$oids = [
'entPhysicalModelName.1',
'entPhysicalContainedIn.1',
'entPhysicalName.1',
'entPhysicalSoftwareRev.1',
'entPhysicalModelName.1000',
'entPhysicalModelName.1001',
'entPhysicalContainedIn.1000',
'entPhysicalContainedIn.1001',
];
$data = snmp_get_multi($this->getDeviceArray(), $oids, '-OQUs', 'ENTITY-MIB:OLD-CISCO-CHASSIS-MIB');
if (isset($data[1]['entPhysicalContainedIn']) && $data[1]['entPhysicalContainedIn'] == '0') {
if (!empty($data[1]['entPhysicalSoftwareRev'])) {
$device->version = $data[1]['entPhysicalSoftwareRev'];
}
if (!empty($data[1]['entPhysicalName'])) {
$hardware = $data[1]['entPhysicalName'];
}
if (!empty($data[1]['entPhysicalModelName'])) {
$hardware = $data[1]['entPhysicalModelName'];
}
}
if (empty($hardware) && !empty($data[1000]['entPhysicalModelName'])) {
$hardware = $data[1000]['entPhysicalModelName'];
} elseif (empty($hardware) && !empty($data[1000]['entPhysicalContainedIn'])) {
$hardware = $data[$data[1000]['entPhysicalContainedIn']]['entPhysicalName'];
} elseif ((preg_match('/stack/i', $hardware) || empty($hardware)) && !empty($data[1001]['entPhysicalModelName'])) {
$hardware = $data[1001]['entPhysicalModelName'];
} elseif (empty($hardware) && !empty($data[1001]['entPhysicalContainedIn'])) {
$hardware = $data[$data[1001]['entPhysicalContainedIn']]['entPhysicalName'];
}
$device->hardware = $hardware ?: snmp_translate($device->sysObjectID, 'SNMPv2-MIB:CISCO-PRODUCTS-MIB', 'cisco');
}
/**
* Discover processors.
* Returns an array of LibreNMS\Device\Processor objects that have been discovered
@ -43,16 +118,16 @@ class Cisco extends OS implements ProcessorDiscovery, NacPolling
*/
public function discoverProcessors()
{
$processors_data = snmpwalk_group($this->getDevice(), 'cpmCPU', 'CISCO-PROCESS-MIB');
$processors = array();
$processors_data = snmpwalk_group($this->getDeviceArray(), 'cpmCPU', 'CISCO-PROCESS-MIB');
$processors = [];
foreach ($processors_data as $index => $entry) {
if (is_numeric($entry['cpmCPUTotal5minRev'])) {
$usage_oid = '.1.3.6.1.4.1.9.9.109.1.1.1.1.8.'.$index;
$usage = $entry['cpmCPUTotal5minRev'];
$usage_oid = '.1.3.6.1.4.1.9.9.109.1.1.1.1.8.' . $index;
$usage = $entry['cpmCPUTotal5minRev'];
} elseif (is_numeric($entry['cpmCPUTotal5min'])) {
$usage_oid = '.1.3.6.1.4.1.9.9.109.1.1.1.1.5.'.$index;
$usage = $entry['cpmCPUTotal5min'];
$usage_oid = '.1.3.6.1.4.1.9.9.109.1.1.1.1.5.' . $index;
$usage = $entry['cpmCPUTotal5min'];
} else {
continue; // skip bad data
}
@ -66,7 +141,7 @@ class Cisco extends OS implements ProcessorDiscovery, NacPolling
}
if (empty($descr)) {
$descr = snmp_get($this->getDevice(), 'entPhysicalName.'.$entPhysicalIndex, '-Oqv', 'ENTITY-MIB');
$descr = snmp_get($this->getDeviceArray(), 'entPhysicalName.' . $entPhysicalIndex, '-Oqv', 'ENTITY-MIB');
}
}
@ -115,7 +190,7 @@ class Cisco extends OS implements ProcessorDiscovery, NacPolling
}
// QFP processors (Forwarding Processors)
$qfp_data = snmpwalk_group($this->getDevice(), 'ceqfpUtilProcessingLoad', 'CISCO-ENTITY-QFP-MIB');
$qfp_data = snmpwalk_group($this->getDeviceArray(), 'ceqfpUtilProcessingLoad', 'CISCO-ENTITY-QFP-MIB');
foreach ($qfp_data as $entQfpPhysicalIndex => $entry) {
/*
@ -132,7 +207,7 @@ class Cisco extends OS implements ProcessorDiscovery, NacPolling
$qfp_descr = $entPhysicalName_array[$entQfpPhysicalIndex];
}
if (empty($qfp_descr)) {
$qfp_descr = snmp_get($this->getDevice(), 'entPhysicalName.'.$entQfpPhysicalIndex, '-Oqv', 'ENTITY-MIB');
$qfp_descr = snmp_get($this->getDeviceArray(), 'entPhysicalName.' . $entQfpPhysicalIndex, '-Oqv', 'ENTITY-MIB');
}
}
@ -160,20 +235,20 @@ class Cisco extends OS implements ProcessorDiscovery, NacPolling
{
$nac = collect();
$portAuthSessionEntry = snmpwalk_cache_oid($this->getDevice(), 'cafSessionEntry', [], 'CISCO-AUTH-FRAMEWORK-MIB');
$portAuthSessionEntry = snmpwalk_cache_oid($this->getDeviceArray(), 'cafSessionEntry', [], 'CISCO-AUTH-FRAMEWORK-MIB');
if (!empty($portAuthSessionEntry)) {
$cafSessionMethodsInfoEntry = collect(snmpwalk_cache_oid($this->getDevice(), 'cafSessionMethodsInfoEntry', [], 'CISCO-AUTH-FRAMEWORK-MIB'))->mapWithKeys(function ($item, $key) {
$cafSessionMethodsInfoEntry = collect(snmpwalk_cache_oid($this->getDeviceArray(), 'cafSessionMethodsInfoEntry', [], 'CISCO-AUTH-FRAMEWORK-MIB'))->mapWithKeys(function ($item, $key) {
$key_parts = explode('.', $key);
$key = implode('.', array_slice($key_parts, 0, 2)); // remove the auth method
return [$key => ['method' => $key_parts[2], 'authc_status' => $item['cafSessionMethodState']]];
});
// cache port ifIndex -> port_id map
$ifIndex_map = $this->getDeviceModel()->ports()->pluck('port_id', 'ifIndex');
$ifIndex_map = $this->getDevice()->ports()->pluck('port_id', 'ifIndex');
// update the DB
foreach ($portAuthSessionEntry as $index => $portAuthSessionEntryParameters) {
list($ifIndex, $auth_id) = explode('.', str_replace("'", '', $index));
[$ifIndex, $auth_id] = explode('.', str_replace("'", '', $index));
$session_info = $cafSessionMethodsInfoEntry->get($ifIndex . '.' . $auth_id);
$mac_address = strtolower(implode(array_map('zeropad', explode(':', $portAuthSessionEntryParameters['cafSessionClientMacAddress']))));
@ -198,4 +273,20 @@ class Cisco extends OS implements ProcessorDiscovery, NacPolling
return $nac;
}
protected function getMainSerial()
{
$serial_output = snmp_get_multi($this->getDeviceArray(), ['entPhysicalSerialNum.1', 'entPhysicalSerialNum.1001'], '-OQUs', 'ENTITY-MIB:OLD-CISCO-CHASSIS-MIB');
// $serial_output = snmp_getnext($this->getDevice(), 'entPhysicalSerialNum', '-OQUs', 'ENTITY-MIB:OLD-CISCO-CHASSIS-MIB');
if (!empty($serial_output[1]['entPhysicalSerialNum'])) {
return $serial_output[1]['entPhysicalSerialNum'];
} elseif (!empty($serial_output[1000]['entPhysicalSerialNum'])) {
return $serial_output[1000]['entPhysicalSerialNum'];
} elseif (!empty($serial_output[1001]['entPhysicalSerialNum'])) {
return $serial_output[1001]['entPhysicalSerialNum'];
}
return null;
}
}

View File

@ -0,0 +1,123 @@
<?php
/*
* Extreme.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS\Shared;
use App\Models\Device;
class Extreme extends \LibreNMS\OS
{
public function discoverOS(Device $device): void
{
parent::discoverOS($device); // yaml
$device->hardware = $this->getHardware() ?: $device->hardware;
}
protected function getHardware()
{
$hardware = [
'.1.3.6.1.4.1.1916.2.1' => 'Summit 1',
'.1.3.6.1.4.1.1916.2.2' => 'Summit 2',
'.1.3.6.1.4.1.1916.2.3' => 'Summit 3',
'.1.3.6.1.4.1.1916.2.4' => 'Summit 4',
'.1.3.6.1.4.1.1916.2.5' => 'Summit 4FX',
'.1.3.6.1.4.1.1916.2.6' => 'Summit 48',
'.1.3.6.1.4.1.1916.2.7' => 'Summit 24',
'.1.3.6.1.4.1.1916.2.8' => 'BlackDiamond 6800',
'.1.3.6.1.4.1.1916.2.11' => 'BlackDiamond 6808',
'.1.3.6.1.4.1.1916.2.12' => 'Summit 7iSX',
'.1.3.6.1.4.1.1916.2.13' => 'Summit 7iTX',
'.1.3.6.1.4.1.1916.2.14' => 'Summit 1iTX',
'.1.3.6.1.4.1.1916.2.15' => 'Summit 5i',
'.1.3.6.1.4.1.1916.2.16' => 'Summit 48i',
'.1.3.6.1.4.1.1916.2.17' => 'Alpine 3808',
'.1.3.6.1.4.1.1916.2.19' => 'Summit 1iSX',
'.1.3.6.1.4.1.1916.2.20' => 'Alpine 3804',
'.1.3.6.1.4.1.1916.2.21' => 'Summit 5iLX',
'.1.3.6.1.4.1.1916.2.22' => 'Summit 5iTX',
'.1.3.6.1.4.1.1916.2.23' => 'EnetSwitch 24Port',
'.1.3.6.1.4.1.1916.2.24' => 'BlackDiamond 6816',
'.1.3.6.1.4.1.1916.2.25' => 'Summit 24e3',
'.1.3.6.1.4.1.1916.2.26' => 'Alpine 3802',
'.1.3.6.1.4.1.1916.2.27' => 'BlackDiamond 6804',
'.1.3.6.1.4.1.1916.2.28' => 'Summit 48i1u',
'.1.3.6.1.4.1.1916.2.30' => 'Summit Px1',
'.1.3.6.1.4.1.1916.2.40' => 'Summit 24e2TX',
'.1.3.6.1.4.1.1916.2.41' => 'Summit 24e2SX',
'.1.3.6.1.4.1.1916.2.53' => 'Summit 200-24',
'.1.3.6.1.4.1.1916.2.54' => 'Summit 200-48',
'.1.3.6.1.4.1.1916.2.55' => 'Summit 300-48',
'.1.3.6.1.4.1.1916.2.56' => 'BlackDiamond 10808',
'.1.3.6.1.4.1.1916.2.58' => 'Summit 400-48t',
'.1.3.6.1.4.1.1916.2.59' => 'Summit 400-24x',
'.1.3.6.1.4.1.1916.2.61' => 'Summit 300-24',
'.1.3.6.1.4.1.1916.2.62' => 'BlackDiamond 8810',
'.1.3.6.1.4.1.1916.2.63' => 'Summit 400-24t',
'.1.3.6.1.4.1.1916.2.64' => 'Summit 400-24p',
'.1.3.6.1.4.1.1916.2.65' => 'Summit X450-24x',
'.1.3.6.1.4.1.1916.2.66' => 'Summit X450-24t',
'.1.3.6.1.4.1.1916.2.67' => 'SummitStack',
'.1.3.6.1.4.1.1916.2.68' => 'SummitWM 100',
'.1.3.6.1.4.1.1916.2.69' => 'SummitWM 1000',
'.1.3.6.1.4.1.1916.2.70' => 'Summit 200-24fx',
'.1.3.6.1.4.1.1916.2.71' => 'Summit X450a-24t',
'.1.3.6.1.4.1.1916.2.72' => 'Summit X450e-24p',
'.1.3.6.1.4.1.1916.2.74' => 'BlackDiamond 8806',
'.1.3.6.1.4.1.1916.2.75' => 'Altitude 350',
'.1.3.6.1.4.1.1916.2.76' => 'Summit X450a-48t',
'.1.3.6.1.4.1.1916.2.77' => 'BlackDiamond 12804',
'.1.3.6.1.4.1.1916.2.79' => 'Summit X450e-48p',
'.1.3.6.1.4.1.1916.2.80' => 'Summit X450a-24tDC',
'.1.3.6.1.4.1.1916.2.81' => 'Summit X450a-24t',
'.1.3.6.1.4.1.1916.2.82' => 'Summit X450a-24xDC',
'.1.3.6.1.4.1.1916.2.83' => 'Sentriant CE150',
'.1.3.6.1.4.1.1916.2.84' => 'Summit X450a-24x',
'.1.3.6.1.4.1.1916.2.85' => 'BlackDiamond 12802',
'.1.3.6.1.4.1.1916.2.86' => 'Altitude 300',
'.1.3.6.1.4.1.1916.2.87' => 'Summit X450a-48tDC',
'.1.3.6.1.4.1.1916.2.88' => 'Summit X250-24t',
'.1.3.6.1.4.1.1916.2.89' => 'Summit X250-24p',
'.1.3.6.1.4.1.1916.2.90' => 'Summit X250-24x',
'.1.3.6.1.4.1.1916.2.91' => 'Summit X250-48t',
'.1.3.6.1.4.1.1916.2.92' => 'Summit X250-48p',
'.1.3.6.1.4.1.1916.2.93' => 'Summit Ver2Stack',
'.1.3.6.1.4.1.1916.2.94' => 'SummitWM 200',
'.1.3.6.1.4.1.1916.2.95' => 'SummitWM 2000',
'.1.3.6.1.4.1.1916.2.100' => 'Summit x150-24t',
'.1.3.6.1.4.1.1916.2.114' => 'Summit x650-24x',
'.1.3.6.1.4.1.1916.2.118' => 'Summit X650-24x(SSns)',
'.1.3.6.1.4.1.1916.2.120' => 'Summit x650-24x(SS)',
'.1.3.6.1.4.1.1916.2.129' => 'NWI-e450a',
'.1.3.6.1.4.1.1916.2.133' => 'Summit x480-48t',
'.1.3.6.1.4.1.1916.2.137' => 'Summit X480-24x',
'.1.3.6.1.4.1.1916.2.139' => 'Summit X480-24x(10G4X)',
'.1.3.6.1.4.1.1916.2.141' => 'Summit x480-48x',
'.1.3.6.1.4.1.1916.2.167' => 'Summit x670-48x',
'.1.3.6.1.4.1.1916.2.168' => 'Summit x670v-48x',
];
return $hardware[$this->getDevice()->sysObjectID] ?? null;
}
}

View File

@ -0,0 +1,129 @@
<?php
/*
* Fortinet.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
namespace LibreNMS\OS\Shared;
class Fortinet extends \LibreNMS\OS
{
protected function getHardwareName()
{
$rewrite_fortinet_hardware = [
'.1.3.6.1.4.1.12356.102.1.1000' => 'FortiAnalyzer 100',
'.1.3.6.1.4.1.12356.102.1.10002' => 'FortiAnalyzer 1000B',
'.1.3.6.1.4.1.12356.102.1.1001' => 'FortiAnalyzer 100A',
'.1.3.6.1.4.1.12356.102.1.1002' => 'FortiAnalyzer 100B',
'.1.3.6.1.4.1.12356.102.1.20000' => 'FortiAnalyzer 2000',
'.1.3.6.1.4.1.12356.102.1.20001' => 'FortiAnalyzer 2000A',
'.1.3.6.1.4.1.12356.102.1.4000' => 'FortiAnalyzer 400',
'.1.3.6.1.4.1.12356.102.1.40000' => 'FortiAnalyzer 4000',
'.1.3.6.1.4.1.12356.102.1.40001' => 'FortiAnalyzer 4000A',
'.1.3.6.1.4.1.12356.102.1.4002' => 'FortiAnalyzer 400B',
'.1.3.6.1.4.1.12356.102.1.8000' => 'FortiAnalyzer 800',
'.1.3.6.1.4.1.12356.102.1.8002' => 'FortiAnalyzer 800B',
'.1.3.6.1.4.1.12356.101.1.1000' => 'FortiGate 100',
'.1.3.6.1.4.1.12356.101.1.10000' => 'FortiGate 1000',
'.1.3.6.1.4.1.12356.101.1.10001' => 'FortiGate 1000A',
'.1.3.6.1.4.1.12356.101.1.10002' => 'FortiGate 1000AFA2',
'.1.3.6.1.4.1.12356.101.1.10003' => 'FortiGate 1000ALENC',
'.1.3.6.1.4.1.12356.101.1.1001' => 'FortiGate 100A',
'.1.3.6.1.4.1.12356.101.1.1002' => 'FortiGate 110C',
'.1.3.6.1.4.1.12356.101.1.1003' => 'FortiGate 111C',
'.1.3.6.1.4.1.12356.101.1.2000' => 'FortiGate 200',
'.1.3.6.1.4.1.12356.101.1.20000' => 'FortiGate 2000',
'.1.3.6.1.4.1.12356.101.1.2001' => 'FortiGate 200A',
'.1.3.6.1.4.1.12356.101.1.2002' => 'FortiGate 224B',
'.1.3.6.1.4.1.12356.101.1.2003' => 'FortiGate 200A',
'.1.3.6.1.4.1.12356.101.1.3000' => 'FortiGate 300',
'.1.3.6.1.4.1.12356.101.1.30000' => 'FortiGate 3000',
'.1.3.6.1.4.1.12356.101.1.3001' => 'FortiGate 300A',
'.1.3.6.1.4.1.12356.101.1.30160' => 'FortiGate 3016B',
'.1.3.6.1.4.1.12356.101.1.302' => 'FortiGate 30B',
'.1.3.6.1.4.1.12356.101.1.3002' => 'FortiGate 310B',
'.1.3.6.1.4.1.12356.101.1.36000' => 'FortiGate 3600',
'.1.3.6.1.4.1.12356.101.1.36003' => 'FortiGate 3600A',
'.1.3.6.1.4.1.12356.101.1.38100' => 'FortiGate 3810A',
'.1.3.6.1.4.1.12356.101.1.4000' => 'FortiGate 400',
'.1.3.6.1.4.1.12356.101.1.40000' => 'FortiGate 4000',
'.1.3.6.1.4.1.12356.101.1.4001' => 'FortiGate 400A',
'.1.3.6.1.4.1.12356.101.1.5000' => 'FortiGate 500',
'.1.3.6.1.4.1.12356.101.1.50000' => 'FortiGate 5000',
'.1.3.6.1.4.1.12356.101.1.50010' => 'FortiGate 5001',
'.1.3.6.1.4.1.12356.101.1.50011' => 'FortiGate 5001A',
'.1.3.6.1.4.1.12356.101.1.50012' => 'FortiGate 5001FA2',
'.1.3.6.1.4.1.12356.101.1.50021' => 'FortiGate 5002A',
'.1.3.6.1.4.1.12356.101.1.50001' => 'FortiGate 5002FB2',
'.1.3.6.1.4.1.12356.101.1.50040' => 'FortiGate 5004',
'.1.3.6.1.4.1.12356.101.1.50050' => 'FortiGate 5005',
'.1.3.6.1.4.1.12356.101.1.50051' => 'FortiGate 5005FA2',
'.1.3.6.1.4.1.12356.101.1.5001' => 'FortiGate 500A',
'.1.3.6.1.4.1.12356.101.1.500' => 'FortiGate 50A',
'.1.3.6.1.4.1.12356.101.1.501' => 'FortiGate 50AM',
'.1.3.6.1.4.1.12356.101.1.502' => 'FortiGate 50B',
'.1.3.6.1.4.1.12356.101.1.504' => 'FortiGate 51B',
'.1.3.6.1.4.1.12356.101.1.600' => 'FortiGate 60',
'.1.3.6.1.4.1.12356.101.1.6201' => 'FortiGate 600D',
'.1.3.6.1.4.1.12356.101.1.602' => 'FortiGate 60ADSL',
'.1.3.6.1.4.1.12356.101.1.603' => 'FortiGate 60B',
'.1.3.6.1.4.1.12356.101.1.601' => 'FortiGate 60M',
'.1.3.6.1.4.1.12356.101.1.6200' => 'FortiGate 620B',
'.1.3.6.1.4.1.12356.101.1.8000' => 'FortiGate 800',
'.1.3.6.1.4.1.12356.101.1.8001' => 'FortiGate 800F',
'.1.3.6.1.4.1.12356.101.1.800' => 'FortiGate 80C',
'.1.3.6.1.4.1.12356.1688' => 'FortiMail 2000A',
'.1.3.6.1.4.1.12356.103.1.1000' => 'FortiManager 100',
'.1.3.6.1.4.1.12356.103.1.1001' => 'FortiManager VM',
'.1.3.6.1.4.1.12356.103.1.1003' => 'FortiManager 100C',
'.1.3.6.1.4.1.12356.103.1.2004' => 'FortiManager 200D',
'.1.3.6.1.4.1.12356.103.1.2005' => 'FortiManager 200E',
'.1.3.6.1.4.1.12356.103.1.3004' => 'FortiManager 300D',
'.1.3.6.1.4.1.12356.103.1.3005' => 'FortiManager 300E',
'.1.3.6.1.4.1.12356.103.1.4000' => 'FortiManager 400',
'.1.3.6.1.4.1.12356.103.1.4001' => 'FortiManager 400A',
'.1.3.6.1.4.1.12356.103.1.4002' => 'FortiManager 400B',
'.1.3.6.1.4.1.12356.103.1.4003' => 'FortiManager 400C',
'.1.3.6.1.4.1.12356.103.1.4005' => 'FortiManager 400E',
'.1.3.6.1.4.1.12356.103.1.10003' => 'FortiManager 1000C',
'.1.3.6.1.4.1.12356.103.1.10004' => 'FortiManager 1000D',
'.1.3.6.1.4.1.12356.103.1.20005' => 'FortiManager 2000E',
'.1.3.6.1.4.1.12356.103.1.20000' => 'FortiManager 2000XL',
'.1.3.6.1.4.1.12356.103.1.30000' => 'FortiManager 3000',
'.1.3.6.1.4.1.12356.103.1.30002' => 'FortiManager 3000B',
'.1.3.6.1.4.1.12356.103.1.30003' => 'FortiManager 3000C',
'.1.3.6.1.4.1.12356.103.1.30006' => 'FortiManager 3000F',
'.1.3.6.1.4.1.12356.103.1.39005' => 'FortiManager 3900E',
'.1.3.6.1.4.1.12356.103.1.40004' => 'FortiManager 4000D',
'.1.3.6.1.4.1.12356.103.1.40005' => 'FortiManager 4000E',
'.1.3.6.1.4.1.12356.103.1.50011' => 'FortiManager 5001A',
'.1.3.6.1.4.1.12356.106.1.50030' => 'FortiSwitch 5003A',
'.1.3.6.1.4.1.12356.101.1.510' => 'FortiWiFi 50B',
'.1.3.6.1.4.1.12356.101.1.610' => 'FortiWiFi 60',
'.1.3.6.1.4.1.12356.101.1.611' => 'FortiWiFi 60A',
'.1.3.6.1.4.1.12356.101.1.612' => 'FortiWiFi 60AM',
'.1.3.6.1.4.1.12356.101.1.613' => 'FortiWiFi 60B',
];
return $rewrite_fortinet_hardware[$this->getDevice()->sysObjectID] ?? null;
}
}

View File

@ -39,7 +39,7 @@ class Foundry extends OS implements ProcessorDiscovery
*/
public function discoverProcessors()
{
$processors_data = snmpwalk_cache_triple_oid($this->getDevice(), 'snAgentCpuUtilTable', array(), 'FOUNDRY-SN-AGENT-MIB');
$processors_data = snmpwalk_cache_triple_oid($this->getDeviceArray(), 'snAgentCpuUtilTable', array(), 'FOUNDRY-SN-AGENT-MIB');
$module_descriptions = $this->getCacheByIndex('snAgentConfigModuleDescription', 'FOUNDRY-SN-AGENT-MIB');
$processors = array();
@ -62,7 +62,7 @@ class Foundry extends OS implements ProcessorDiscovery
}
$module_description = $module_descriptions[$entry['snAgentCpuUtilSlotNum']];
list($module_description) = explode(' ', $module_description);
[$module_description] = explode(' ', $module_description);
$descr = "Slot {$entry['snAgentCpuUtilSlotNum']} $module_description [{$entry['snAgentCpuUtilSlotNum']}]";
$processors[] = Processor::discover(

View File

@ -1,6 +1,6 @@
<?php
/**
* valere.inc.php
/*
* Printer.php
*
* -Description-
*
@ -19,10 +19,22 @@
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2017 Tony Murray
* @copyright 2020 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
$hardware = snmp_get($device, 'vpwrIdentModel.0', '-Ovqa', 'VALERE-DC-POWER-MIB');
$version = snmp_get($device, 'vpwrIdentControllerVersion.0', '-Ovqa', 'VALERE-DC-POWER-MIB');
$features = implode(', ', explode(PHP_EOL, snmp_walk($device, 'vpwrModuleOID', '-Oqvs', 'VALERE-DC-POWER-MIB')));
namespace LibreNMS\OS\Shared;
class Printer extends \LibreNMS\OS
{
protected function parseDeviceId($data)
{
$vars = [];
foreach (explode(';', $data) as $pair) {
[$key, $value] = explode(':', $pair);
$vars[trim($key)] = $value;
}
return $vars;
}
}

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