initial commit; version 22.5.12042

This commit is contained in:
2022-12-12 23:28:25 -05:00
commit af1b03d79f
17653 changed files with 22692970 additions and 0 deletions

View File

@ -0,0 +1,164 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
$oids = snmp_cache_table($device, 'cpqRackServerBladeTable', NULL, 'CPQRACK-MIB'); // This table also used in statuses
// Chassis
$index = 1;
$inventory[$index] = array(
'entPhysicalName' => $device['hardware'].' Chassis',
'entPhysicalDescr' => $device['hostname'],
'entPhysicalClass' => 'chassis',
'entPhysicalIsFRU' => 'true',
'entPhysicalModelName' => $device['hardware'],
'entPhysicalSerialNum' => $device['serial'],
'entPhysicalFirmwareRev' => $device['version'],
'entPhysicalAssetID' => $device['asset_tag'],
'entPhysicalContainedIn' => 0,
'entPhysicalParentRelPos' => -1,
'entPhysicalMfgName' => 'HP'
);
discover_inventory($device, $index, $inventory[$index], $mib);
// Blades
foreach ($oids as $tmp => $entry)
{
if ($entry['cpqRackServerBladeEntry'] == "0") { continue; }
if ($entry['cpqRackServerBladeSlotsUsed'] == "0") { continue; }
$index += 2;
$inventory[$index] = array(
'entPhysicalName' => 'Slot '.$entry['cpqRackServerBladePosition'],
'entPhysicalClass' => 'container',
'entPhysicalIsFRU' => 'true',
'entPhysicalContainedIn' => 1,
'entPhysicalParentRelPos' => $entry['cpqRackServerBladePosition'],
'entPhysicalMfgName' => 'HP'
);
$model = $entry['cpqRackServerBladeProductId'];
if ($entry['cpqRackServerBladePowered'] === "off")
{
$model .= ' (OFF)';
}
$inventory[$index+1] = array(
'entPhysicalName' => $entry['cpqRackServerBladeName'],
'entPhysicalDescr' => $entry['cpqRackServerBladeName'],
'entPhysicalClass' => 'module',
'entPhysicalIsFRU' => 'true',
'entPhysicalModelName' => $model,
'entPhysicalSerialNum' => $entry['cpqRackServerBladeSerialNum'],
'entPhysicalContainedIn' => $index,
'entPhysicalParentRelPos' => 1,
'entPhysicalMfgName' => 'HP'
);
discover_inventory($device, $index, $inventory[$index], $mib);
discover_inventory($device, $index+1, $inventory[$index+1], $mib);
unset($model);
}
$oids = snmp_cache_table($device, 'cpqRackPowerSupplyTable', NULL, 'CPQRACK-MIB'); // This table also used in sensors
foreach ($oids as $pwr => $entry)
{
$index += 2;
$inventory[$index] = array(
'entPhysicalName' => 'Power Supply Module ' . $pwr,
'entPhysicalClass' => 'container',
'entPhysicalIsFRU' => 'true',
'entPhysicalContainedIn' => 1,
'entPhysicalParentRelPos' => $pwr,
'entPhysicalMfgName' => 'HP'
);
$inventory[$index+1] = array(
'entPhysicalName' => 'Power Supply ' . $pwr,
'entPhysicalDescr' => 'Power Supply ' . $pwr,
'entPhysicalClass' => 'power',
'entPhysicalIsFRU' => 'true',
'entPhysicalModelName' => $entry['cpqRackPowerSupplyPartNumber'],
'entPhysicalSerialNum' => $entry['cpqRackPowerSupplySerialNum'],
'entPhysicalContainedIn' => $index,
'entPhysicalParentRelPos' => 1,
'entPhysicalMfgName' => 'HP'
);
discover_inventory($device, $index, $inventory[$index], $mib);
discover_inventory($device, $index+1, $inventory[$index+1], $mib);
}
$nets = snmpwalk_cache_oid($device, 'cpqRackNetConnectorTable', array(), 'CPQRACK-MIB');
foreach ($nets as $net => $entry)
{
if ($entry['cpqRackNetConnectorPresent'] == "absent") { continue; }
$index += 2;
$inventory[$index] = array(
'entPhysicalName' => 'Network Connector Module ' . $net,
'entPhysicalClass' => 'container',
'entPhysicalIsFRU' => 'true',
'entPhysicalContainedIn' => 1,
'entPhysicalParentRelPos' => $net,
'entPhysicalMfgName' => 'HP'
);
$inventory[$index+1] = array(
'entPhysicalName' => 'Network Connector ' . $net,
'entPhysicalDescr' => 'Network Connector ' . $net,
'entPhysicalClass' => 'port',
'entPhysicalIsFRU' => 'true',
'entPhysicalModelName' => $entry['cpqRackNetConnectorModel'],
'entPhysicalSerialNum' => $entry['cpqRackNetConnectorSerialNum'],
'entPhysicalContainedIn' => $index,
'entPhysicalParentRelPos' => 1,
'entPhysicalMfgName' => 'HP'
);
discover_inventory($device, $index, $inventory[$index], $mib);
discover_inventory($device, $index+1, $inventory[$index+1], $mib);
}
$oas = snmpwalk_cache_oid($device, 'cpqRackCommonEnclosureManagerTable', array(), 'CPQRACK-MIB');
foreach ($oas as $oa => $entry)
{
if ($entry['cpqRackCommonEnclosureManagerPresent'] == "absent") { continue; }
$index += 2;
$inventory[$index] = array(
'entPhysicalName' => 'Onboard Administrator Module ' . $oa,
'entPhysicalClass' => 'container',
'entPhysicalIsFRU' => 'true',
'entPhysicalContainedIn' => 1,
'entPhysicalParentRelPos' => $oa,
'entPhysicalMfgName' => 'HP'
);
$oa_state = $entry['cpqRackCommonEnclosureManagerRole'];
$inventory[$index+1] = array(
'entPhysicalName' => 'Onboard Administrator ' . $oa . ' [' . $oa_state . ']',
'entPhysicalDescr' => 'Onboard Administrator ' . $oa,
'entPhysicalClass' => 'module',
'entPhysicalIsFRU' => 'true',
'entPhysicalModelName' => $entry['cpqRackCommonEnclosureManagerEnclosureName'],
'entPhysicalSerialNum' => $entry['cpqRackCommonEnclosureManagerSerialNum'],
'entPhysicalFirmwareRev' => $entry['cpqRackCommonEnclosureManagerFWRev'],
'entPhysicalContainedIn' => $index,
'entPhysicalParentRelPos' => 1,
'entPhysicalMfgName' => 'HP'
);
discover_inventory($device, $index, $inventory[$index], $mib);
discover_inventory($device, $index+1, $inventory[$index+1], $mib);
}
unset($power, $net, $oa, $oa_state);
// EOF

View File

@ -0,0 +1,81 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2015 Observium Limited
*
*/
// Only run this mib for chassis systems
// DELL-RAC-MIB::drsProductType.0 = INTEGER: cmc(8)
$type = snmp_get_oid($device, "drsProductType.0", "DELL-RAC-MIB");
if ( strstr($type, "cmc") || strstr($type, "CMC") )
{
$oids = snmp_cache_table($device, 'drsChassisServerGroup', NULL, 'DELL-RAC-MIB'); // This table also used in statuses
$index = 1;
$inventory[$index] = array(
'entPhysicalName' => $device['hardware'].' Chassis',
'entPhysicalDescr' => $device['hostname'],
'entPhysicalClass' => 'chassis',
'entPhysicalIsFRU' => 'true',
'entPhysicalModelName' => $device['hardware'],
'entPhysicalSerialNum' => $device['serial'],
'entPhysicalHardwareRev' => snmp_get($device, "drsProductVersion.0", "-Oqv", "DELL-RAC-MIB"),
'entPhysicalFirmwareRev' => $device['version'],
'entPhysicalAssetID' => $device['asset_tag'],
'entPhysicalContainedIn' => 0,
'entPhysicalParentRelPos' => -1,
'entPhysicalMfgName' => 'Dell'
);
discover_inventory($device, $index, $inventory[$index], $mib);
foreach ($oids as $tmp => $entry)
{
if ($entry['drsServerSlotNumber'] === "N/A") { continue; }
$index += 2;
// Full height blades take up two slots and are marked as Extension
if (!strstr($entry[drsServerSlotName],"Extension")) {
$serial = $entry['drsServerServiceTag'];
$inventory[$index] = array(
'entPhysicalName' => 'Slot '.$entry['drsServerSlotNumber'],
'entPhysicalClass' => 'container',
'entPhysicalIsFRU' => 'true',
'entPhysicalContainedIn' => 1,
'entPhysicalParentRelPos' => $entry['drsServerSlotNumber'],
'entPhysicalMfgName' => 'Dell'
);
$model = $entry['drsServerModel'];
if ( $entry['drsServerMonitoringCapable'] === "off") {
$model .= ' (OFF)';
}
$inventory[$index+1] = array(
'entPhysicalName' => $entry['drsServerSlotName'],
'entPhysicalDescr' => $entry['drsServerSlotName'],
'entPhysicalClass' => 'module',
'entPhysicalIsFRU' => 'true',
'entPhysicalModelName' => $model,
'entPhysicalSerialNum' => $serial,
'entPhysicalContainedIn' => $index,
'entPhysicalParentRelPos' => 1,
'entPhysicalMfgName' => 'Dell'
);
discover_inventory($device, $index, $inventory[$index], $mib);
discover_inventory($device, $index+1, $inventory[$index+1], $mib);
unset($serial, $model);
} else {
$i = $index-2;
$inventory[$i]['entPhysicalName'] = $inventory[$i]['entPhysicalName'] . '+' . $entry['drsServerSlotNumber'];
discover_inventory($device, $i, $inventory[$i], $mib);
}
}
}
// EOF

View File

@ -0,0 +1,134 @@
<?php
if (is_device_mib($device, 'DES-1210-28ME-B2')) {
$vendor_mib = 'DES-1210-28ME-B2';
$vendor_oids = snmpwalk_cache_oid($device, "sfpVendorInfoTable", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
print_debug_vars($vendor_oids);
$copperports = 24;
$comboports = 2;
$fiberports = 2;
} else {
return;
}
echo($vendor_mib);
$revision = snmp_get_oid($device, 'probeHardwareRev.0', 'RMON2-MIB');
$system_index = 1;
$inventory[$system_index] = [
'entPhysicalDescr' => $device['sysDescr'],
'entPhysicalClass' => 'chassis',
'entPhysicalName' => $device['hardware'],
'entPhysicalHardwareRev' => $revision,
'entPhysicalSoftwareRev' => $device['version'],
'entPhysicalIsFRU' => 'true',
'entPhysicalModelName' => $device['hardware'],
'entPhysicalSerialNum' => $device['serial'],
'entPhysicalContainedIn' => 0,
'entPhysicalParentRelPos' => 1,
'entPhysicalMfgName' => 'D-Link',
];
discover_inventory($device, $system_index, $inventory[$system_index], $vendor_mib);
/*
DES-1210-28ME-B2::companySfpVendorInfo
sfpPortIndex.27 = 27
sfpPortIndex.28 = 28
sfpConnectorType.27 = SFP - MT-RJ
sfpConnectorType.28 = SFP - SC
sfpTranceiverCode.27 =
sfpTranceiverCode.28 = Unallocated
sfpBaudRate.27 = d
sfpBaudRate.28 = d
sfpVendorName.27 =
sfpVendorName.28 =
sfpVendorOui.27 = 0:90:65
sfpVendorOui.28 = 0: 0: 0
sfpVendorPn.27 = SFP-1.25G-1310
sfpVendorPn.28 = TBSF15d1012gSC3c
sfpVendorRev.27 = A0
sfpVendorRev.28 = A
sfpWavelength.27 = 51e
sfpWavelength.28 = 60e
sfpVendorSn.27 = SC91750197
sfpVendorSn.28 = F201705111103
sfpDateCode.27 = 120904
sfpDateCode.28 = 170512
DES-1210-28ME-B2::sfpPortIndex.25 = INTEGER: 25
DES-1210-28ME-B2::sfpPortIndex.26 = INTEGER: 26
DES-1210-28ME-B2::sfpPortIndex.28 = INTEGER: 28
DES-1210-28ME-B2::sfpConnectorType.25 = STRING: "SFP - SC"
DES-1210-28ME-B2::sfpConnectorType.26 = STRING: "SFP - SC"
DES-1210-28ME-B2::sfpConnectorType.28 = STRING: "SFP - SC"
DES-1210-28ME-B2::sfpTranceiverCode.25 = STRING: "Unallocated"
DES-1210-28ME-B2::sfpTranceiverCode.26 = STRING: "Single Mode"
DES-1210-28ME-B2::sfpTranceiverCode.28 = STRING: "Single Mode"
DES-1210-28ME-B2::sfpBaudRate.25 = STRING: "d"
DES-1210-28ME-B2::sfpBaudRate.26 = STRING: "d"
DES-1210-28ME-B2::sfpBaudRate.28 = STRING: "d"
DES-1210-28ME-B2::sfpVendorName.25 = ""
DES-1210-28ME-B2::sfpVendorName.26 = ""
DES-1210-28ME-B2::sfpVendorName.28 = ""
DES-1210-28ME-B2::sfpVendorOui.25 = STRING: " 0: 0: 0"
DES-1210-28ME-B2::sfpVendorOui.26 = STRING: " 0: 0: 0"
DES-1210-28ME-B2::sfpVendorOui.28 = STRING: " 0: 0: 0"
DES-1210-28ME-B2::sfpVendorPn.25 = STRING: "TBSF13312gSC3cDD"
DES-1210-28ME-B2::sfpVendorPn.26 = STRING: "SFP-BIDI "
DES-1210-28ME-B2::sfpVendorPn.28 = STRING: "AP-B53121-3CS3 "
DES-1210-28ME-B2::sfpVendorRev.25 = STRING: "A "
DES-1210-28ME-B2::sfpVendorRev.26 = STRING: "1.0 "
DES-1210-28ME-B2::sfpVendorRev.28 = STRING: "1.00"
DES-1210-28ME-B2::sfpWavelength.25 = STRING: "51e"
DES-1210-28ME-B2::sfpWavelength.26 = STRING: "60e"
DES-1210-28ME-B2::sfpWavelength.28 = STRING: "60e"
DES-1210-28ME-B2::sfpVendorSn.25 = STRING: "F201705113806 "
DES-1210-28ME-B2::sfpVendorSn.26 = STRING: "G181687 "
DES-1210-28ME-B2::sfpVendorSn.28 = STRING: "SG53E20800234 "
DES-1210-28ME-B2::sfpDateCode.25 = STRING: "170517 "
DES-1210-28ME-B2::sfpDateCode.26 = STRING: "180916 "
DES-1210-28ME-B2::sfpDateCode.28 = STRING: "120224 "
*/
$totalports = $copperports + $comboports + $fiberports;
for ($i = 1; $i <= $totalports; $i++) {
$system_index = 100 + $i;
if ($i <= $copperports) {
$inventory[$system_index] = [
'entPhysicalDescr' => '100Base-T Copper Port',
'entPhysicalClass' => 'port',
'entPhysicalName' => 'Port '.$i,
'entPhysicalIsFRU' => 'false',
'entPhysicalModelName' => 'Copper Port',
'entPhysicalContainedIn' => 1,
'entPhysicalParentRelPos' => $i,
'ifIndex' => $i,
];
} else {
if ($i <= $copperports + $comboports) {
$portdescr = 'Combo Port';
} else {
$portdescr = 'SFP Port';
}
$inventory[$system_index] = [
'entPhysicalDescr' => $portdescr,
'entPhysicalClass' => 'port',
'entPhysicalName' => 'Port '.$i,
'entPhysicalIsFRU' => 'false',
'entPhysicalModelName' => trim($vendor_oids[$i]['sfpTranceiverCode']),
'entPhysicalContainedIn' => 1,
'entPhysicalParentRelPos' => $i,
'ifIndex' => $i,
'entPhysicalVendorType' => trim($vendor_oids[$i]['sfpConnectorType']),
'entPhysicalSerialNum' => trim($vendor_oids[$i]['sfpVendorSn']),
'entPhysicalHardwareRev' => trim($vendor_oids[$i]['sfpVendorPn']),
'entPhysicalFirmwareRev' => trim($vendor_oids[$i]['sfpVendorRev']),
'entPhysicalMfgName' => trim($vendor_oids[$i]['sfpVendorName']),
];
}
discover_inventory($device, $system_index, $inventory[$system_index], $vendor_mib);
}
print_debug_vars($inventory);
// EOF

View File

@ -0,0 +1,15 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
*
*/
include __DIR__ . '/des3026-l2mgmt-mib.inc.php';
// EOF

View File

@ -0,0 +1,102 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
*
*/
if (is_device_mib($device, 'DES3026-L2MGMT-MIB')) {
$desmib = 'DES3026-L2MGMT-MIB';
$copperports = 24;
} elseif (is_device_mib($device, 'DES3018-L2MGMT-MIB')) {
$desmib = 'DES3018-L2MGMT-MIB';
$copperports = 16;
} else {
return;
}
echo($desmib);
$revision = snmp_get_oid($device, 'probeHardwareRev.0', 'RMON2-MIB');
$system_index = 1;
$inventory[$system_index] = array(
'entPhysicalDescr' => $device['sysDescr'],
'entPhysicalClass' => 'chassis',
'entPhysicalName' => $device['hardware'],
'entPhysicalHardwareRev' => $revision,
'entPhysicalSoftwareRev' => $device['version'],
'entPhysicalIsFRU' => 'true',
'entPhysicalModelName' => $device['hardware'],
'entPhysicalSerialNum' => $device['serial'],
'entPhysicalContainedIn' => 0,
'entPhysicalParentRelPos' => 1,
'entPhysicalMfgName' => 'D-Link',
);
discover_inventory($device, $system_index, $inventory[$system_index], $desmib);
for ($i = 1; $i <= $copperports; $i++) {
$system_index = 100 + $i;
$inventory[$system_index] = array(
'entPhysicalDescr' => '100Base-T Copper Port',
'entPhysicalClass' => 'port',
'entPhysicalName' => 'Port '.$i,
'entPhysicalIsFRU' => 'false',
'entPhysicalModelName' => 'Copper Port',
'entPhysicalContainedIn' => 1,
'entPhysicalParentRelPos' => $i,
'ifIndex' => $i,
);
discover_inventory($device, $system_index, $inventory[$system_index], $desmib);
}
for ($slot = 1; $slot <= 2; $slot++) {
// Slot 1
$system_index = 100 + $i;
$inventory[$system_index] = array(
'entPhysicalDescr' => 'DES-3018/3026 extended Slot',
'entPhysicalClass' => 'container',
'entPhysicalName' => 'Slot '.$slot,
'entPhysicalIsFRU' => 'false',
'entPhysicalModelName' => 'Extended Slot',
'entPhysicalContainedIn' => 1,
'entPhysicalParentRelPos' => $i,
);
discover_inventory($device, $system_index, $inventory[$system_index], $desmib);
if ($slot == 1) {
$des30xxswL2ModuleXType = snmp_get_oid($device, 'swL2Module-1-Type.0', $desmib);
} else {
$des30xxswL2ModuleXType = snmp_get_oid($device, 'swL2Module-2-Type.0', $desmib);
}
$system2_index = 200 + $i;
$inventory[$system2_index] = array(
'entPhysicalDescr' => $des30xxswL2ModuleXType,
'entPhysicalClass' => 'module',
'entPhysicalName' => 'Module '.$slot,
'entPhysicalIsFRU' => 'true',
'entPhysicalContainedIn' => $system_index,
'entPhysicalParentRelPos' => 0,
'entPhysicalMfgName' => 'D-Link',
);
discover_inventory($device, $system2_index, $inventory[$system2_index], $desmib);
$system3_index = 300 + $i;
$inventory[$system3_index] = array(
'entPhysicalDescr' => 'Gigabit Ethernet',
'entPhysicalClass' => 'port',
'entPhysicalIsFRU' => 'false',
'entPhysicalContainedIn' => $system2_index,
'entPhysicalParentRelPos' => 0,
'ifIndex' => $i,
);
discover_inventory($device, $system3_index, $inventory[$system3_index], $desmib);
// Slot 2
$i++;
}
print_debug_vars($inventory);
// EOF

View File

@ -0,0 +1,75 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
// This device not have self Indexes.
// Use workaround ($base_vendor_index * 100000) + ($e7CardBank * 1000) + $e7CardIndex
$base_vendor_index = 6321;
// System
$e7SystemId = snmp_get($device, 'e7SystemId.0', '-OQUs', 'E7-Calix-MIB');
if ($e7SystemId)
{
$e7SystemChassisSerialNumber = snmp_get($device, '.1.3.6.1.4.1.6321.1.2.2.2.1.7.10.0', '-Oqvn');
$system_index = $base_vendor_index * 100000;
$inventory[$system_index] = array(
'entPhysicalDescr' => 'Calix Networks, E7 Ethernet Service Access Platform',
'entPhysicalClass' => 'chassis',
'entPhysicalName' => 'E7 ESAP',
'entPhysicalSerialNum' => $e7SystemChassisSerialNumber,
'entPhysicalAssetID' => $e7SystemId,
'entPhysicalIsFRU' => 'true',
'entPhysicalContainedIn' => 0,
'entPhysicalParentRelPos' => 0,
'entPhysicalMfgName' => 'Calix'
);
discover_inventory($device, $system_index, $inventory[$system_index], $mib);
// Cards
$E7CardEntry = snmpwalk_cache_twopart_oid($device, 'E7CardEntry', array(), 'E7-Calix-MIB');
foreach ($E7CardEntry as $e7CardBank => $entries)
{
$bank_index = $system_index + $e7CardBank * 1000;
$inventory[$bank_index] = array(
'entPhysicalDescr' => 'E7 ESAP Bank',
'entPhysicalClass' => 'container',
'entPhysicalName' => 'Bank '.$e7CardBank,
'entPhysicalIsFRU' => 'false',
'entPhysicalContainedIn' => $system_index,
'entPhysicalParentRelPos' => $e7CardBank,
'entPhysicalMfgName' => 'Calix'
);
discover_inventory($device, $bank_index, $inventory[$bank_index], $mib);
foreach ($entries as $e7CardIndex => $entry)
{
$card_index = $bank_index + $e7CardIndex;
$inventory[$card_index] = array(
'entPhysicalDescr' => 'E7 ESAP Card',
'entPhysicalClass' => 'other',
'entPhysicalName' => 'Card '.ucfirst($entry['e7CardActualType']),
'entPhysicalVendorType' => $entry['e7CardActualType'],
'entPhysicalSerialNum' => $entry['e7CardSerialNumber'],
'entPhysicalSoftwareRev' => $entry['e7CardSoftwareVersion'],
'entPhysicalIsFRU' => 'false',
'entPhysicalContainedIn' => $bank_index,
'entPhysicalParentRelPos' => $e7CardIndex,
'entPhysicalMfgName' => 'Calix'
);
discover_inventory($device, $card_index, $inventory[$card_index], $mib);
}
}
print_debug_vars($inventory);
}
// EOF

View File

@ -0,0 +1,208 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
*
*/
echo("ENTITY-MIB ");
$snmp_flags = OBS_SNMP_ALL;
//snmp_log_error(OBS_SNMP_ERROR_OID_NOT_INCREASING, FALSE); // disable log error for next snmpwalk
$entity_array = snmpwalk_cache_oid($device, "entPhysicalEntry", [], snmp_mib_entity_vendortype($device, 'ENTITY-MIB'));
if (!snmp_status()) {
if (snmp_error_code() === OBS_SNMP_ERROR_OID_NOT_INCREASING) {
// Try refetch with NOINCREASE
$snmp_flags |= OBS_SNMP_NOINCREASE;
print_debug("WARNING! snmpwalk error 'OID not increasing' detected, try snmpwalk with -Cc option.");
$entity_array = snmpwalk_cache_oid($device, "entPhysicalEntry", $entity_array, snmp_mib_entity_vendortype($device, 'ENTITY-MIB'), NULL, $snmp_flags);
if (!snmp_status()) { return; }
} else {
return;
}
}
$entity_array = snmpwalk_cache_twopart_oid($device, "entAliasMappingIdentifier", $entity_array, 'ENTITY-MIB:IF-MIB', NULL, $snmp_flags);
$GLOBALS['cache']['snmp']['ENTITY-MIB'][$device['device_id']] = $entity_array; // Cache this array for sensors discovery (see in cisco-entity-sensor-mib or entity-sensor-mib)
// Some vendor specific inventory expander's
$vendor_oids = [];
$vendor_mib = NULL;
if (is_device_mib($device, 'ELTEX-MES-PHYSICAL-DESCRIPTION-MIB')) {
$vendor_mib = 'ELTEX-MES-PHYSICAL-DESCRIPTION-MIB';
$vendor_oids = snmpwalk_cache_oid($device, "eltPhdTransceiverInfoTable", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
//print_vars($entity_array);
//print_debug_vars($vendor_oids);
} elseif (is_device_mib($device, 'DGS3627G-L2MGMT-MIB')) {
$vendor_mib = 'DGS3627G-L2MGMT-MIB';
$vendor_oids = snmpwalk_cache_oid($device, "swL2PortSfpInfoTable", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
//print_vars($entity_array);
//print_debug_vars($vendor_oids);
} elseif (is_device_mib($device, 'DGS3120-24SC-L2MGMT-MIB')) {
$vendor_mib = 'DGS3120-24SC-L2MGMT-MIB';
$vendor_oids = snmpwalk_cache_oid($device, "swL2PortSfpInfoTable", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
//print_vars($entity_array);
//print_debug_vars($vendor_oids);
} elseif (is_device_mib($device, 'DGS-3420-28SC-L2MGMT-MIB')) {
$vendor_mib = 'DGS-3420-28SC-L2MGMT-MIB';
$vendor_oids = snmpwalk_cache_oid($device, "swL2PortSfpInfoTable", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
//print_vars($entity_array);
//print_debug_vars($vendor_oids);
} elseif (is_device_mib($device, 'DGS-3420-26SC-L2MGMT-MIB')) {
$vendor_mib = 'DGS-3420-26SC-L2MGMT-MIB';
$vendor_oids = snmpwalk_cache_oid($device, "swL2PortSfpInfoTable", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
//print_vars($entity_array);
//print_debug_vars($vendor_oids);
} elseif (is_device_mib($device, 'DGS-3620-28SC-L2MGMT-MIB')) {
$vendor_mib = 'DGS-3620-28SC-L2MGMT-MIB';
$vendor_oids = snmpwalk_cache_oid($device, "swL2PortSfpInfoTable", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
//print_vars($entity_array);
//print_debug_vars($vendor_oids);
} elseif (is_device_mib($device, 'DGS-3620-26SC-L2MGMT-MIB')) {
$vendor_mib = 'DGS-3620-26SC-L2MGMT-MIB';
$vendor_oids = snmpwalk_cache_oid($device, "swL2PortSfpInfoTable", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
//print_vars($entity_array);
//print_debug_vars($vendor_oids);
}
foreach ($entity_array as $entPhysicalIndex => $entry) {
unset($entAliasMappingIdentifier);
foreach ([ 0, 1, 2 ] as $i) {
if (isset($entity_array[$entPhysicalIndex][$i]['entAliasMappingIdentifier'])) {
$entAliasMappingIdentifier = $entity_array[$entPhysicalIndex][$i]['entAliasMappingIdentifier'];
break;
}
}
if (isset($entAliasMappingIdentifier) && str_contains_array($entAliasMappingIdentifier, 'fIndex')) {
list(, $ifIndex) = explode('.', $entAliasMappingIdentifier);
$entry['ifIndex'] = $ifIndex;
}
// Some vendor specific inventory expander's
if ($vendor_mib === 'ELTEX-MES-PHYSICAL-DESCRIPTION-MIB' && isset($vendor_oids[$entry['ifIndex']])) {
//$entry = array_merge($entry, $vendor_oids[$entry['ifIndex']]);
print_debug_vars($vendor_oids[$entry['ifIndex']]);
/*
[entPhysicalDescr] => string(20) "gigabitethernet1/0/2"
[entPhysicalVendorType] => string(17) "cevPortDCUATMPort"
[entPhysicalContainedIn] => string(8) "68424704"
[entPhysicalClass] => string(4) "port"
[entPhysicalParentRelPos] => string(1) "4"
[entPhysicalName] => string(7) "gi1/0/2"
[entPhysicalHardwareRev] => string(0) ""
[entPhysicalFirmwareRev] => string(0) ""
[entPhysicalSoftwareRev] => string(0) ""
[entPhysicalSerialNum] => string(0) ""
[entPhysicalMfgName] => string(0) ""
[entPhysicalModelName] => string(0) ""
[entPhysicalAlias] => string(0) ""
[entPhysicalAssetID] => string(0) ""
[entPhysicalIsFRU] => string(5) "false"
*/
/*
[eltPhdTransceiverInfoConnectorType] => string(2) "sc"
[eltPhdTransceiverInfoType] => string(11) "sfp-sfpplus"
[eltPhdTransceiverInfoComplianceCode] => string(11) "1000BASE-LX"
[eltPhdTransceiverInfoWaveLength] => string(4) "1550"
[eltPhdTransceiverInfoVendorName] => string(16) "OptiCin "
[eltPhdTransceiverInfoSerialNumber] => string(16) "PF4D870547 "
[eltPhdTransceiverInfoFiberDiameterType] => string(6) "fiber9"
[eltPhdTransceiverInfoTransferDistance] => string(4) "3000"
[eltPhdTransceiverInfoDiagnostic] => string(5) "false"
[eltPhdTransceiverInfoPartNumber] => string(16) "SFP-WDM5.03 "
[eltPhdTransceiverInfoVendorRev] => string(4) " "
*/
// entPhysicalVendorType -> eltPhdTransceiverInfoType
// entPhysicalHardwareRev -> eltPhdTransceiverInfoPartNumber
// entPhysicalFirmwareRev -> eltPhdTransceiverInfoVendorRev
// entPhysicalSoftwareRev -> ??
// entPhysicalSerialNum -> eltPhdTransceiverInfoSerialNumber
// entPhysicalMfgName -> eltPhdTransceiverInfoVendorName
// entPhysicalModelName -> eltPhdTransceiverInfoComplianceCode
// entPhysicalAlias -> ??
// entPhysicalAssetID -> ??
$entry['entPhysicalVendorType'] = trim($vendor_oids[$entry['ifIndex']]['eltPhdTransceiverInfoType']);
$entry['entPhysicalHardwareRev'] = trim($vendor_oids[$entry['ifIndex']]['eltPhdTransceiverInfoPartNumber']);
$entry['entPhysicalFirmwareRev'] = trim($vendor_oids[$entry['ifIndex']]['eltPhdTransceiverInfoVendorRev']);
$entry['entPhysicalSerialNum'] = trim($vendor_oids[$entry['ifIndex']]['eltPhdTransceiverInfoSerialNumber']);
$entry['entPhysicalMfgName'] = trim($vendor_oids[$entry['ifIndex']]['eltPhdTransceiverInfoVendorName']);
$entry['entPhysicalModelName'] = trim($vendor_oids[$entry['ifIndex']]['eltPhdTransceiverInfoComplianceCode']);
} elseif (str_starts($vendor_mib, 'DGS') && $entry['entPhysicalModelName'] === 'Fiber Port' &&
isset($vendor_oids[$entry['entPhysicalParentRelPos']]) &&
is_numeric($vendor_oids[$entry['entPhysicalParentRelPos']]['swL2PortSfpInfoDateCode'])) {
//$entry = array_merge($entry, $vendor_oids[$entry['ifIndex']]);
print_debug_vars($vendor_oids[$entry['entPhysicalParentRelPos']]);
/*
[13] => array(
[entPhysicalDescr] => string(29) "1000_TXGBIC_COMBO Copper Port"
[entPhysicalVendorType] => string(11) "zeroDotZero"
[entPhysicalContainedIn] => string(1) "2"
[entPhysicalClass] => string(4) "port"
[entPhysicalParentRelPos] => string(2) "21"
[entPhysicalName] => string(7) "Port 21"
[entPhysicalHardwareRev] => string(0) ""
[entPhysicalFirmwareRev] => string(0) ""
[entPhysicalSoftwareRev] => string(0) ""
[entPhysicalSerialNum] => string(0) ""
[entPhysicalMfgName] => string(0) ""
[entPhysicalModelName] => string(11) "Copper Port"
[entPhysicalAlias] => string(0) ""
[entPhysicalAssetID] => string(0) ""
[entPhysicalIsFRU] => string(5) "false"
)
...
[37] => array(
[entPhysicalDescr] => string(28) "1000_TXGBIC_COMBO Fiber Port"
[entPhysicalVendorType] => string(11) "zeroDotZero"
[entPhysicalContainedIn] => string(1) "2"
[entPhysicalClass] => string(4) "port"
[entPhysicalParentRelPos] => string(2) "21"
[entPhysicalName] => string(7) "Port 21"
[entPhysicalHardwareRev] => string(0) ""
[entPhysicalFirmwareRev] => string(0) ""
[entPhysicalSoftwareRev] => string(0) ""
[entPhysicalSerialNum] => string(0) ""
[entPhysicalMfgName] => string(0) ""
[entPhysicalModelName] => string(10) "Fiber Port"
[entPhysicalAlias] => string(0) ""
[entPhysicalAssetID] => string(0) ""
[entPhysicalIsFRU] => string(5) "false"
)
*/
/*
[21] => array(
[swL2PortSfpInfoPortIndex] => string(2) "21"
[swL2PortSfpInfoConnectType] => string(6) "SFP LC"
[swL2PortSfpInfoVendorName] => string(3) "OEM"
[swL2PortSfpInfoVendorPN] => string(10) "SFP-BX-U31"
[swL2PortSfpInfoVendorSN] => string(8) "F10GU046"
[swL2PortSfpInfoVendorOUI] => string(6) "0:0:0."
[swL2PortSfpInfoVendorRev] => string(3) "1.0"
[swL2PortSfpInfoDateCode] => string(6) "090701"
[swL2PortSfpInfoFiberType] => string(16) "Single Mode (SM)"
[swL2PortSfpInfoBaudRate] => string(4) "1300"
[swL2PortSfpInfoWavelength] => string(4) "1310"
)
*/
$entry['entPhysicalVendorType'] = trim($vendor_oids[$entry['entPhysicalParentRelPos']]['swL2PortSfpInfoConnectType']);
$entry['entPhysicalHardwareRev'] = trim($vendor_oids[$entry['entPhysicalParentRelPos']]['swL2PortSfpInfoVendorPN']);
$entry['entPhysicalFirmwareRev'] = trim($vendor_oids[$entry['entPhysicalParentRelPos']]['swL2PortSfpInfoVendorRev']);
$entry['entPhysicalSerialNum'] = trim($vendor_oids[$entry['entPhysicalParentRelPos']]['swL2PortSfpInfoVendorSN']);
$entry['entPhysicalMfgName'] = trim($vendor_oids[$entry['entPhysicalParentRelPos']]['swL2PortSfpInfoVendorName']);
$entry['entPhysicalModelName'] = trim($vendor_oids[$entry['entPhysicalParentRelPos']]['swL2PortSfpInfoFiberType']);
}
if ($entry['entPhysicalDescr'] || $entry['entPhysicalName']) {
discover_inventory($device, $entPhysicalIndex, $entry, $mib);
}
}
// EOF

View File

@ -0,0 +1,271 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2015 Observium Limited
*
*/
echo(" F5-BIGIP-SYSTEM-MIB ");
$index = 1; $chassis_pos = 0;
$inventory[$index] = array(
'entPhysicalName' => $device['hardware'].' Chassis',
'entPhysicalDescr' => $device['hostname'],
'entPhysicalClass' => 'chassis',
'entPhysicalIsFRU' => 'true',
'entPhysicalModelName' => $device['hardware'],
'entPhysicalSerialNum' => $device['serial'],
'entPhysicalHardwareRev' => snmp_get($device, "sysGeneralHwName.0", "-Oqv", "F5-BIGIP-SYSTEM-MIB"),
'entPhysicalFirmwareRev' => $device['version'],
'entPhysicalAssetID' => $device['asset_tag'],
'entPhysicalContainedIn' => 0,
'entPhysicalParentRelPos' => -1,
'entPhysicalMfgName' => 'F5'
);
discover_inventory($device, $index, $inventory[$index], $mib);
if (!isset($cache_discovery['f5-bigip-system-mib']))
{
$cache_discovery['f5-bigip-system-mib']['chassis']['port'] = snmpwalk_cache_oid($device, 'sysInterfaceTable', array(), 'F5-BIGIP-SYSTEM-MIB');
$cache_discovery['f5-bigip-system-mib']['chassis']['powerSupply'] = snmpwalk_cache_oid($device, 'sysChassisPowerSupplyTable', array(), 'F5-BIGIP-SYSTEM-MIB');
$cache_discovery['f5-bigip-system-mib']['chassis']['fan'] = snmpwalk_cache_oid($device, 'sysChassisFanTable', array(), 'F5-BIGIP-SYSTEM-MIB');
$cache_discovery['f5-bigip-system-mib']['chassis']['temp'] = snmpwalk_cache_oid($device, 'sysChassisTempTable', array(), 'F5-BIGIP-SYSTEM-MIB');
$cache_discovery['f5-bigip-system-mib']['slot']['voltage'] = snmpwalk_cache_oid($device, 'sysBladeVoltageTable', array(), 'F5-BIGIP-SYSTEM-MIB');
$cache_discovery['f5-bigip-system-mib']['slot']['cpu'] = snmpwalk_cache_oid($device, 'sysCpuSensorTable', array(), 'F5-BIGIP-SYSTEM-MIB');
$cache_discovery['f5-bigip-system-mib']['slot']['disk'] = snmpwalk_cache_oid($device, 'sysPhysicalDiskTable', array(), 'F5-BIGIP-SYSTEM-MIB');
$cache_discovery['f5-bigip-system-mib']['slot']['temp'] = snmpwalk_cache_oid($device, 'sysBladeTempTable', array(), 'F5-BIGIP-SYSTEM-MIB');
}
$cache_ports = dbFetchRows('SELECT `ifName`,`ifIndex` FROM `ports` WHERE `device_id` = ?', array($device['device_id']));
foreach ($cache_ports as $row => $port)
{
$cache_ports[$port['ifName']] = $port['ifIndex'];
}
$fru = array(
'fan' => 'false',
'powerSupply' => 'true',
'temp' => 'false',
'disk' => 'false',
'port' => 'false',
);
$class = array(
'fan' => 'fan',
'powerSupply' => 'powerSupply',
'temp' => 'sensor',
'disk' => 'disk',
'port' => 'port',
);
foreach ($cache_discovery['f5-bigip-system-mib']['chassis'] as $type => $cache)
{
if (!count($cache)) continue;
$index++; $chassis_pos++;
$container = $index;
$inventory[$index] = array(
'entPhysicalName' => 'Chassis '.ucfirst($type).' Container',
'entPhysicalDescr' => $device['hostname'].' - Chassis '.ucfirst($type).' Container',
'entPhysicalClass' => 'container',
'entPhysicalIsFRU' => $fru[$type],
'entPhysicalContainedIn' => 1,
'entPhysicalParentRelPos' => $chassis_pos,
'entPhysicalMfgName' => 'F5'
);
discover_inventory($device, $index, $inventory[$index], $mib);
$pos = 0;
foreach ($cache as $id => $entry)
{
$index++; $pos++;
$name = ucfirst($type).' '.$id;
$serial = NULL;
$ifindex = NULL;
if ($type == 'port')
{
$ifindex = $cache_ports[$id];
}
$inventory[$index] = array(
'entPhysicalName' => $name,
'entPhysicalDescr' => $device['hostname'].' - '.$name,
'entPhysicalClass' => $class[$type],
'entPhysicalIsFRU' => $fru[$type],
'entPhysicalSerialNum' => $serial,
'entPhysicalContainedIn' => $container,
'entPhysicalParentRelPos' => $pos,
'entPhysicalMfgName' => 'F5',
'ifIndex' => $ifindex
);
discover_inventory($device, $index, $inventory[$index], $mib);
unset($ifIndex);
}
}
// Build and array of stuff by slot
foreach ($cache_discovery['f5-bigip-system-mib']['slot'] as $type => $sensors)
{
foreach ($sensors as $tmp => $sensor)
switch ($type)
{
case 'cpu':
$slots[$sensor['sysCpuSensorSlot']]['cpu'] = $sensor;
break;
case 'disk':
$slots[$sensor['sysPhysicalDiskSlotId']]['disk'] = $sensor;
break;
case 'temp':
$slots[$sensor['sysBladeTempSlot']]['temp'][$sensor['sysBladeTempIndex']] = $sensor;
break;
case 'voltage':
$slots[$sensor['sysBladeVoltageSlot']]['voltage'][$sensor['sysBladeVoltageIndex']] = $sensor;
break;
}
}
foreach ($slots as $slot => $sensors)
{
$index++; $chassis_pos++;
$slot_container = $index;
$pos = 0;
$inventory[$index] = array(
'entPhysicalName' => 'Blade Slot '.$slot.' Container',
'entPhysicalDescr' => $device['hostname'].' - Blade Slot '.$slot.' Container',
'entPhysicalClass' => 'container',
'entPhysicalIsFRU' => 'false',
'entPhysicalContainedIn' => 1,
'entPhysicalParentRelPos' => $chassis_pos,
'entPhysicalMfgName' => 'F5'
);
discover_inventory($device, $index, $inventory[$index], $mib);
foreach ($sensors as $type => $entry)
{
$index++;
if ($type == 'disk')
{
$pos++;
$name = $entry['sysPhysicalDiskName'];
$serial = $entry['sysPhysicalDiskSerialNumber'];
$inventory[$index] = array(
'entPhysicalName' => $name,
'entPhysicalDescr' => $device['hostname'].' - '.$name,
'entPhysicalClass' => $class[$type],
'entPhysicalIsFRU' => $fru[$type],
'entPhysicalSerialNum' => $serial,
'entPhysicalContainedIn' => $slot_container,
'entPhysicalParentRelPos' => $pos,
'entPhysicalMfgName' => 'F5',
);
discover_inventory($device, $index, $inventory[$index], $mib);
}
else if ($type == 'cpu')
{
$pos++;
$cpu_container = $index;
$inventory[$index] = array(
'entPhysicalName' => 'Blade Slot '.$slot.' CPU Container',
'entPhysicalDescr' => $device['hostname'].' - Chassis Slot '.$slot.' CPU Container',
'entPhysicalClass' => 'container',
'entPhysicalIsFRU' => 'false',
'entPhysicalContainedIn' => $slot_container,
'entPhysicalParentRelPos' => $pos,
'entPhysicalMfgName' => 'F5'
);
discover_inventory($device, $index, $inventory[$index], $mib);
$index++;
$name = $entry['sysCpuSensorName'].' Temperature';
$inventory[$index] = array(
'entPhysicalName' => $name,
'entPhysicalDescr' => $device['hostname'].' - '.$name,
'entPhysicalClass' => 'sensor',
'entPhysicalIsFRU' => 'false',
'entPhysicalContainedIn' => $cpu_container,
'entPhysicalParentRelPos' => 1,
'entPhysicalMfgName' => 'F5',
);
discover_inventory($device, $index, $inventory[$index], $mib);
$index++;
$name = $entry['sysCpuSensorName'].' Fan';
$inventory[$index] = array(
'entPhysicalName' => $name,
'entPhysicalDescr' => $device['hostname'].' - '.$name,
'entPhysicalClass' => 'fan',
'entPhysicalIsFRU' => 'false',
'entPhysicalContainedIn' => $cpu_container,
'entPhysicalParentRelPos' => 2,
'entPhysicalMfgName' => 'F5',
);
discover_inventory($device, $index, $inventory[$index], $mib);
}
else if ($type == 'temp')
{
$pos++;
$temp_container = $index;
$inventory[$index] = array(
'entPhysicalName' => 'Blade Slot '.$slot.' Temp Container',
'entPhysicalDescr' => $device['hostname'].' - Chassis Slot '.$slot.' Temp Container',
'entPhysicalClass' => 'container',
'entPhysicalIsFRU' => 'false',
'entPhysicalContainedIn' => $slot_container,
'entPhysicalParentRelPos' => $pos,
'entPhysicalMfgName' => 'F5'
);
discover_inventory($device, $index, $inventory[$index], $mib);
foreach ($entry as $temp_index => $temp_sensor)
{
$index++;
$inventory[$index] = array(
'entPhysicalName' => $temp_sensor['sysBladeTempLocation'],
'entPhysicalDescr' => $device['hostname'].' - '.$temp_sensor['sysBladeTempLocation'],
'entPhysicalClass' => 'sensor',
'entPhysicalIsFRU' => 'false',
'entPhysicalContainedIn' => $temp_container,
'entPhysicalParentRelPos' => $temp_index,
'entPhysicalMfgName' => 'F5',
);
discover_inventory($device, $index, $inventory[$index], $mib);
}
}
else if ($type == 'voltage')
{
$pos++;
$voltage_container = $index;
$inventory[$index] = array(
'entPhysicalName' => 'Blade Slot '.$slot.' Voltage Container',
'entPhysicalDescr' => $device['hostname'].' - Chassis Slot '.$slot.' Voltage Container',
'entPhysicalClass' => 'container',
'entPhysicalIsFRU' => 'false',
'entPhysicalContainedIn' => $slot_container,
'entPhysicalParentRelPos' => $pos,
'entPhysicalMfgName' => 'F5'
);
discover_inventory($device, $index, $inventory[$index], $mib);
$volt_pos = 0;
foreach ($entry as $volt_index => $volt_sensor)
{
$index++; $volt_pos++;
$inventory[$index] = array(
'entPhysicalName' => $volt_index,
'entPhysicalDescr' => $device['hostname'].' - '.$volt_index,
'entPhysicalClass' => 'sensor',
'entPhysicalIsFRU' => 'false',
'entPhysicalContainedIn' => $voltage_container,
'entPhysicalParentRelPos' => $volt_pos,
'entPhysicalMfgName' => 'F5',
);
discover_inventory($device, $index, $inventory[$index], $mib);
}
}
}
}
unset($cache_ports, $slots, $name, $index, $container, $pos, $slot_container, $cpu_container, $temp_container, $voltage_container);
// EOF

View File

@ -0,0 +1,71 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
$snChasProductType = snmp_get($device, 'snChasProductType.0', '-OQv', 'FOUNDRY-SN-AGENT-MIB');
if ($snChasProductType)
{
$snChasSerNum = snmp_get($device, 'snChasSerNum.0', '-OQv', 'FOUNDRY-SN-AGENT-MIB');
// Insert chassis as index 1, everything hangs off of this.
$system_index = 1;
$inventory[$system_index] = array(
'entPhysicalDescr' => $snChasProductType,
'entPhysicalClass' => 'chassis',
'entPhysicalName' => 'Chassis',
'entPhysicalSerialNum' => $snChasSerNum,
'entPhysicalIsFRU' => 'true',
'entPhysicalContainedIn' => 0,
'entPhysicalParentRelPos' => -1,
'entPhysicalMfgName' => 'Brocade'
);
discover_inventory($device, $system_index, $inventory[$system_index], $mib);
// Now fetch data for the rest of the hardware in the chassis
$data = snmpwalk_cache_oid($device, 'snAgentBrdTable', array(), 'FOUNDRY-SN-AGENT-MIB');
$relPos = 0;
foreach ($data as $part)
{
$system_index = $part['snAgentBrdIndex']*256;
if ($system_index != 0)
{
$containedIn = 1; // Attach to chassis inserted above
// snAgentBrdModuleStatus.6 = moduleRunning
// snAgentBrdModuleStatus.7 = moduleEmpty
if ($part['snAgentBrdModuleStatus'] != 'moduleEmpty')
{
$relPos++;
$inventory[$system_index] = array(
'entPhysicalDescr' => $part['snAgentBrdMainBrdDescription'],
'entPhysicalClass' => 'module',
'entPhysicalName' => $part['snAgentBrdMainBrdDescription'],
'entPhysicalSerialNum' => $part['snAgentBrdSerialNumber'],
'entPhysicalIsFRU' => 'true',
'entPhysicalContainedIn' => $containedIn,
'entPhysicalParentRelPos' => $relPos,
'entPhysicalMfgName' => 'Brocade'
);
discover_inventory($device, $system_index, $inventory[$system_index], $mib);
}
}
}
}
// EOF

View File

@ -0,0 +1,133 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
$productTitle = snmp_get($device, 'productTitle.0', '-OQv', 'GEIST-MIB-V3');
if ($productTitle)
{
// Insert chassis as index 1, everything hangs off of this.
$system_index = 1;
$inventory[$system_index] = array(
'entPhysicalDescr' => $productTitle,
'entPhysicalClass' => 'chassis',
'entPhysicalName' => 'Chassis',
'entPhysicalIsFRU' => 'true',
'entPhysicalContainedIn' => 0,
'entPhysicalParentRelPos' => -1,
'entPhysicalMfgName' => 'Geist',
);
discover_inventory($device, $system_index, $inventory[$system_index], $mib);
$relPos = 1;
// Note: sensors without example SNMP output have not been tested.
$geist_sensors = array(
// GEIST-MIB-V3::climateSerial.1 = STRING: 28F123456700000D
// GEIST-MIB-V3::climateName.1 = STRING: RSMINI163
// GEIST-MIB-V3::climateAvail.1 = Gauge32: 1
array('descr' => 'Climate Monitor', 'prefix' => 'climate', 'oid' => 2, 'class' => 'sensor'),
// GEIST-MIB-V3::powMonSerial.1 = STRING: 3B0000007BF12345
// GEIST-MIB-V3::powMonName.1 = STRING: Outlet
// GEIST-MIB-V3::powMonAvail.1 = Gauge32: 1
array('descr' => 'Power Monitor', 'prefix' => 'powMon', 'oid' => 3, 'class' => 'powerSupply', 'avail' => 1),
array('descr' => 'Temperature Sensor', 'prefix' => 'tempSensor', 'oid' => 4, 'class' => 'sensor'),
// GEIST-MIB-V3::airFlowSensorSerial.1 = STRING: 2000000012345678
// GEIST-MIB-V3::airFlowSensorName.1 = STRING: AF/HTD Sensor
// GEIST-MIB-V3::airFlowSensorAvail.1 = Gauge32: 1
array('descr' => 'AF/HTD Sensor', 'prefix' => 'airFlowSensor', 'oid' => 5, 'class' => 'airflowSensor'),
array('descr' => 'DELTA 3 Channel Controller', 'prefix' => 'ctrl3ChDELTA', 'oid' => 6, 'class' => 'sensor'),
// GEIST-MIB-V3::doorSensorSerial.1 = STRING: 0E00000123456789
// GEIST-MIB-V3::doorSensorName.1 = STRING: Door Sensor
// GEIST-MIB-V3::doorSensorAvail.1 = Gauge32: 1
array('descr' => 'Door Sensor', 'prefix' => 'doorSensor', 'oid' => 7, 'class' => 'sensor'),
array('descr' => 'Water Sensor', 'prefix' => 'waterSensor', 'oid' => 8, 'class' => 'sensor'),
array('descr' => 'Current Sensor', 'prefix' => 'currentSensor', 'oid' => 9, 'class' => 'sensor'),
array('descr' => 'Millivolt Sensor', 'prefix' => 'millivoltSensor', 'oid' => 10, 'class' => 'sensor'),
array('descr' => '3 Channel Power Sensor', 'prefix' => 'power3ChSensor', 'oid' => 11, 'class' => 'sensor'),
array('descr' => 'Outlet', 'prefix' => 'outlet', 'oid' => 12, 'class' => 'outlet'),
array('descr' => 'Fan Controller Monitor', 'prefix' => 'vsfc', 'oid' => 13, 'class' => 'sensor'),
array('descr' => '3 Channel Power Monitor', 'prefix' => 'ctrl3Ch', 'oid' => 14, 'class' => 'sensor'),
array('descr' => 'Amperage Controller', 'prefix' => 'analogSensor', 'oid' => 15, 'class' => 'powerSupply'),
// GEIST-MIB-V3::ctrlOutletName.1 = STRING: Outlet 1
array('descr' => 'Controlled outlet', 'prefix' => 'ctrlOutlet', 'oid' => 16, 'class' => 'outlet', 'avail' => 1),
array('descr' => 'Dew Point Sensor', 'prefix' => 'dewpointSensor', 'oid' => 17, 'class' => 'sensor'),
// GEIST-MIB-V3::digitalSensorSerial.1 = STRING: 8C00000493782754
// GEIST-MIB-V3::digitalSensorName.1 = STRING: CCAT
// GEIST-MIB-V3::digitalSensorAvail.1 = Gauge32: 1
array('descr' => 'Digital Sensor', 'prefix' => 'digitalSensor', 'oid' => 18, 'class' => 'sensor'),
array('descr' => 'DSTS Controller Sensor', 'prefix' => 'dstsSensor', 'oid' => 19, 'class' => 'sensor'),
array('descr' => 'City Power Sensor', 'prefix' => 'cpmSensor', 'oid' => 20, 'class' => 'sensor'),
// GEIST-MIB-V3::smokeAlarmSerial.1 = STRING: D900000498765432
// GEIST-MIB-V3::smokeAlarmName.1 = STRING: Smoke Alarm
// GEIST-MIB-V3::smokeAlarmAvail.1 = Gauge32: 1
array('descr' => 'Smoke Alarm Sensor', 'prefix' => 'smokeAlarm', 'oid' => 21, 'class' => 'sensor'),
array('descr' => '-48VDC Sensor', 'prefix' => 'neg48VdcSensor', 'oid' => 22, 'class' => 'sensor'),
array('descr' => '+30VDC Sensor', 'prefix' => 'pos30VdcSensor', 'oid' => 23, 'class' => 'sensor'),
array('descr' => 'Analog Sensor', 'prefix' => 'analogSensor', 'oid' => 24, 'class' => 'sensor'),
// GEIST-MIB-V3::ctrl3ChIECSerial.1 = STRING: 0000777654567777
// GEIST-MIB-V3::ctrl3ChIECName.1 = STRING: my-geist-pdu0
// GEIST-MIB-V3::ctrl3ChIECAvail.1 = Gauge32: 1
array('descr' => '3 Channel IEC Power Monitor', 'prefix' => 'ctrl3ChIEC', 'oid' => 25, 'class' => 'powerSupply'),
// GEIST-MIB-V3::climateRelaySerial.1 = STRING: 2878924802000000
// GEIST-MIB-V3::climateRelayName.1 = STRING: GRSO
// GEIST-MIB-V3::climateRelayAvail.1 = Gauge32: 1
array('descr' => 'Climate Relay Monitor', 'prefix' => 'climateRelay', 'oid' => 26, 'class' => 'sensor'),
// GEIST-MIB-V3::ctrlRelayName.1 = STRING: Relay-1
array('descr' => 'Controlled Relay', 'prefix' => 'ctrlRelay', 'oid' => 27, 'class' => 'relay', 'avail' => 1),
array('descr' => 'Airspeed Switch Sensor', 'prefix' => 'airSpeedSwitchSensor', 'oid' => 28, 'class' => 'sensor'),
// GEIST-MIB-V3::powerDMSerial.1 = STRING: E200000076221234
// GEIST-MIB-V3::powerDMName.1 = STRING: DM16 PDU
// GEIST-MIB-V3::powerDMAvail.1 = Gauge32: 1
array('descr' => 'DM16/48 Current Sensor', 'prefix' => 'powerDM', 'oid' => 29, 'class' => 'sensor'),
array('descr' => 'I/O Expander', 'prefix' => 'ioExpander', 'oid' => 30, 'class' => 'sensor'),
array('descr' => 'T3HD Sensor', 'prefix' => 't3hdSensor', 'oid' => 31, 'class' => 'sensor'),
array('descr' => 'THD Sensor', 'prefix' => 'thdSensor', 'oid' => 32, 'class' => 'sensor'),
array('descr' => '+60VDC Sensor', 'prefix' => 'pos60VdcSensor', 'oid' => 33, 'class' => 'sensor'),
array('descr' => '3Phase Outlet Control', 'prefix' => 'ctrl2CirTot', 'oid' => 34, 'class' => 'outlet'),
array('descr' => 'SC10 Sensor', 'prefix' => 'sc10Sensor', 'oid' => 35, 'class' => 'sensor'),
);
foreach ($geist_sensors as $sensor)
{
$oids = snmp_cache_table($device, $sensor['prefix'].'Table', array(), 'GEIST-MIB-V3');
foreach ($oids as $index => $entry)
{
// Index can only be int in the database, so we create our own from, this sensor is at 21239.2.$oid.
$system_index = $sensor['oid'] * 256 + $index;
if ($sensor['avail'] || $entry[$sensor['prefix'].'Avail'])
{
$inventory[$system_index] = array(
'entPhysicalDescr' => $sensor['descr'],
'entPhysicalClass' => $sensor['class'],
'entPhysicalName' => $entry[$sensor['prefix'].'Name'],
'entPhysicalSerialNum' => $entry[$sensor['prefix'].'Serial'],
'entPhysicalIsFRU' => 'true',
'entPhysicalContainedIn' => 1,
'entPhysicalParentRelPos' => $relPos,
'entPhysicalMfgName' => 'Geist',
);
discover_inventory($device, $system_index, $inventory[$system_index], $mib);
$relPos++;
}
}
}
}
unset($geist_sensors);
// EOF

View File

@ -0,0 +1,78 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
*
*/
/// FIXME. Full rewrite and move to inventory stuff
$hrDevice_oids = array('hrDeviceEntry','hrProcessorEntry');
$hrDevices = array();
foreach ($hrDevice_oids as $oid) { $hrDevices = snmpwalk_cache_oid($device, $oid, $hrDevices, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES"); }
print_debug_vars($hrDevices);
if (is_array($hrDevices)) {
foreach ($hrDevices as $hrDevice) {
if (!is_numeric($hrDevice['hrDeviceIndex'])) {
print_debug("Empty hrDevice entry skipped:");
print_debug_vars($hrDevice, 1);
continue;
}
if ($hrDevice['hrDeviceType'] === 'hrDevicePrinter' &&
$hrDevice['hrDeviceStatus'] === 'unknown' &&
$hrDevice['hrPrinterStatus'] === 'unknown') {
print_debug("Broken hrDevice entry skipped:");
print_debug_vars($hrDevice, 1);
continue;
}
//if (dbFetchCell("SELECT COUNT(*) FROM `hrDevice` WHERE device_id = ? AND hrDeviceIndex = ?",array($device['device_id'], $hrDevice['hrDeviceIndex'])))
if (dbExist('hrDevice', '`device_id` = ? AND `hrDeviceIndex` = ?', array($device['device_id'], $hrDevice['hrDeviceIndex'])))
{
if (($hrDevice['hrDeviceType'] === "hrDeviceProcessor") && empty($hrDevice['hrDeviceDescr']))
{
$hrDevice['hrDeviceDescr'] = "Processor";
}
$update_array = array('hrDeviceType' => $hrDevice['hrDeviceType'],
'hrDeviceDescr' => $hrDevice['hrDeviceDescr'],
'hrDeviceStatus' => $hrDevice['hrDeviceStatus'],
'hrDeviceErrors' => $hrDevice['hrDeviceErrors']);
if ($hrDevice['hrDeviceType'] === "hrDeviceProcessor")
{
$update_array['hrProcessorLoad'] = $hrDevice['hrProcessorLoad'];
} else {
$update_array['hrProcessorLoad'] = array('NULL');
}
dbUpdate($update_array, 'hrDevice', 'device_id = ? AND hrDeviceIndex = ?', array($device['device_id'], $hrDevice['hrDeviceIndex']));
// FIXME -- check if it has updated, and print a U instead of a .
echo(".");
} else {
$inserted = dbInsert(array('hrDeviceIndex' => $hrDevice['hrDeviceIndex'], 'device_id' => $device['device_id'], 'hrDeviceType' => $hrDevice['hrDeviceType'], 'hrDeviceDescr' => $hrDevice['hrDeviceDescr'], 'hrDeviceStatus' => $hrDevice['hrDeviceStatus'], 'hrDeviceErrors' => $hrDevice['hrDeviceErrors']), 'hrDevice');
echo("+");
}
$valid_hrDevice[$hrDevice['hrDeviceIndex']] = 1;
}
}
foreach (dbFetchRows('SELECT * FROM `hrDevice` WHERE `device_id` = ?', array($device['device_id'])) as $test_hrDevice)
{
if (!$valid_hrDevice[$test_hrDevice['hrDeviceIndex']])
{
$deleted = dbDelete('hrDevice', '`hrDevice_id` = ?', array($test_hrDevice['hrDevice_id']));
echo("-");
if (OBS_DEBUG > 1) { print_vars($test_hrDevice); echo($deleted . " deleted"); }
}
}
unset($valid_hrDevice);
// EOF

View File

@ -0,0 +1,111 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
$domain = snmpwalk_cache_oid($device, 'vcDomain', NULL, 'HPVC-MIB');
$domain = $domain[0];
// Domain
$array = array(
'entPhysicalName' => $domain['vcDomainName'],
'entPhysicalClass' => 'domain',
'entPhysicalIsFRU' => 'true',
'entPhysicalDescr' => $domain['vcDomainPrimaryAddressType'],
'entPhysicalAssetID' => $domain['vcDomainPrimaryAddress'],
'entPhysicalContainedIn' => 0,
'entPhysicalParentRelPos' => -1,
'entPhysicalMfgName' => 'HPE'
);
discover_inventory($device, '-1', $array, $mib);
$entries = snmpwalk_cache_oid($device, 'vcEnclosureTable', NULL, 'HPVC-MIB');
foreach ($entries as $index => $entry)
{
$array = array(
'entPhysicalName' => $entry['vcEnclosureName'],
'entPhysicalClass' => 'chassis',
'entPhysicalIsFRU' => 'true',
'entPhysicalContainedIn' => 0,
'entPhysicalDescr' => $entry['vcEnclosureAddressType'],
'entPhysicalSerialNum' => $entry['vcEnclosureUUID'],
'entPhysicalParentRelPos' => 1,
'entPhysicalMfgName' => 'HPE'
);
if(isset($entry['vcEnclosureIndex']))
{
discover_inventory($device, $index, $array, $mib);
}
}
unset($entries, $array, $domain);
$entries = snmpwalk_cache_oid($device, 'vcPhysicalServerTable', NULL, 'HPVC-MIB');
// Blades
foreach ($entries as $index => $entry)
{
$array = array(
'entPhysicalName' => 'Slot '.$entry['vcPhysicalServerLocation.'],
'entPhysicalClass' => 'container',
'entPhysicalIsFRU' => 'true',
'entPhysicalContainedIn' => 1,
'entPhysicalParentRelPos' => $entry['vcPhysicalServerLocation.'],
'entPhysicalContainedIn' => $entry['vcPhysicalServerEnclosureIndex'],
'entPhysicalMfgName' => 'HPE'
);
//discover_inventory($device, '999'.$index, $array, $mib);
$array = array(
'entPhysicalName' => $entry['vcPhysicalServerProductName'],
//'entPhysicalDescr' => $entry['vcPhysicalServerProductName'],
'entPhysicalClass' => 'module',
'entPhysicalIsFRU' => 'true',
'entPhysicalModelName' => $entry['vcPhysicalServerPartNumber'],
'entPhysicalSerialNum' => $entry['vcPhysicalServerSerialNumber'],
'entPhysicalContainedIn' => $entry['vcPhysicalServerEnclosureIndex'],
'entPhysicalParentRelPos' => 1,
'entPhysicalMfgName' => 'HPE'
);
if(isset($entry['vcPhysicalServerEnclosureIndex']))
{
discover_inventory($device, $index, $array, $mib);
}
}
$entries = snmpwalk_cache_oid($device, 'vcModuleTable', NULL, 'HPVC-MIB');
// Modules
foreach ($entries as $index => $entry)
{
list($entry['type'], $entry['index']) = explode('.', $entry['vcModuleEnclosurePointer']);
$array = array(
'entPhysicalName' => $entry['vcModuleProductName'],
//'entPhysicalDescr' => $entry['vcPhysicalServerProductName'],
'entPhysicalClass' => 'module',
'entPhysicalIsFRU' => 'true',
'entPhysicalModelName' => $entry['vcModulePartNumber'],
'entPhysicalSerialNum' => $entry['vcModuleSerialNumber'],
'entPhysicalContainedIn' => $entry['index'],
'entPhysicalParentRelPos' => $entry['vcModuleLocation'],
'entPhysicalMfgName' => 'HPE'
);
if(isset($entry['vcModuleLocation']))
{
discover_inventory($device, '999'.$index, $array, $mib);
}
}

View File

@ -0,0 +1,79 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
*
*/
$jnxBoxDescr = snmp_get_oid($device, 'jnxBoxDescr.0', 'JUNIPER-MIB');
if ($jnxBoxDescr) {
$jnxBoxSerialNo = snmp_get_oid($device, 'jnxBoxSerialNo.0', 'JUNIPER-MIB');
// Insert chassis as index 1, everything hangs off of this.
$system_index = 1;
$inventory[$system_index] = array(
'entPhysicalDescr' => $jnxBoxDescr,
'entPhysicalClass' => 'chassis',
'entPhysicalName' => 'Chassis',
'entPhysicalSerialNum' => $jnxBoxSerialNo,
'entPhysicalIsFRU' => 'true',
'entPhysicalContainedIn' => 0,
'entPhysicalParentRelPos' => -1,
'entPhysicalMfgName' => 'Juniper'
);
discover_inventory($device, $system_index, $inventory[$system_index], $mib);
// Now fetch data for the rest of the hardware in the chassis
$data = snmpwalk_cache_oid($device, 'jnxContentsTable', array(), 'JUNIPER-MIB:JUNIPER-CHASSIS-DEFINES-MIB');
$data = snmpwalk_cache_oid($device, 'jnxFruTable', $data, 'JUNIPER-MIB:JUNIPER-CHASSIS-DEFINES-MIB');
$global_relPos = 0;
foreach ($data as $part) {
// Index can only be int in the database, so we create our own from 7.1.1.0:
$system_index = $part['jnxContentsContainerIndex'] * 16777216 + $part['jnxContentsL1Index'] * 65536 + $part['jnxContentsL2Index'] * 256 + $part['jnxContentsL3Index'];
if ($system_index != 0) {
if ($part['jnxContentsL2Index'] == 0 && $part['jnxContentsL3Index'] == 0) {
$containedIn = 1; // Attach to chassis inserted above
$global_relPos++; $relPos = $global_relPos;
} else {
$containerIndex = $part['jnxContentsContainerIndex'];
if ($containerIndex == 8) { $containerIndex--; } // Convert PIC (8) to FPC (7) parent
$containedIn = $containerIndex * 16777216 + $part['jnxContentsL1Index'] * 65536;
$relPos = $part['jnxContentsL2Index'];
}
// [jnxFruTemp] => 45 - Could link to sensor somehow? (like we do for ENTITY-SENSOR-MIB)
$inventory[$system_index] = array(
'entPhysicalDescr' => ucfirst($part['jnxContentsDescr']),
'entPhysicalHardwareRev' => $part['jnxContentsRevision'],
'entPhysicalClass' => isset($part['jnxFruType']) ? $part['jnxFruType'] : 'chassis',
'entPhysicalName' => ucfirst($part['jnxFruName'] ?: $part['jnxContentsDescr']),
'entPhysicalSerialNum' => str_replace([ 'S/N ', 'BUILTIN' ], '', $part['jnxContentsSerialNo']),
'entPhysicalModelName' => str_replace('BUILTIN', '', $part['jnxContentsPartNo']),
'entPhysicalVendorType' => $part['jnxContentsType'], //$part['jnxContentsModel'],
'entPhysicalIsFRU' => isset($part['jnxFruType']) ? 'true' : 'false',
'entPhysicalContainedIn' => $containedIn,
'entPhysicalParentRelPos' => $relPos,
'entPhysicalMfgName' => 'Juniper'
);
discover_inventory($device, $system_index, $inventory[$system_index], $mib);
}
}
}
// EOF

View File

@ -0,0 +1,42 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
$mtxrBoardName = snmp_get_oid($device, 'mtxrBoardName.0', 'MIKROTIK-MIB');
$mtxrSerialNumber = snmp_get_oid($device, 'mtxrSerialNumber.0', 'MIKROTIK-MIB');
$mtxrLicSoftwareId = snmp_get_oid($device, 'mtxrLicSoftwareId.0', 'MIKROTIK-MIB');
$mtxrLicVersion = snmp_get_oid($device, 'mtxrLicVersion.0', 'MIKROTIK-MIB');
$mtxrFirmwareVersion = snmp_get_oid($device, 'mtxrFirmwareVersion.0', 'MIKROTIK-MIB');
$system_index = 1;
if ($mtxrSerialNumber)
{
$inventory[$system_index] = array(
'entPhysicalDescr' => 'MikroTik RouterBoard',
'entPhysicalClass' => 'chassis',
'entPhysicalName' => '',
'entPhysicalModelName' => $mtxrBoardName,
'entPhysicalSerialNum' => $mtxrSerialNumber,
'entPhysicalAssetID' => $mtxrLicSoftwareId,
'entPhysicalIsFRU' => 'false',
'entPhysicalContainedIn' => 0,
'entPhysicalParentRelPos' => 0,
'entPhysicalFirmwareRev' => $mtxrFirmwareVersion,
'entPhysicalSoftwareRev' => $mtxrLicVersion,
'entPhysicalMfgName' => 'MikroTik'
);
discover_inventory($device, $system_index, $inventory[$system_index], "MIKROTIK-MIB");
print_debug_vars($inventory);
}
// EOF

View File

@ -0,0 +1,36 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
$oids = snmpwalk_cache_oid($device, 'oacExpIMSysHwComponentsTable', array(), 'ONEACCESS-SYS-MIB');
foreach ($oids as $index => $entry)
{
//print_r($entry);
$index = (int)$entry['oacExpIMSysHwcIndex'] + 1;
$inventory[$index] = array(
'entPhysicalDescr' => $entry['oacExpIMSysHwcDescription'],
'entPhysicalName' => $entry['oacExpIMSysHwcProductName'],
'entPhysicalClass' => $entry['oacExpIMSysHwcClass'],
'entPhysicalModelName' => $entry['oacExpIMSysHwcType'],
//'entPhysicalAssetID' => $entry['oacExpIMSysHwcManufacturer'],
'entPhysicalSerialNum' => $entry['oacExpIMSysHwcSerialNumber'],
'entPhysicalIsFRU' => 'false',
'entPhysicalMfgName' => 'OneAccess',
'entPhysicalContainedIn' => ($entry['oacExpIMSysHwcIndex'] == 0 ? 0 : 1),
'entPhysicalParentRelPos' => ($entry['oacExpIMSysHwcIndex'] == 0 ? -1 : (int)$entry['oacExpIMSysHwcIndex']),
);
discover_inventory($device, $index, $inventory[$index], $mib);
}
// EOF

View File

@ -0,0 +1,104 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
$ChasProductType = snmp_get_oid($device, 'chassisModelName.1', 'PERLE-MCR-MGT-MIB');
if ($ChasProductType)
{
$ChasDesc = snmp_get_oid($device, 'chassisModelDesc.1', 'PERLE-MCR-MGT-MIB');
$ChasSerNum = snmp_get_oid($device, 'chassisSerialNumber.1', 'PERLE-MCR-MGT-MIB');
$ChasMgmtSlot = snmp_get_oid($device, 'chassisCfgMgmtSlot.1', 'PERLE-MCR-MGT-MIB');
// Insert chassis as index 1, everything hangs off of this.
$system_index = 1;
$inventory[$system_index] = array(
'entPhysicalDescr' => $ChasProductType,
'entPhysicalClass' => 'chassis',
'entPhysicalName' => $ChasDesc,
'entPhysicalSerialNum' => $ChasSerNum,
'entPhysicalIsFRU' => 'true',
'entPhysicalContainedIn' => 0,
'entPhysicalParentRelPos' => -1,
'entPhysicalMfgName' => 'Perle'
);
discover_inventory($device, $system_index, $inventory[$system_index], $mib);
// Now fetch data for the rest of the hardware in the chassis
$data = snmpwalk_cache_oid($device, 'mcrChassisSlotTable', array(), 'PERLE-MCR-MGT-MIB');
$data_sfp = snmpwalk_cache_oid($device, 'mcrSfpDmiModuleTable', array(), 'PERLE-MCR-MGT-MIB');
$relPos = 0;
foreach ($data as $part)
{
$system_index = $part['mcrChassisSlotIndex'] * 256;
$slotindex = $part['mcrChassisSlotIndex'];
if ($system_index != 0)
{
$containedIn = 1; // Attach to chassis inserted above
// snAgentBrdModuleStatus.6 = moduleRunning
// snAgentBrdModuleStatus.7 = moduleEmpty
if ($part['mcrModuleModelName'] != '')
{
$relPos++;
$inventory[$system_index] = array(
'entPhysicalDescr' => $part['mcrUserDefinedModuleName'] . "(".$part['mcrModuleModelDesc'].")",
'entPhysicalClass' => 'module',
'entPhysicalName' => $part['mcrModuleModelName'],
'entPhysicalSerialNum' => $part['mcrModuleSerialNumber'],
'entPhysicalIsFRU' => 'true',
'entPhysicalContainedIn' => $containedIn,
'entPhysicalParentRelPos' => $relPos,
'entPhysicalFirmwareRev' => $part['mcrModuleBootloaderVersion'],
'entPhysicalSoftwareRev' => $part['mcrModuleFirmwareVersion'],
'entPhysicalMfgName' => 'Perle',
);
discover_inventory($device, $system_index, $inventory[$system_index], $mib);
}
foreach ($data_sfp as $part_sfp)
{
if ($part_sfp['sfpDmiSlotIndex'] == $slotindex) {
$system_index_sfp = $part_sfp['sfpDmiSlotIndex'] * 256 + 1;
$relPos++;
if ($part_sfp['sfpDmiLinkReach625125'] != 0) { $range = $part_sfp['sfpDmiLinkReach625125']."m"; }
if ($part_sfp['sfpDmiLinkReach50125'] != 0) { $range = $part_sfp['sfpDmiLinkReach50125']."m"; }
if ($part_sfp['sfpDmiLinkReach9125'] != 0) { $range = ($part_sfp['sfpDmiLinkReach9125']/1000)."km"; }
$inventory[$system_index] = array(
'entPhysicalDescr' => $part_sfp['sfpDmiVendorName'] . " SFP (".$part_sfp['sfpDmiFiberWaveLength']."nm ".$range." ".$part_sfp['sfpDmiNominalBitRate']."Mbps)",
'entPhysicalClass' => 'module',
'entPhysicalName' => $part_sfp['sfpDmiVendorPartNumber'],
'entPhysicalSerialNum' => $part_sfp['sfpDmiVendorSerialNumber'],
'entPhysicalIsFRU' => 'true',
'entPhysicalContainedIn' => $system_index,
'entPhysicalParentRelPos' => $relPos,
'entPhysicalMfgName' => $part_sfp['sfpDmiVendorName'],
);
discover_inventory($device, $system_index_sfp, $inventory[$system_index], $mib);
}
}
}
}
}
// EOF

View File

@ -0,0 +1,40 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
$mib = 'RAISECOM-FANMONITOR-MIB';
$serials = snmp_get_oid($device, 'raisecomFanCardSerialNumber.0', $mib); // STRING: "serial1;serial2"
$system_index = 101;
$i = 1;
foreach (explode(';', $serials) as $fan_card_serial)
{
if ($fan_card_serial != 'NULL') // the serial number is string 'NULL' when the fan card is absent
{
$inventory[$system_index] = array(
'entPhysicalDescr' => '',
'entPhysicalClass' => 'module',
'entPhysicalName' => "Fan Card $i",
'entPhysicalSerialNum' => $fan_card_serial,
'entPhysicalAssetID' => '',
'entPhysicalIsFRU' => 'true',
'entPhysicalContainedIn' => 1, // ENTITY-MIB exposes the chassis with index 1.
'entPhysicalParentRelPos' => -1,
'entPhysicalMfgName' => 'Raisecom'
);
discover_inventory($device, $system_index, $inventory[$system_index], $mib);
}
$system_index++;
$i++;
}
unset($mib, $serials, $system_index, $i, $fan_card_serial);
// EOF

View File

@ -0,0 +1,40 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
$oids = snmpwalk_cache_oid($device, 'raisecomPowerSerialNumber', NULL, $mib);
$oids = snmpwalk_cache_oid($device, 'raisecomPowerType', $oids, $mib);
$system_index = 201;
foreach ($oids as $id => $entry)
{
$psu_type = strtoupper($entry['raisecomPowerType']);
if ($psu_type == 'AC' || $psu_type == 'DC')
{
$inventory[$system_index] = array(
'entPhysicalDescr' => "{$psu_type} Power Supply Unit",
'entPhysicalClass' => 'module',
'entPhysicalName' => "PSU $id",
'entPhysicalSerialNum' => $entry['raisecomPowerSerialNumber'],
'entPhysicalAssetID' => '',
'entPhysicalIsFRU' => 'true',
'entPhysicalContainedIn' => 1, // ENTITY-MIB exposes the chassis with index 1.
'entPhysicalParentRelPos' => -1,
'entPhysicalMfgName' => 'Raisecom'
);
discover_inventory($device, $system_index, $inventory[$system_index], $mib);
}
$system_index++;
}
unset($mib, $system_index, $id, $entry, $psu_type);
// EOF

View File

@ -0,0 +1,45 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
*
*/
echo("SNR-SWITCH-MIB ");
$ports_array = snmpwalk_cache_oid($device, "priPortTable", [], 'SNR-SWITCH-MIB', NULL, OBS_SNMP_ALL_MULTILINE);
print_debug_vars($ports_array);
if (safe_count($ports_array)) {
//$portCount = snmp_get_oid($device, 'portCount.0', 'SNR-SWITCH-MIB');
$ddminfo_array = snmpwalk_cache_oid($device, "ddmTranscBasicInfoTable", [], 'SNR-SWITCH-MIB');
print_debug_vars($ddminfo_array);
foreach ($ports_array as $index => $entry) {
$local_index = 100 + $entry['portIndex'];
$inventory[$local_index] = [
'entPhysicalDescr' => $entry['portType']." ".$ddminfo_array[$entry['portIndex']]['ddmTransSerialWaveLength'],
'entPhysicalClass' => 'port',
'entPhysicalName' => $entry['portName'],
'entPhysicalIsFRU' => 'false',
'entPhysicalModelName' => $ddminfo_array[$entry['portIndex']]['ddmTransSerialModelName'],
'entPhysicalVendorType' => $ddminfo_array[$entry['portIndex']]['ddmTransSerialTypeName'],
'entPhysicalContainedIn' => 1,
'entPhysicalParentRelPos' => $entry['portIndex'],
'entPhysicalSerialNum' => $entry['transceiverSn'],
'ifIndex' => $entry['portIndex'],
'entPhysicalMfgName' => $ddminfo_array[$entry['portIndex']]['ddmTransSerialVendorName'],
];
discover_inventory($device, $local_index, $inventory[$local_index], 'SNR-SWITCH-MIB');
}
}
print_debug_vars($inventory);
// EOF

View File

@ -0,0 +1,37 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
*
*/
$oids = snmp_cache_table($device, 'tmnxHwTable', NULL, 'TIMETRA-CHASSIS-MIB');
foreach ($oids as $index => $entry) {
list($chassis, $system_index) = explode('.', $index);
$inventory[$system_index] = array(
'entPhysicalDescr' => $entry['tmnxHwName'],
'entPhysicalClass' => $entry['tmnxHwClass'],
'entPhysicalName' => $entry['tmnxHwName'],
'entPhysicalAlias' => $entry['tmnxHwAlias'],
'entPhysicalAssetID' => $entry['tmnxHwAssetID'],
'entPhysicalIsFRU' => $entry['tmnxHwIsFRU'],
'entPhysicalSerialNum' => $entry['tmnxHwSerialNumber'],
'entPhysicalContainedIn' => $entry['tmnxHwContainedIn'],
'entPhysicalParentRelPos' => $entry['tmnxHwParentRelPos'],
'entPhysicalMfgName' => $entry['tmnxHwMfgString'] // 'Alcatel-Lucent'
);
if ($entry['tmnxHwContainedIn'] === '0' && $entry['tmnxHwParentRelPos'] === '-1') {
$inventory[$system_index]['entPhysicalName'] .= ' '.$chassis;
}
discover_inventory($device, $system_index, $inventory[$system_index], $mib);
}
// EOF