commit version 22.12.12447
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -62,7 +62,7 @@ if ($ipNetToPhysicalPhysAddress_oid)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!strstr($oid_data, 'ipv4'))
|
||||
if (!str_contains($oid_data, 'ipv4'))
|
||||
{
|
||||
// Check IP-MIB::ipNetToMediaPhysAddress (IPv4 only)
|
||||
//ipNetToMediaPhysAddress[213][10.0.0.162] 70:81:5:ec:f9:bf
|
||||
@ -179,7 +179,7 @@ foreach ($cache_arp as $entry)
|
||||
}
|
||||
if (count($remove_mac_ids))
|
||||
{
|
||||
dbDelete('ip_mac', '1' . generate_query_values($remove_mac_ids, 'mac_id'));
|
||||
dbDelete('ip_mac', generate_query_values_ng($remove_mac_ids, 'mac_id'));
|
||||
}
|
||||
echo(PHP_EOL);
|
||||
|
||||
|
||||
@ -208,7 +208,7 @@ if (safe_count($peerlist)) {
|
||||
echo(PHP_EOL);
|
||||
// Filter IP search by BGP enabled devices (without self)
|
||||
$bgp_device_ids = dbFetchColumn('SELECT `device_id` FROM `devices` WHERE `device_id` != ? AND `bgpLocalAs` > 0 AND `disabled` = 0 AND `status` = 1', [ $device['device_id'] ]);
|
||||
$peer_as_where = generate_query_values($bgp_device_ids, 'device_id');
|
||||
$peer_as_where = generate_query_values_and($bgp_device_ids, 'device_id');
|
||||
|
||||
$peer_devices = [];
|
||||
$peer_devices_ids = [];
|
||||
@ -218,7 +218,7 @@ if (safe_count($peerlist)) {
|
||||
}
|
||||
print_debug_vars($peer_devices);
|
||||
|
||||
$peer_ip_where = generate_query_values($peer_devices_ids, 'device_id') . generate_query_values('up', 'ifOperStatus');
|
||||
$peer_ip_where = generate_query_values_and($peer_devices_ids, 'device_id') . generate_query_values_and('up', 'ifOperStatus');
|
||||
|
||||
foreach ($peerlist as $peer) {
|
||||
|
||||
@ -371,7 +371,7 @@ if (safe_count($peerlist)) {
|
||||
} # AF list
|
||||
if (safe_count($cbgp_delete)) {
|
||||
// Multi-delete
|
||||
dbDelete('bgpPeers_cbgp', generate_query_values($cbgp_delete, 'cbgp_id', NULL, FALSE));
|
||||
dbDelete('bgpPeers_cbgp', generate_query_values_ng($cbgp_delete, 'cbgp_id'));
|
||||
}
|
||||
unset($af_list, $cbgp_delete);
|
||||
} # end peerlist
|
||||
@ -395,8 +395,8 @@ foreach (dbFetchRows($query, [ $device['device_id'] ]) as $entry) {
|
||||
}
|
||||
if (count($peers_delete)) {
|
||||
// Multi-delete
|
||||
dbDelete('bgpPeers', generate_query_values($peers_delete, 'bgpPeer_id', NULL, FALSE));
|
||||
dbDelete('bgpPeers_cbgp', generate_query_values($peers_delete, 'bgpPeer_id', NULL, FALSE));
|
||||
dbDelete('bgpPeers', generate_query_values_ng($peers_delete, 'bgpPeer_id'));
|
||||
dbDelete('bgpPeers_cbgp', generate_query_values_ng($peers_delete, 'bgpPeer_id'));
|
||||
}
|
||||
|
||||
$table_headers = array('%WLocal: AS (VRF)%n', '%WIP%n', '%WPeer: AS%n', '%WIP%n', '%WFamily%n', '%WrDNS%n', '%WRemote Device%n');
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
@ -7,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -28,20 +27,22 @@ $mib = 'Printer-MIB';
|
||||
//Printer-MIB::prtMarkerEastMargin.1.1 = INTEGER: 1968
|
||||
//Printer-MIB::prtMarkerStatus.1.1 = INTEGER: 2
|
||||
|
||||
$oids = snmpwalk_cache_oid($device, "prtMarkerEntry", array(), $mib);
|
||||
$prt_supplies = snmpwalk_cache_oid($device, 'prtMarkerSuppliesDescription', array(), $mib, NULL, OBS_SNMP_ALL_ASCII);
|
||||
$oids = snmpwalk_cache_oid($device, "prtMarkerEntry", [], $mib);
|
||||
$prt_supplies = snmpwalk_cache_oid($device, 'prtMarkerSuppliesDescription', [], $mib, NULL, OBS_SNMP_ALL_ASCII);
|
||||
//print_vars($oids);
|
||||
$count = count($oids);
|
||||
$total_printed_allow = TRUE;
|
||||
//$count = count($oids);
|
||||
//$total_printed_allow = TRUE;
|
||||
$total_printed_allow = !discovery_check_if_type_exist([ 'printersupply->KYOCERA-MIB->kcprtMarkerServiceCount' ], 'counter');
|
||||
|
||||
foreach ($oids as $index => $entry)
|
||||
{
|
||||
$printer_supply = dbFetchRow("SELECT * FROM `printersupplies` WHERE `device_id` = ? AND `supply_mib` = ? AND `supply_index` = ?", array($device['device_id'], 'jetdirect', $index));
|
||||
foreach ($oids as $index => $entry) {
|
||||
$printer_supply = dbFetchRow("SELECT * FROM `printersupplies` WHERE `device_id` = ? AND `supply_mib` = ? AND `supply_index` = ?", [ $device['device_id'], 'jetdirect', $index ]);
|
||||
$marker_descr = "Printed ".nicecase($entry['prtMarkerCounterUnit']);
|
||||
list($hrDeviceIndex, $prtMarkerIndex) = explode('.', $index);
|
||||
$options = array('measured_class' => 'printersupply',
|
||||
'measured_entity' => $printer_supply['supply_id'],
|
||||
'counter_unit' => $entry['prtMarkerCounterUnit']);
|
||||
$options = [
|
||||
'measured_class' => 'printersupply',
|
||||
'measured_entity' => $printer_supply['supply_id'],
|
||||
'counter_unit' => $entry['prtMarkerCounterUnit']
|
||||
];
|
||||
|
||||
// Lifetime counter (should be always single)
|
||||
$descr = "Total $marker_descr";
|
||||
@ -49,16 +50,14 @@ foreach ($oids as $index => $entry)
|
||||
$oid = '.1.3.6.1.2.1.43.10.2.1.4.' . $index;
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
if (isset($entry[$oid_name]) && $total_printed_allow)
|
||||
{
|
||||
if (isset($entry[$oid_name]) && $total_printed_allow) {
|
||||
discover_counter($device, 'printersupply', $mib, $oid_name, $oid, $index, $descr, 1, $value, $options);
|
||||
$total_printed_allow = FALSE; // Discover only first "Total Printed", all other always same
|
||||
}
|
||||
|
||||
// PowerOn counter
|
||||
$descr = "PowerOn $marker_descr";
|
||||
if ($prt_supplies[$index]['prtMarkerSuppliesDescription'])
|
||||
{
|
||||
if ($prt_supplies[$index]['prtMarkerSuppliesDescription']) {
|
||||
$descr .= ' - ' . rewrite_entity_name(snmp_hexstring($prt_supplies[$index]['prtMarkerSuppliesDescription']));
|
||||
}
|
||||
$oid_name = 'prtMarkerPowerOnCount';
|
||||
|
||||
@ -753,7 +753,7 @@ function get_autodiscovery_device_id($device, $hostname, $ip = NULL, $mac = NULL
|
||||
if (!$remote_device_id && $ip_type && !in_array($ip_type, [ 'unspecified', 'loopback' ])) { // 'link-local' ?
|
||||
|
||||
//$remote_device_id = dbFetchCell("SELECT `device_id` FROM `ports` LEFT JOIN `ipv4_addresses` on `ports`.`port_id`=`ipv4_addresses`.`port_id` WHERE `deleted` = '0' AND `ipv4_address` = ? LIMIT 1;", array($entry['mtxrNeighborIpAddress']));
|
||||
$peer_where = generate_query_values($device['device_id'], 'device_id', '!='); // Additional filter for exclude self IPs
|
||||
$peer_where = generate_query_values_and($device['device_id'], 'device_id', '!='); // Additional filter for exclude self IPs
|
||||
// Fetch all devices with peer IP and filter by UP
|
||||
if ($ids = get_entity_ids_ip_by_network('device', $ip, $peer_where)) {
|
||||
$remote_device_id = $ids[0];
|
||||
@ -1385,7 +1385,13 @@ function discover_neighbour($port, $protocol, $neighbour)
|
||||
|
||||
$neighbour['protocol'] = $protocol;
|
||||
$neighbour['active'] = '1';
|
||||
$params = array('protocol', 'remote_port_id', 'remote_hostname', 'remote_port', 'remote_platform', 'remote_version', 'remote_address', 'autodiscovery_id', 'active');
|
||||
|
||||
// Get the remote device id if we've not been told it
|
||||
if(isset($neighbour['remote_port_id']) && !isset($neighbour['remote_device_id'])) {
|
||||
$neighbour['remote_device_id'] = get_device_id_by_port_id($neighbour['remote_port_id']);
|
||||
}
|
||||
|
||||
$params = array('protocol', 'remote_device_id', 'remote_port_id', 'remote_hostname', 'remote_port', 'remote_platform', 'remote_version', 'remote_address', 'autodiscovery_id', 'active');
|
||||
$neighbour_db = dbFetchRow("SELECT `neighbours`.*, UNIX_TIMESTAMP(`last_change`) AS `last_change_unixtime` FROM `neighbours` WHERE `port_id` = ? AND `protocol` = ? AND `remote_hostname` = ? AND `remote_port` = ?", array($port['port_id'], $protocol, $neighbour['remote_hostname'], $neighbour['remote_port']));
|
||||
if (!isset($neighbour_db['neighbour_id']))
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -51,26 +51,35 @@ if (is_device_mib($device, 'ELTEX-MES-PHYSICAL-DESCRIPTION-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);
|
||||
} 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);
|
||||
} elseif (is_device_mib($device, 'HUAWEI-ENTITY-EXTENT-MIB') &&
|
||||
$vendor_oids = snmpwalk_cache_oid($device, "hwEntityOpticalVendorSn", $vendor_oids, 'HUAWEI-ENTITY-EXTENT-MIB', NULL, $snmp_flags)) {
|
||||
$vendor_mib = 'HUAWEI-ENTITY-EXTENT-MIB';
|
||||
$vendor_oids = snmpwalk_cache_oid($device, "hwEntityOpticalType", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
|
||||
$vendor_oids = snmpwalk_cache_oid($device, "hwEntityOpticalVenderName", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
|
||||
$vendor_oids = snmpwalk_cache_oid($device, "hwEntityOpticalVenderPn", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
|
||||
$vendor_oids = snmpwalk_cache_oid($device, "hwEntityOpticalTransType", $vendor_oids, $vendor_mib, NULL, $snmp_flags);
|
||||
//print_vars($entity_array);
|
||||
//print_debug_vars($vendor_oids);
|
||||
}
|
||||
|
||||
foreach ($entity_array as $entPhysicalIndex => $entry) {
|
||||
@ -198,6 +207,27 @@ foreach ($entity_array as $entPhysicalIndex => $entry) {
|
||||
$entry['entPhysicalSerialNum'] = trim($vendor_oids[$entry['entPhysicalParentRelPos']]['swL2PortSfpInfoVendorSN']);
|
||||
$entry['entPhysicalMfgName'] = trim($vendor_oids[$entry['entPhysicalParentRelPos']]['swL2PortSfpInfoVendorName']);
|
||||
$entry['entPhysicalModelName'] = trim($vendor_oids[$entry['entPhysicalParentRelPos']]['swL2PortSfpInfoFiberType']);
|
||||
} elseif ($vendor_mib === 'HUAWEI-ENTITY-EXTENT-MIB' && isset($vendor_oids[$entPhysicalIndex]) &&
|
||||
$vendor_oids[$entPhysicalIndex]['hwEntityOpticalType'] !== 'unknown') {
|
||||
//$entry = array_merge($entry, $vendor_oids[$entry['ifIndex']]);
|
||||
print_debug_vars($vendor_oids[$entPhysicalIndex]);
|
||||
|
||||
// entPhysicalVendorType -> hwEntityOpticalType
|
||||
// entPhysicalHardwareRev -> ??
|
||||
// entPhysicalFirmwareRev -> ??
|
||||
// entPhysicalSoftwareRev -> ??
|
||||
// entPhysicalSerialNum -> hwEntityOpticalVendorSn
|
||||
// entPhysicalMfgName -> hwEntityOpticalVenderName
|
||||
// entPhysicalModelName -> hwEntityOpticalVenderPn
|
||||
// entPhysicalAlias -> hwEntityOpticalTransType
|
||||
// entPhysicalAssetID -> ??
|
||||
$entry['entPhysicalVendorType'] = trim($vendor_oids[$entPhysicalIndex]['hwEntityOpticalType']);
|
||||
//$entry['entPhysicalHardwareRev'] = trim($vendor_oids[$entPhysicalIndex]['']);
|
||||
//$entry['entPhysicalFirmwareRev'] = trim($vendor_oids[$entPhysicalIndex]['']);
|
||||
$entry['entPhysicalSerialNum'] = trim($vendor_oids[$entPhysicalIndex]['hwEntityOpticalVendorSn']);
|
||||
$entry['entPhysicalMfgName'] = trim($vendor_oids[$entPhysicalIndex]['hwEntityOpticalVenderName']);
|
||||
$entry['entPhysicalModelName'] = trim($vendor_oids[$entPhysicalIndex]['hwEntityOpticalVenderPn']);
|
||||
$entry['entPhysicalAlias'] = trim($vendor_oids[$entPhysicalIndex]['hwEntityOpticalTransType']);
|
||||
}
|
||||
|
||||
if ($entry['entPhysicalDescr'] || $entry['entPhysicalName']) {
|
||||
|
||||
@ -33,21 +33,23 @@ if (is_array($hrDevices)) {
|
||||
print_debug_vars($hrDevice, 1);
|
||||
continue;
|
||||
}
|
||||
if (!is_numeric($hrDevice['hrDeviceErrors'])) {
|
||||
$hrDevice['hrDeviceErrors'] = 0;
|
||||
}
|
||||
|
||||
//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']))
|
||||
{
|
||||
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']);
|
||||
$update_array = [
|
||||
'hrDeviceType' => $hrDevice['hrDeviceType'],
|
||||
'hrDeviceDescr' => $hrDevice['hrDeviceDescr'],
|
||||
'hrDeviceStatus' => $hrDevice['hrDeviceStatus'],
|
||||
'hrDeviceErrors' => $hrDevice['hrDeviceErrors']
|
||||
];
|
||||
|
||||
if ($hrDevice['hrDeviceType'] === "hrDeviceProcessor")
|
||||
{
|
||||
if ($hrDevice['hrDeviceType'] === "hrDeviceProcessor") {
|
||||
$update_array['hrProcessorLoad'] = $hrDevice['hrProcessorLoad'];
|
||||
} else {
|
||||
$update_array['hrProcessorLoad'] = array('NULL');
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -96,7 +96,7 @@ if ($amap_array)
|
||||
$remote_port_id = get_port_id_by_mac($remote_device_id, $remote_mac);
|
||||
} else {
|
||||
// Try by IP
|
||||
$peer_where = generate_query_values($remote_device_id, 'device_id'); // Additional filter for include self IPs
|
||||
$peer_where = generate_query_values_and($remote_device_id, 'device_id'); // Additional filter for include self IPs
|
||||
// Fetch all ports with peer IP and filter by UP
|
||||
if ($ids = get_entity_ids_ip_by_network('port', $remote_address, $peer_where))
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -151,6 +151,12 @@ if ($cdp_array) {
|
||||
if (!is_null($if)) {
|
||||
$query = 'SELECT `port_id` FROM `ports` WHERE (`ifName` = ? OR `ifDescr` = ? OR `port_label_short` = ?) AND `device_id` = ? AND `deleted` = ?';
|
||||
$remote_port_id = dbFetchCell($query, array($if, $if, $if, $remote_device_id, 0));
|
||||
|
||||
// Aruba devices can report ifAlias instead ifDescr
|
||||
if (!$remote_port_id && !isHexString($if)) {
|
||||
$query = 'SELECT `port_id` FROM `ports` WHERE `ifAlias` = ? AND `device_id` = ? AND `deleted` = ?';
|
||||
$remote_port_id = dbFetchCell($query, [ $if, $remote_device_id, 0 ]);
|
||||
}
|
||||
}
|
||||
if (!$remote_port_id) {
|
||||
if (!is_null($remote_mac)) {
|
||||
@ -164,7 +170,7 @@ if ($cdp_array) {
|
||||
|
||||
if (!$remote_port_id) {
|
||||
// Try by IP
|
||||
$peer_where = generate_query_values($remote_device_id, 'device_id'); // Additional filter for include self IPs
|
||||
$peer_where = generate_query_values_and($remote_device_id, 'device_id'); // Additional filter for include self IPs
|
||||
// Fetch all ports with peer IP and filter by UP
|
||||
if ($ids = get_entity_ids_ip_by_network('port', $remote_address, $peer_where))
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -45,7 +45,7 @@ if ($fdp_array)
|
||||
if (!$remote_port_id)
|
||||
{
|
||||
// Try by IP
|
||||
$peer_where = generate_query_values($remote_device_id, 'device_id'); // Additional filter for include self IPs
|
||||
$peer_where = generate_query_values_and($remote_device_id, 'device_id'); // Additional filter for include self IPs
|
||||
// Fetch all ports with peer IP and filter by UP
|
||||
if ($ids = get_entity_ids_ip_by_network('port', $remote_address, $peer_where))
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -66,7 +66,7 @@ if ($isdp_array) {
|
||||
if (!$remote_port_id)
|
||||
{
|
||||
// Try by IP
|
||||
$peer_where = generate_query_values($remote_device_id, 'device_id'); // Additional filter for include self IPs
|
||||
$peer_where = generate_query_values_and($remote_device_id, 'device_id'); // Additional filter for include self IPs
|
||||
// Fetch all ports with peer IP and filter by UP
|
||||
if ($ids = get_entity_ids_ip_by_network('port', $remote_address, $peer_where))
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -206,7 +206,7 @@ if ($lldp_array) {
|
||||
}
|
||||
unset($id, $ip);
|
||||
*/
|
||||
$peer_where = generate_query_values($device['device_id'], 'device_id'); // Additional filter for include self IPs
|
||||
$peer_where = generate_query_values_and($device['device_id'], 'device_id'); // Additional filter for include self IPs
|
||||
// Fetch all devices with peer IP and filter by UP
|
||||
if ($ids = get_entity_ids_ip_by_network('port', $ip, $peer_where)) {
|
||||
$port = get_port_by_id_cache($ids[0]);
|
||||
@ -344,8 +344,7 @@ if ($lldp_array) {
|
||||
// Try lldpRemPortId
|
||||
$query = 'SELECT `port_id` FROM `ports` WHERE (`ifName` = ? OR `ifDescr` = ? OR `port_label_short` = ?) AND `device_id` = ? AND `deleted` = ?';
|
||||
$remote_port_id = dbFetchCell($query, array($id, $id, $id, $remote_device_id, 0));
|
||||
if (!$remote_port_id && strlen($if))
|
||||
{
|
||||
if (!$remote_port_id && !safe_empty($if)) {
|
||||
// Try same by lldpRemPortDesc
|
||||
$remote_port_id = dbFetchCell($query, array($if, $if, $if, $remote_device_id, 0));
|
||||
}
|
||||
@ -353,6 +352,11 @@ if ($lldp_array) {
|
||||
|
||||
case 'macAddress':
|
||||
$remote_port_id = get_port_id_by_mac($remote_device_id, $id);
|
||||
if (!$remote_port_id && !safe_empty($if)) {
|
||||
// Try same by lldpRemPortDesc
|
||||
$query = 'SELECT `port_id` FROM `ports` WHERE (`ifName` = ? OR `ifDescr` = ? OR `port_label_short` = ?) AND `device_id` = ? AND `deleted` = ?';
|
||||
$remote_port_id = dbFetchCell($query, [ $if, $if, $if, $remote_device_id, 0 ]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'networkAddress':
|
||||
@ -360,7 +364,7 @@ if ($lldp_array) {
|
||||
if ($ip_version)
|
||||
{
|
||||
// Try by IP
|
||||
$peer_where = generate_query_values($remote_device_id, 'device_id'); // Additional filter for include self IPs
|
||||
$peer_where = generate_query_values_and($remote_device_id, 'device_id'); // Additional filter for include self IPs
|
||||
// Fetch all devices with peer IP and filter by UP
|
||||
if ($ids = get_entity_ids_ip_by_network('port', $id, $peer_where))
|
||||
{
|
||||
|
||||
@ -6,12 +6,11 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
if (!$config['autodiscovery']['ospf'])
|
||||
{
|
||||
if (!$config['autodiscovery']['ospf']) {
|
||||
print_debug("Autodiscovery for OSPF disabled.");
|
||||
return;
|
||||
}
|
||||
@ -45,23 +44,20 @@ if (!$config['autodiscovery']['ospf'])
|
||||
// OSPF-MIB::ospfNbmaNbrStatus[103.52.56.4][0] = INTEGER: active(1)
|
||||
|
||||
$ospf_array = snmpwalk_cache_twopart_oid($device, 'ospfNbmaNbrStatus', [], 'OSPF-MIB', NULL, OBS_SNMP_ALL_TABLE);
|
||||
if (snmp_status())
|
||||
{
|
||||
if (snmp_status()) {
|
||||
$ospf_array = snmpwalk_cache_twopart_oid($device, 'ospfNbrRtrId', $ospf_array, 'OSPF-MIB', NULL, OBS_SNMP_ALL_TABLE);
|
||||
print_debug_vars($ospf_array);
|
||||
|
||||
foreach ($ospf_array as $ip => $entry)
|
||||
{
|
||||
foreach ($ospf_array as $ip => $entry) {
|
||||
if ($ip === '0.0.0.0') { continue; }
|
||||
foreach ($entry as $if => $ospf)
|
||||
{
|
||||
|
||||
foreach ($entry as $if => $ospf) {
|
||||
if ($ospf['ospfNbmaNbrStatus'] !== 'active' || $ospf['ospfNbrRtrId'] === '0.0.0.0') { continue; }
|
||||
|
||||
// Try find remote device and check if already cached
|
||||
$remote_device_id = get_autodiscovery_device_id($device, $ospf['ospfNbrRtrId']);
|
||||
if (is_null($remote_device_id) && // NULL - never cached in other rounds
|
||||
check_autodiscovery($ospf['ospfNbrRtrId'])) // Check all previous autodiscovery rounds
|
||||
{
|
||||
if (is_null($remote_device_id) && // NULL - never cached in other rounds
|
||||
check_autodiscovery($ospf['ospfNbrRtrId'])) { // Check all previous autodiscovery rounds
|
||||
// Neighbour never checked, try autodiscovery
|
||||
$remote_device_id = autodiscovery_device($ospf['ospfNbrRtrId'], NULL, 'OSPF', NULL, $device);
|
||||
}
|
||||
|
||||
59
includes/discovery/neighbours/ospfv3-mib.inc.php
Normal file
59
includes/discovery/neighbours/ospfv3-mib.inc.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
if (!$config['autodiscovery']['ospf']) {
|
||||
print_debug("Autodiscovery for OSPF disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
// OSPFV3-MIB::ospfv3NbrAddressType.4.0.3110374402 = INTEGER: ipv6(2)
|
||||
// OSPFV3-MIB::ospfv3NbrAddressType.4.0.3110374403 = INTEGER: ipv6(2)
|
||||
// OSPFV3-MIB::ospfv3NbrAddress.4.0.3110374402 = Hex-STRING: FE 80 00 00 00 00 00 00 02 25 90 FF FE E5 63 D0
|
||||
// OSPFV3-MIB::ospfv3NbrAddress.4.0.3110374403 = Hex-STRING: FE 80 00 00 00 00 00 00 02 25 90 FF FE E3 DF 1A
|
||||
// OSPFV3-MIB::ospfv3NbrOptions.4.0.3110374402 = INTEGER: 19
|
||||
// OSPFV3-MIB::ospfv3NbrOptions.4.0.3110374403 = INTEGER: 19
|
||||
// OSPFV3-MIB::ospfv3NbrPriority.4.0.3110374402 = INTEGER: 10
|
||||
// OSPFV3-MIB::ospfv3NbrPriority.4.0.3110374403 = INTEGER: 10
|
||||
// OSPFV3-MIB::ospfv3NbrState.4.0.3110374402 = INTEGER: full(8)
|
||||
// OSPFV3-MIB::ospfv3NbrState.4.0.3110374403 = INTEGER: full(8)
|
||||
// OSPFV3-MIB::ospfv3NbrEvents.4.0.3110374402 = Counter32: 6
|
||||
// OSPFV3-MIB::ospfv3NbrEvents.4.0.3110374403 = Counter32: 6
|
||||
// OSPFV3-MIB::ospfv3NbrLsRetransQLen.4.0.3110374402 = Gauge32: 0
|
||||
// OSPFV3-MIB::ospfv3NbrLsRetransQLen.4.0.3110374403 = Gauge32: 0
|
||||
// OSPFV3-MIB::ospfv3NbrHelloSuppressed.4.0.3110374402 = INTEGER: false(2)
|
||||
// OSPFV3-MIB::ospfv3NbrHelloSuppressed.4.0.3110374403 = INTEGER: false(2)
|
||||
// OSPFV3-MIB::ospfv3NbrIfId.4.0.3110374402 = INTEGER: 4
|
||||
// OSPFV3-MIB::ospfv3NbrIfId.4.0.3110374403 = INTEGER: 3
|
||||
|
||||
$ospf_array = snmpwalk_cache_oid($device, 'ospfv3NbrAddress', [], 'OSPFV3-MIB', NULL, OBS_SNMP_ALL_HEX);
|
||||
if (snmp_status()) {
|
||||
$ospf_array = snmpwalk_cache_oid($device, 'ospfv3NbrIfId', $ospf_array, 'OSPFV3-MIB');
|
||||
print_debug_vars($ospf_array);
|
||||
|
||||
foreach ($ospf_array as $index => $entry) {
|
||||
$ip = hex2ip($entry['ospfv3NbrAddress']);
|
||||
$ip_compressed = ip_compress($ip);
|
||||
if ($ip_compressed === '::') { continue; }
|
||||
|
||||
// Try find remote device and check if already cached
|
||||
$remote_device_id = get_autodiscovery_device_id($device, $ip);
|
||||
if (is_null($remote_device_id) && // NULL - never cached in other rounds
|
||||
check_autodiscovery($ip)) { // Check all previous autodiscovery rounds
|
||||
|
||||
// Neighbour never checked, try autodiscovery
|
||||
$port = get_port_by_index_cache($device, $entry['ospfv3NbrIfId']);
|
||||
$remote_device_id = autodiscovery_device($ip, NULL, 'OSPF', NULL, $device, $port);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// EOF
|
||||
@ -33,7 +33,7 @@ $oids_db = dbFetchRows("SELECT * FROM `oids` WHERE `oid_autodiscover` = '1'");
|
||||
|
||||
foreach($oids_db as $oid)
|
||||
{
|
||||
$value = snmp_get($device, $oid['oid'], "-OUQnv");
|
||||
$value = snmp_get($device, $oid['oid'], "-OUQtnv");
|
||||
if (is_numeric($value) && $value != '4294967295' && $value != '2147483647' && $value != '-2147483647') // Don't discover stuff which is returning min/max 32 bit values
|
||||
{
|
||||
if(!isset($entries[$oid['oid_id']]))
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
@ -7,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -16,10 +15,9 @@
|
||||
|
||||
if ($os) { return; }
|
||||
|
||||
if (str_contains_array($sysDescr, 'FreeBSD') ||
|
||||
str_starts($sysObjectID, array('.1.3.6.1.4.1.8072.3.2.8', // NET-SNMP
|
||||
'.1.3.6.1.4.1.12325.1.1.2.1'))) // BSNMP daemon
|
||||
{
|
||||
if (str_contains($sysDescr, 'FreeBSD') ||
|
||||
str_starts($sysObjectID, [ '.1.3.6.1.4.1.8072.3.2.8', // NET-SNMP
|
||||
'.1.3.6.1.4.1.12325.1.1.2.1' ])) { // BSNMP daemon
|
||||
$os = 'freebsd';
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -14,31 +14,45 @@
|
||||
// FIXME. Need rename db schema port_id_high -> port_ifIndex_high, port_id_low -> port_ifIndex_low
|
||||
|
||||
$query = 'SELECT * FROM `ports_stack` WHERE `device_id` = ?';
|
||||
$stack_db_array = [];
|
||||
foreach (dbFetchRows($query, array($device['device_id'])) as $entry) {
|
||||
$stack_db_array[$entry['port_id_high']][$entry['port_id_low']] = $entry;
|
||||
}
|
||||
|
||||
$ifmib_stack = FALSE;
|
||||
$insert_array = [];
|
||||
if (is_device_mib($device, 'IF-MIB')) {
|
||||
$stack_poll_array = snmpwalk_cache_twopart_oid($device, 'ifStackStatus', array(), 'IF-MIB');
|
||||
$stack_poll_array = snmpwalk_cache_twopart_oid($device, 'ifStackStatus', [], 'IF-MIB');
|
||||
|
||||
foreach ($stack_poll_array as $port_ifIndex_high => $entry_high) {
|
||||
if (is_numeric($port_ifIndex_high)) {
|
||||
$port_high = get_port_by_index_cache($device, $port_ifIndex_high);
|
||||
if ($device['os'] === 'ciscosb' && $port_high['ifType'] === 'propVirtual') {
|
||||
// Skip stacking on Vlan ports (Cisco SB)
|
||||
continue;
|
||||
if ($device['os'] === 'ciscosb') {
|
||||
$port_high = get_port_by_index_cache($device, $port_ifIndex_high); // Limit port queries to specific os(es)
|
||||
if ($port_high['ifType'] === 'propVirtual') {
|
||||
// Skip stacking on Vlan ports (Cisco SB)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($entry_high as $port_ifIndex_low => $entry_low) {
|
||||
if (is_numeric($port_ifIndex_low)) {
|
||||
$port_low = get_port_by_index_cache($device, $port_ifIndex_low);
|
||||
if ($device['os'] === 'ciscosb' && $port_low['ifType'] === 'propVirtual') {
|
||||
// Skip stacking on Vlan ports (Cisco SB)
|
||||
if ($device['os'] === 'ciscosb') {
|
||||
$port_low = get_port_by_index_cache($device, $port_ifIndex_low); // Limit port queries to specific os(es)
|
||||
if ($port_low['ifType'] === 'propVirtual') {
|
||||
// Skip stacking on Vlan ports (Cisco SB)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$ifStackStatus = $entry_low['ifStackStatus'];
|
||||
//if ($ifStackStatus === 'notInService') { continue; } // FIXME. Skip inactive entries
|
||||
if ($ifStackStatus === 'notInService' && ($port_ifIndex_low == 0 || $port_ifIndex_high == 0)) {
|
||||
print_debug("Skipped inactive stack entry: high [$port_ifIndex_high] & low [$port_ifIndex_low], ifStackStatus [$ifStackStatus].");
|
||||
continue;
|
||||
}
|
||||
$ifStackStatus = $entry_low['ifStackStatus'];
|
||||
//if ($ifStackStatus !== 'active') { continue; } // Skip inactive entries
|
||||
|
||||
// Set stacks found by IF-MIB
|
||||
$ifmib_stack = TRUE;
|
||||
|
||||
// Store valid for others
|
||||
$valid[$module][$port_ifIndex_high][$port_ifIndex_low] = $ifStackStatus;
|
||||
@ -48,8 +62,8 @@ if (is_device_mib($device, 'IF-MIB')) {
|
||||
//echo('.');
|
||||
$GLOBALS['module_stats'][$module]['unchanged']++;
|
||||
} else {
|
||||
$update_array = array( 'ifStackStatus' => $ifStackStatus );
|
||||
dbUpdate($update_array, 'ports_stack', '`port_stack_id` = ?', array( $entry_low['port_stack_id'] ));
|
||||
$update_array = [ 'ifStackStatus' => $ifStackStatus ];
|
||||
dbUpdate($update_array, 'ports_stack', '`port_stack_id` = ?', [ $entry_low['port_stack_id'] ]);
|
||||
//echo('U');
|
||||
$GLOBALS['module_stats'][$module]['updated']++;
|
||||
}
|
||||
@ -60,10 +74,12 @@ if (is_device_mib($device, 'IF-MIB')) {
|
||||
// 'port_id_low' => $port_ifIndex_low,
|
||||
// 'ifStackStatus' => $ifStackStatus);
|
||||
//dbInsert($update_array, 'ports_stack');
|
||||
$insert_array[] = [ 'device_id' => $device['device_id'],
|
||||
'port_id_high' => $port_ifIndex_high,
|
||||
'port_id_low' => $port_ifIndex_low,
|
||||
'ifStackStatus' => $ifStackStatus ];
|
||||
$insert_array[] = [
|
||||
'device_id' => $device['device_id'],
|
||||
'port_id_high' => $port_ifIndex_high,
|
||||
'port_id_low' => $port_ifIndex_low,
|
||||
'ifStackStatus' => $ifStackStatus
|
||||
];
|
||||
$GLOBALS['module_stats'][$module]['added']++;
|
||||
//echo('+');
|
||||
}
|
||||
@ -73,6 +89,70 @@ if (is_device_mib($device, 'IF-MIB')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!$ifmib_stack && is_device_mib($device, 'IEEE8023-LAG-MIB') &&
|
||||
$stack_list_ports = snmpwalk_cache_oid($device, 'dot3adAggPortListPorts', [], 'IEEE8023-LAG-MIB')) {
|
||||
// ifDescr.51 = 1/1/51
|
||||
// ifDescr.52 = 1/1/52
|
||||
// ifDescr.769 = lag1
|
||||
// IEEE8023-LAG-MIB::dot3adAggPortListPorts.769 = STRING: "1/1/51,1/1/52"
|
||||
// IEEE8023-LAG-MIB::dot3adAggPortSelectedAggID.51 = INTEGER: 769
|
||||
// IEEE8023-LAG-MIB::dot3adAggPortSelectedAggID.52 = INTEGER: 769
|
||||
// IEEE8023-LAG-MIB::dot3adAggPortAttachedAggID.51 = INTEGER: 769
|
||||
// IEEE8023-LAG-MIB::dot3adAggPortAttachedAggID.52 = INTEGER: 769
|
||||
$stack_agg_ports = snmpwalk_cache_oid($device, 'dot3adAggPortSelectedAggID', [], 'IEEE8023-LAG-MIB');
|
||||
$stack_agg_ports = snmpwalk_cache_oid($device, 'dot3adAggPortAttachedAggID', $stack_agg_ports, 'IEEE8023-LAG-MIB');
|
||||
$stack_agg_ports = snmpwalk_cache_oid($device, 'dot3adAggPortAggregateOrIndividual', $stack_agg_ports, 'IEEE8023-LAG-MIB');
|
||||
|
||||
// IEEE8023-LAG-MIB::dot3adAggPortActorAdminState.1000009 = BITS: E0 lacpActivity(0) lacpTimeout(1) aggregation(2)
|
||||
// IEEE8023-LAG-MIB::dot3adAggPortActorAdminState.1000010 = BITS: E0 lacpActivity(0) lacpTimeout(1) aggregation(2)
|
||||
$stack_agg_ports = snmpwalk_cache_oid($device, 'dot3adAggPortActorAdminState', $stack_agg_ports, 'IEEE8023-LAG-MIB', NULL, OBS_SNMP_ALL_HEX);
|
||||
print_debug_vars($stack_agg_ports);
|
||||
|
||||
foreach ($stack_agg_ports as $port_ifIndex_low => $entry_low) {
|
||||
$entry_low['admin_bits'] = get_bits_state_array($entry_low['dot3adAggPortActorAdminState'], 'IEEE8023-LAG-MIB', 'LacpState');
|
||||
print_debug_vars($entry_low);
|
||||
|
||||
$port_ifIndex_high = $entry_low['dot3adAggPortAttachedAggID'];
|
||||
$ifStackStatus = 'active'; // always active
|
||||
|
||||
if ($entry_low['dot3adAggPortAggregateOrIndividual'] === 'false' || !in_array('aggregation', (array)$entry_low['admin_bits'], TRUE)) {
|
||||
// Skip not aggregate ports
|
||||
print_debug("Skipped inactive stack entry: high [$port_ifIndex_high] & low [$port_ifIndex_low], dot3adAggPortAggregateOrIndividual [{$entry_low['dot3adAggPortAggregateOrIndividual']}].");
|
||||
continue;
|
||||
}
|
||||
|
||||
// Store valid for others
|
||||
$valid[$module][$port_ifIndex_high][$port_ifIndex_low] = $ifStackStatus;
|
||||
|
||||
if (isset($stack_db_array[$port_ifIndex_high][$port_ifIndex_low])) {
|
||||
if ($stack_db_array[$port_ifIndex_high][$port_ifIndex_low]['ifStackStatus'] == $ifStackStatus) {
|
||||
//echo('.');
|
||||
$GLOBALS['module_stats'][$module]['unchanged']++;
|
||||
} else {
|
||||
$update_array = [ 'ifStackStatus' => $ifStackStatus ];
|
||||
dbUpdate($update_array, 'ports_stack', '`port_stack_id` = ?', [ $entry_low['port_stack_id'] ]);
|
||||
//echo('U');
|
||||
$GLOBALS['module_stats'][$module]['updated']++;
|
||||
}
|
||||
unset($stack_db_array[$port_ifIndex_high][$port_ifIndex_low]);
|
||||
} else {
|
||||
// $update_array = array('device_id' => $device['device_id'],
|
||||
// 'port_id_high' => $port_ifIndex_high,
|
||||
// 'port_id_low' => $port_ifIndex_low,
|
||||
// 'ifStackStatus' => $ifStackStatus);
|
||||
//dbInsert($update_array, 'ports_stack');
|
||||
$insert_array[] = [
|
||||
'device_id' => $device['device_id'],
|
||||
'port_id_high' => $port_ifIndex_high,
|
||||
'port_id_low' => $port_ifIndex_low,
|
||||
'ifStackStatus' => $ifStackStatus
|
||||
];
|
||||
$GLOBALS['module_stats'][$module]['added']++;
|
||||
//echo('+');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (OBS_DEBUG && is_device_mib($device, 'HUAWEI-IF-EXT-MIB')) {
|
||||
$tmp = snmpwalk_cache_twopart_oid($device, 'hwTrunkMemEntry', [], 'HUAWEI-IF-EXT-MIB');
|
||||
@ -130,10 +210,12 @@ if (is_device_mib($device, 'HUAWEI-IF-EXT-MIB')) {
|
||||
}
|
||||
unset($stack_db_array[$port_ifIndex_high][$port_ifIndex_low]);
|
||||
} else {
|
||||
$insert_array[] = [ 'device_id' => $device['device_id'],
|
||||
'port_id_high' => $port_ifIndex_high,
|
||||
'port_id_low' => $port_ifIndex_low,
|
||||
'ifStackStatus' => $ifStackStatus ];
|
||||
$insert_array[] = [
|
||||
'device_id' => $device['device_id'],
|
||||
'port_id_high' => $port_ifIndex_high,
|
||||
'port_id_low' => $port_ifIndex_low,
|
||||
'ifStackStatus' => $ifStackStatus
|
||||
];
|
||||
$GLOBALS['module_stats'][$module]['added']++;
|
||||
}
|
||||
}
|
||||
@ -159,7 +241,7 @@ foreach ($stack_db_array as $port_ifIndex_high => $array) {
|
||||
// MultiDelete old entries
|
||||
if (count($delete_array)) {
|
||||
print_debug_vars($delete_array);
|
||||
dbDelete('ports_stack', generate_query_values($delete_array, 'port_stack_id', NULL, FALSE));
|
||||
dbDelete('ports_stack', generate_query_values_ng($delete_array, 'port_stack_id'));
|
||||
}
|
||||
|
||||
unset($insert_array, $update_array, $delete_array);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -209,7 +209,7 @@ foreach ($ports_ids as $port_id => $port)
|
||||
// Complete remove duplicates
|
||||
if (count($ports_duplicates_ids))
|
||||
{
|
||||
dbDelete('ports', generate_query_values($ports_duplicates_ids, 'port_id', NULL, FALSE));
|
||||
dbDelete('ports', generate_query_values_ng($ports_duplicates_ids, 'port_id'));
|
||||
}
|
||||
// End interfaces clean
|
||||
echo(PHP_EOL);
|
||||
|
||||
129
includes/discovery/ports/coriant-groove-mib.inc.php
Normal file
129
includes/discovery/ports/coriant-groove-mib.inc.php
Normal file
@ -0,0 +1,129 @@
|
||||
<?php
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
.1.3.6.1.4.1.42229.1.2.4.1.9 - eth100gTable for a single port (1/1/6)
|
||||
|
||||
|
||||
CORIANT-GROOVE-MIB::eth100gEthFecType.1.1.0.6.0 = INTEGER: auto(3)
|
||||
CORIANT-GROOVE-MIB::eth100gEthFecTypeState.1.1.0.6.0 = INTEGER: disabled(2)
|
||||
CORIANT-GROOVE-MIB::eth100gTransmitInterpacketgap.1.1.0.6.0 = Gauge32: 8
|
||||
CORIANT-GROOVE-MIB::eth100gGfpPayloadFcs.1.1.0.6.0 = INTEGER: disabled(2)
|
||||
CORIANT-GROOVE-MIB::eth100gMappingMode.1.1.0.6.0 = INTEGER: gmp(1)
|
||||
CORIANT-GROOVE-MIB::eth100gAdminStatus.1.1.0.6.0 = INTEGER: up(1)
|
||||
CORIANT-GROOVE-MIB::eth100gOperStatus.1.1.0.6.0 = INTEGER: down(2)
|
||||
CORIANT-GROOVE-MIB::eth100gAvailStatus.1.1.0.6.0 = BITS: 10 00 00 00 lowerLayerDown(3)
|
||||
CORIANT-GROOVE-MIB::eth100gAliasName.1.1.0.6.0 = STRING: "100gbe-1/1/6"
|
||||
CORIANT-GROOVE-MIB::eth100gClientShutdown.1.1.0.6.0 = INTEGER: no(2)
|
||||
CORIANT-GROOVE-MIB::eth100gClientShutdownHoldoffTimer.1.1.0.6.0 = Gauge32: 0
|
||||
CORIANT-GROOVE-MIB::eth100gNearEndAls.1.1.0.6.0 = INTEGER: no(2)
|
||||
CORIANT-GROOVE-MIB::eth100gAlsDegradeMode.1.1.0.6.0 = INTEGER: disabled(2)
|
||||
CORIANT-GROOVE-MIB::eth100gLoopbackEnable.1.1.0.6.0 = INTEGER: disabled(2)
|
||||
CORIANT-GROOVE-MIB::eth100gLoopbackType.1.1.0.6.0 = INTEGER: none(0)
|
||||
CORIANT-GROOVE-MIB::eth100gTestSignalType.1.1.0.6.0 = INTEGER: none(0)
|
||||
CORIANT-GROOVE-MIB::eth100gTestSignalEnable.1.1.0.6.0 = INTEGER: none(0)
|
||||
CORIANT-GROOVE-MIB::eth100gServiceLabel.1.1.0.6.0 = ""
|
||||
CORIANT-GROOVE-MIB::eth100gLldpStatusIf.1.1.0.6.0 = INTEGER: disabled(4)
|
||||
CORIANT-GROOVE-MIB::eth100gHoldoffSignal.1.1.0.6.0 = INTEGER: no(2)
|
||||
CORIANT-GROOVE-MIB::eth100gManagedBy.1.1.0.6.0 = INTEGER: system(1)
|
||||
|
||||
|
||||
.1.3.6.1.4.1.42229.1.2.4.1.9 - eth100gStatisticsTable for a single port (1/1/6)
|
||||
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryLastClear.1.1.0.6.0 = STRING: "0000-01-01T00:00:00.000Z"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryLossOfSignalSeconds.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryBitErrorFec.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryUncorrectedBlockErrorFec.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryInSymbolErrors.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryInDropEvents.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryInOctets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryInPackets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryInBroadcastPackets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryInMulticastPackets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryInCrcAlignErrors.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryInUndersizePackets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryInOversizePackets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryInFragments.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryInJabbers.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryInPackets64octets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryInPackets65to127octets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryInPackets128to255octets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryInPackets256to511octets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryInPackets512to1023octets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryInPackets1024to1518octets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryOutSymbolErrors.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryOutDropEvents.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryOutOctets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryOutPackets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryOutBroadcastPackets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryOutMulticastPackets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryOutCrcAlignErrors.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryOutUndersizePackets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryOutOversizePackets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryOutFragments.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryOutJabbers.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryOutPackets64octets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryOutPackets65to127octets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryOutPackets128to255octets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryOutPackets256to511octets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryOutPackets512to1023octets.1.1.0.6.0 = STRING: "0"
|
||||
CORIANT-GROOVE-MIB::eth100gStatisticsEntryOutPackets1024to1518octets.1.1.0.6.0 = STRING: "0"
|
||||
|
||||
*/
|
||||
|
||||
$mib = 'CORIANT-GROOVE-MIB';
|
||||
|
||||
// this is eth100g only, note that fc8gTable, fc16gTable, eth10gTable, eth40gTable, eth400gtable all exist too!
|
||||
|
||||
//eth100gTable
|
||||
$entries = [];
|
||||
$entries = snmpwalk_cache_oid($device, 'eth100gTable', $entries, $mib);
|
||||
|
||||
print_debug_vars($entries);
|
||||
|
||||
foreach ($entries as $port_oid_suffix => $port) {
|
||||
$ifIndex = $port_oid_suffix;
|
||||
|
||||
// basics
|
||||
$port_stats[$ifIndex]['ifDescr'] = $port['eth100gAliasName'];
|
||||
$port_stats[$ifIndex]['ifName'] = $port['eth100gAliasName'];
|
||||
$port_stats[$ifIndex]['ifAlias'] = $port['eth100gServiceLabel'];
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = $port['eth100gOperStatus'];
|
||||
$port_stats[$ifIndex]['ifAdminStatus'] = $port['eth100gAdminStatus'];
|
||||
$port_stats[$ifIndex]['ifType'] = 'ethernetCsmacd'; // can we do better than hard coding?
|
||||
|
||||
}
|
||||
|
||||
// eth400gtable
|
||||
$entries = [];
|
||||
$entries = snmpwalk_cache_oid($device, 'eth400gTable', $entries, $mib);
|
||||
|
||||
print_debug_vars($entries);
|
||||
|
||||
foreach ($entries as $port_oid_suffix => $port) {
|
||||
$ifIndex = $port_oid_suffix;
|
||||
|
||||
// basics
|
||||
$port_stats[$ifIndex]['ifDescr'] = $port['eth400gAliasName'];
|
||||
$port_stats[$ifIndex]['ifName'] = $port['eth400gAliasName'];
|
||||
$port_stats[$ifIndex]['ifAlias'] = $port['eth400gServiceLabel'];
|
||||
$port_stats[$ifIndex]['ifOperStatus'] = $port['eth400gOperStatus'];
|
||||
$port_stats[$ifIndex]['ifAdminStatus'] = $port['eth400gAdminStatus'];
|
||||
$port_stats[$ifIndex]['ifType'] = 'ethernetCsmacd'; // can we do better than hard coding?
|
||||
|
||||
}
|
||||
|
||||
|
||||
print_debug_vars($port_stats);
|
||||
|
||||
|
||||
// EOF
|
||||
@ -12,8 +12,9 @@
|
||||
|
||||
$prt_supplies = snmpwalk_cache_oid($device, 'prtMarkerSuppliesTable', array(), 'Printer-MIB', NULL, OBS_SNMP_ALL_UTF8);
|
||||
$prt_colorant = snmpwalk_cache_twopart_oid($device, 'prtMarkerColorantTable', array(), 'Printer-MIB', NULL, OBS_SNMP_ALL_UTF8);
|
||||
//print_vars($prt_supplies);
|
||||
//print_vars($prt_colorant);
|
||||
|
||||
print_debug_vars($prt_supplies);
|
||||
print_debug_vars($prt_colorant);
|
||||
|
||||
// Count toner/ink, if Toner not has colorant table or name non informative (ie: TK-340) set to black for single toner
|
||||
$toner_count = 0;
|
||||
|
||||
@ -6,22 +6,22 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
$hrDevice_oids = array('hrDevice', 'hrProcessorLoad');
|
||||
$hrDevice_array = [];
|
||||
foreach ($hrDevice_oids as $oid) {
|
||||
$hrDevice_array = snmpwalk_cache_oid($device, $oid, $hrDevice_array, 'HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES');
|
||||
}
|
||||
$hr_array = snmpwalk_cache_oid($device, 'hrProcessorLoad', [], 'HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES');
|
||||
$hr_count = safe_count($hr_array);
|
||||
|
||||
$hr_cpus = 0;
|
||||
$hr_total = 0;
|
||||
if ($hr_count) {
|
||||
$hr_array = snmpwalk_cache_oid($device, 'hrDevice', $hr_array, 'HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES');
|
||||
|
||||
if (safe_count($hrDevice_array)) {
|
||||
foreach ($hrDevice_array as $index => $entry) {
|
||||
$hr_cpus = 0;
|
||||
$hr_total = 0;
|
||||
|
||||
foreach ($hr_array as $index => $entry) {
|
||||
if (!is_numeric($entry['hrProcessorLoad'])) { continue; }
|
||||
if ($device['os'] === 'arista_eos' && $index == 1) { continue; }
|
||||
|
||||
if (!isset($entry['hrDeviceType'])) {
|
||||
$entry['hrDeviceType'] = 'hrDeviceProcessor';
|
||||
@ -38,40 +38,44 @@ if (safe_count($hrDevice_array)) {
|
||||
$usage_oid = ".1.3.6.1.2.1.25.3.3.1.2.$index";
|
||||
$usage = $entry['hrProcessorLoad'];
|
||||
|
||||
// What is this for? I have forgotten. What has : in its hrDeviceDescr?
|
||||
// Set description to that found in hrDeviceDescr, first part only if containing a :
|
||||
$descr_array = explode(':',$entry['hrDeviceDescr']);
|
||||
if ($descr_array['1']) { $descr = $descr_array['1']; } else { $descr = $descr_array['0']; }
|
||||
|
||||
// Workaround to set fake description for Mikrotik and other who don't populate hrDeviceDescr
|
||||
if (empty($entry['hrDeviceDescr'])) { $descr = 'Processor'; }
|
||||
if (empty($entry['hrDeviceDescr'])) {
|
||||
$descr = 'Processor';
|
||||
if ($hr_count > 1) {
|
||||
// Append processor index
|
||||
$descr .= ' ' . ($index - 1);
|
||||
}
|
||||
} elseif (str_contains($entry['hrDeviceDescr'], ':')) {
|
||||
// What is this for? I have forgotten. What has : in its hrDeviceDescr?
|
||||
// Set description to that found in hrDeviceDescr, first part only if containing a :
|
||||
list(, $descr) = explode(':', $entry['hrDeviceDescr']);
|
||||
} else {
|
||||
$descr = $entry['hrDeviceDescr'];
|
||||
}
|
||||
|
||||
$descr = rewrite_entity_name($descr);
|
||||
|
||||
if ($device['os'] === 'arista_eos' && $index == 1) { continue; }
|
||||
|
||||
if ($descr !== 'An electronic chip that makes the computer work.') {
|
||||
discover_processor($valid['processor'], $device, $usage_oid, $index, 'hr', $descr, 1, $usage, NULL, $hrDeviceIndex);
|
||||
$hr_cpus++;
|
||||
$hr_total += $usage;
|
||||
}
|
||||
unset($old_rrd,$new_rrd,$descr,$entry,$usage_oid,$index,$usage,$hrDeviceIndex,$descr_array);
|
||||
unset($old_rrd, $new_rrd, $descr, $entry, $usage_oid, $index, $usage, $hrDeviceIndex);
|
||||
}
|
||||
unset($entry);
|
||||
}
|
||||
|
||||
if ($hr_cpus) {
|
||||
$hr_total = $hr_total / $hr_cpus;
|
||||
discover_processor($valid['processor'], $device, 1, 1, 'hr-average', 'Average', 1, $usage);
|
||||
discover_processor($valid['processor'], $device, 1, 1, 'hr-average', 'Average', 1, $hr_total / $hr_cpus);
|
||||
//$ucd_count = @dbFetchCell("SELECT COUNT(*) FROM `processors` WHERE `device_id` = ? AND `processor_type` = 'ucd-old'", array($device['device_id']));
|
||||
//if ($ucd_count)
|
||||
if (dbExist('processors', '`device_id` = ? AND `processor_type` = ?', array($device['device_id'], 'ucd-old'))) {
|
||||
if (dbExist('processors', '`device_id` = ? AND `processor_type` = ?', [ $device['device_id'], 'ucd-old' ])) {
|
||||
$GLOBALS['module_stats']['processors']['deleted']++; //echo('-');
|
||||
dbDelete('processors', "`device_id` = ? AND `processor_type` = ?", array($device['device_id'], 'ucd-old')); // Heh, this is because UCD-SNMP-MIB run earlier
|
||||
dbDelete('processors', "`device_id` = ? AND `processor_type` = ?", [ $device['device_id'], 'ucd-old' ]); // Heh, this is because UCD-SNMP-MIB run earlier
|
||||
}
|
||||
}
|
||||
|
||||
unset($hrDevice_oids, $hrDevice_array, $oid);
|
||||
unset($hr_array, $oid);
|
||||
}
|
||||
|
||||
// EOF
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
@ -7,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -37,7 +36,7 @@ $pws = snmpwalk_cache_oid($device, "cpwVcMplsLocalLdpID", $pws, "CISCO-IETF-PW-M
|
||||
$pws = snmpwalk_cache_oid($device, "cpwVcMplsPeerLdpID", $pws, "CISCO-IETF-PW-MPLS-MIB");
|
||||
//echo("PWS_WALK: ".count($pws)."\n"); var_dump($pws);
|
||||
|
||||
$peer_where = generate_query_values($device['device_id'], 'device_id', '!='); // Additional filter for exclude self IPs
|
||||
$peer_where = generate_query_values_and($device['device_id'], 'device_id', '!='); // Additional filter for exclude self IPs
|
||||
foreach ($pws as $pw_id => $pw)
|
||||
{
|
||||
$peer_addr = hex2ip($pw['cpwVcPeerAddr']);
|
||||
@ -96,7 +95,7 @@ $pws = snmpwalk_cache_oid($device, "cpwVcMplsPeerLdpID", $pws, "CISCO-IETF-PW-M
|
||||
// cpwVcName.3221225473 = STRING: 82.209.169.153,3055
|
||||
// cpwVcMplsLocalLdpID.3221225473 = STRING: 82.209.169.129:0
|
||||
list($local_addr) = explode(':', $pw['cpwVcMplsLocalLdpID']);
|
||||
$local_where = generate_query_values($device['device_id'], 'device_id'); // Filter by self IPs
|
||||
$local_where = generate_query_values_and($device['device_id'], 'device_id'); // Filter by self IPs
|
||||
if ($ids = get_entity_ids_ip_by_network('port', $local_addr, $local_where))
|
||||
{
|
||||
$if_id = $ids[0];
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
@ -7,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -34,7 +33,7 @@ if ($GLOBALS['snmp_status'] === FALSE)
|
||||
echo('PWS_WALK: '.count($pws)."\n"); print_vars($pws);
|
||||
}
|
||||
|
||||
$peer_where = generate_query_values($device['device_id'], 'device_id', '!='); // Additional filter for exclude self IPs
|
||||
$peer_where = generate_query_values_and($device['device_id'], 'device_id', '!='); // Additional filter for exclude self IPs
|
||||
foreach ($pws as $pw_type => $entry)
|
||||
{
|
||||
foreach ($entry as $pw_name => $entry2)
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
@ -7,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -33,7 +32,7 @@ $pws = snmpwalk_cache_oid($device, "pwMplsLocalLdpID", $pws, "PW-MPLS-STD-MIB");
|
||||
$pws = snmpwalk_cache_oid($device, "pwMplsPeerLdpID", $pws, "PW-MPLS-STD-MIB");
|
||||
//echo("PWS_WALK: ".count($pws)."\n"); var_dump($pws);
|
||||
|
||||
$peer_where = generate_query_values($device['device_id'], 'device_id', '!='); // Additional filter for exclude self IPs
|
||||
$peer_where = generate_query_values_and($device['device_id'], 'device_id', '!='); // Additional filter for exclude self IPs
|
||||
foreach ($pws as $pw_id => $pw)
|
||||
{
|
||||
$peer_addr_type = $pw['pwPeerAddrType'];
|
||||
@ -84,7 +83,7 @@ $pws = snmpwalk_cache_oid($device, "pwMplsPeerLdpID", $pws, "PW-MPLS-STD-MIB");
|
||||
$pw['pwDescr'] = rtrim($pw['pwDescr'], ". \t\n\r\0\x0B");
|
||||
$pw['pwRemoteIfString'] = rtrim($pw['pwRemoteIfString'], ". \t\n\r\0\x0B");
|
||||
|
||||
$if_id = dbFetchCell('SELECT `port_id` FROM `ports` WHERE `ifDescr` = ? AND `device_id` = ? LIMIT 1;', array($pw['pwName'], $device['device_id']));
|
||||
$if_id = dbFetchCell('SELECT `port_id` FROM `ports` WHERE (`ifDescr` = ? OR `ifName` = ?) AND `device_id` = ? LIMIT 1;', array($pw['pwName'], $pw['pwName'], $device['device_id']));
|
||||
if (!is_numeric($if_id) && strpos($pw['pwName'], '_'))
|
||||
{
|
||||
// IOS-XR some time use '_' instead '/'. http://jira.observium.org/browse/OBSERVIUM-246
|
||||
@ -99,7 +98,7 @@ $pws = snmpwalk_cache_oid($device, "pwMplsPeerLdpID", $pws, "PW-MPLS-STD-MIB");
|
||||
// pwName.3221225473 = STRING: 82.209.169.153,3055
|
||||
// pwMplsLocalLdpID.3221225473 = STRING: 82.209.169.129:0
|
||||
list($local_addr) = explode(':', $pw['pwMplsLocalLdpID']);
|
||||
$local_where = generate_query_values($device['device_id'], 'device_id'); // Filter by self IPs
|
||||
$local_where = generate_query_values_and($device['device_id'], 'device_id'); // Filter by self IPs
|
||||
if ($ids = get_entity_ids_ip_by_network('port', $local_addr, $local_where))
|
||||
{
|
||||
$if_id = $ids[0];
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
@ -7,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -58,20 +57,20 @@ foreach (explode("\n", $oids) as $data)
|
||||
for ($encNum = 1; $encNum <= 8; $encNum++) {
|
||||
$table = "hwEnclosure$encNum";
|
||||
$enclosures = snmpwalk_cache_oid($device, $table, [], "ARECA-SNMP-MIB");
|
||||
if (!isset($enclosures[0]) || !$enclosures[0]["hwEnclosure0${encNum}Installed"]) {
|
||||
if (!isset($enclosures[0]) || !$enclosures[0]["hwEnclosure0{$encNum}Installed"]) {
|
||||
// Index 0 is the main enclosure data, we check if the enclosure is connected, but it will
|
||||
// not have any sensors of its own, so we skip index 0.
|
||||
continue;
|
||||
}
|
||||
$enclosure = $enclosures[0];
|
||||
unset($enclosures[0]);
|
||||
$name = $enclosure["hwEnclosure0${encNum}Description"];
|
||||
$name = $enclosure["hwEnclosure0{$encNum}Description"];
|
||||
|
||||
foreach ($enclosures as $index => $entry) {
|
||||
if ($entry["hwEnclosure0${encNum}VolIndex"]) {
|
||||
$descr = $name . ' (' . $encNum . ') ' . $entry["hwEnclosure0${encNum}VolDesc"];
|
||||
if ($entry["hwEnclosure0{$encNum}VolIndex"]) {
|
||||
$descr = $name . ' (' . $encNum . ') ' . $entry["hwEnclosure0{$encNum}VolDesc"];
|
||||
$oid_num = ".1.3.6.1.4.1.18928.1.2.2." . ($encNum+1) . ".8.1.3.$index";
|
||||
$oid_name = "hwEnclosure0${encNum}VolValue";
|
||||
$oid_name = "hwEnclosure0{$encNum}VolValue";
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
//discover_sensor('voltage', $device, $oid_num, "$oid_name.$index", 'areca', $descr, 0.001, $value);
|
||||
@ -79,10 +78,10 @@ for ($encNum = 1; $encNum <= 8; $encNum++) {
|
||||
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid_num, $index, NULL, $descr, 0.001, $value, $options);
|
||||
}
|
||||
|
||||
if ($entry["hwEnclosure0${encNum}FanIndex"]) {
|
||||
$descr = $name . ' (' . $encNum . ') ' . $entry["hwEnclosure0${encNum}FanDesc"];
|
||||
if ($entry["hwEnclosure0{$encNum}FanIndex"]) {
|
||||
$descr = $name . ' (' . $encNum . ') ' . $entry["hwEnclosure0{$encNum}FanDesc"];
|
||||
$oid_num = ".1.3.6.1.4.1.18928.1.2.2." . ($encNum+1) . ".9.1.3.$index";
|
||||
$oid_name = "hwEnclosure0${encNum}FanSpeed";
|
||||
$oid_name = "hwEnclosure0{$encNum}FanSpeed";
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
//discover_sensor('fanspeed', $device, $oid_num, "$oid_name.$index", 'areca', $descr, 1, $value);
|
||||
@ -90,10 +89,10 @@ for ($encNum = 1; $encNum <= 8; $encNum++) {
|
||||
discover_sensor_ng($device, 'fanspeed', $mib, $oid_name, $oid_num, $index, NULL, $descr, 1, $value, $options);
|
||||
}
|
||||
|
||||
if ($entry["hwEnclosure0${encNum}TempIndex"]) {
|
||||
$descr = $name . ' (' . $encNum . ') ' . $entry["hwEnclosure0${encNum}TempDesc"];
|
||||
if ($entry["hwEnclosure0{$encNum}TempIndex"]) {
|
||||
$descr = $name . ' (' . $encNum . ') ' . $entry["hwEnclosure0{$encNum}TempDesc"];
|
||||
$oid_num = ".1.3.6.1.4.1.18928.1.2.2." . ($encNum+1) . ".10.1.3.$index";
|
||||
$oid_name = "hwEnclosure0${encNum}TempValue";
|
||||
$oid_name = "hwEnclosure0{$encNum}TempValue";
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
//discover_sensor('temperature', $device, $oid_num, "$oid_name.$index", 'areca', $descr, 1, $value);
|
||||
@ -101,13 +100,13 @@ for ($encNum = 1; $encNum <= 8; $encNum++) {
|
||||
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, NULL, $descr, 1, $value, $options);
|
||||
}
|
||||
|
||||
if ($entry["hwEnclosure0${encNum}PowerIndex"]) {
|
||||
$descr = $name . ' (' . $encNum . ') ' . $entry["hwEnclosure0${encNum}PowerDesc"];
|
||||
if ($entry["hwEnclosure0{$encNum}PowerIndex"]) {
|
||||
$descr = $name . ' (' . $encNum . ') ' . $entry["hwEnclosure0{$encNum}PowerDesc"];
|
||||
$oid_num = ".1.3.6.1.4.1.18928.1.2.2." . ($encNum+1) . ".7.1.3.$index";
|
||||
$oid_name = "hwEnclosure0${encNum}PowerState";
|
||||
$oid_name = "hwEnclosure0{$encNum}PowerState";
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
//discover_status($device, $oid, "hwEnclosure0${encNum}PowerState.$index", 'areca-power-state', $descr, $value, array('entPhysicalClass' => 'power'));
|
||||
//discover_status($device, $oid, "hwEnclosure0{$encNum}PowerState.$index", 'areca-power-state', $descr, $value, array('entPhysicalClass' => 'power'));
|
||||
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'areca-power-state', $descr, $value, [ 'entPhysicalClass' => 'power' ]);
|
||||
}
|
||||
}
|
||||
@ -118,21 +117,21 @@ for ($encNum = 1; $encNum <= 8; $encNum++) {
|
||||
for ($encNum = 1; $encNum <= 8; $encNum++) {
|
||||
$table = "hddEnclosure$encNum";
|
||||
$enclosures = snmpwalk_cache_oid($device, $table, [], "ARECA-SNMP-MIB");
|
||||
if (!isset($enclosures[0]) || !$enclosures[0]["hddEnclosure0${encNum}Installed"]) {
|
||||
if (!isset($enclosures[0]) || !$enclosures[0]["hddEnclosure0{$encNum}Installed"]) {
|
||||
// Index 0 is the main enclosure data, we check if the enclosure is connected, but it will
|
||||
// not have any sensors of its own, so we skip index 0.
|
||||
continue;
|
||||
}
|
||||
$enclosure = $enclosures[0];
|
||||
unset($enclosures[0]);
|
||||
$name = $enclosure["hddEnclosure0${encNum}Description"];
|
||||
$name = $enclosure["hddEnclosure0{$encNum}Description"];
|
||||
|
||||
foreach ($enclosures as $index => $entry) {
|
||||
if ($entry["hddEnclosure0${encNum}Name"] === 'N.A.') { continue; }
|
||||
if ($entry["hddEnclosure0{$encNum}Name"] === 'N.A.') { continue; }
|
||||
|
||||
$descr = 'Slot ' . $entry["hddEnclosure0${encNum}Slots"] . ', ' . trim($entry["hddEnclosure0${encNum}Name"]) . ' (SN: ' . trim($entry["hddEnclosure0${encNum}Serial"]) . ", $name)";
|
||||
$descr = 'Slot ' . $entry["hddEnclosure0{$encNum}Slots"] . ', ' . trim($entry["hddEnclosure0{$encNum}Name"]) . ' (SN: ' . trim($entry["hddEnclosure0{$encNum}Serial"]) . ", $name)";
|
||||
$oid_num = ".1.3.6.1.4.1.18928.1.2.3." . $encNum . ".4.1.8.$index";
|
||||
$oid_name = "hddEnclosure0${encNum}State";
|
||||
$oid_name = "hddEnclosure0{$encNum}State";
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'areca-hdd-state', $descr, $value, [ 'entPhysicalClass' => 'storage' ]);
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
@ -7,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -15,25 +14,19 @@
|
||||
//AXIS-VIDEO-MIB::tempSensorStatus.common.2 = INTEGER: ok(1)
|
||||
//AXIS-VIDEO-MIB::tempSensorValue.common.1 = INTEGER: 26
|
||||
//AXIS-VIDEO-MIB::tempSensorValue.common.2 = INTEGER: 32
|
||||
//AXIS-VIDEO-MIB::storageName.1 = STRING: SD_DISK
|
||||
//AXIS-VIDEO-MIB::storageName.2 = STRING: NetworkShare
|
||||
//AXIS-VIDEO-MIB::storageDisruptionDetected.1 = INTEGER: no(1)
|
||||
//AXIS-VIDEO-MIB::storageDisruptionDetected.2 = INTEGER: yes(2)
|
||||
|
||||
$mib = 'AXIS-VIDEO-MIB';
|
||||
|
||||
// Temperature Sensor
|
||||
$oids = snmpwalk_cache_oid($device, 'tempSensorEntry', array(), $mib, NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
|
||||
$oids = snmpwalk_cache_oid($device, 'tempSensorEntry', [], $mib, NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
|
||||
print_debug_vars($oids);
|
||||
|
||||
foreach ($oids as $index => $entry)
|
||||
{
|
||||
foreach ($oids as $index => $entry) {
|
||||
//if ($entry['tempSensorStatus'] == 'failure') { continue; } // ok(1), failure(2), outOfBoundary(3)
|
||||
|
||||
// common(1), housing(2), rack(3), cpu(4)
|
||||
list($tempSensorType, $tempSensorId) = explode('.', $index);
|
||||
switch ($tempSensorType)
|
||||
{
|
||||
switch ($tempSensorType) {
|
||||
case '1':
|
||||
$descr = 'System temperature';
|
||||
break;
|
||||
@ -49,8 +42,7 @@ foreach ($oids as $index => $entry)
|
||||
default:
|
||||
$descr = 'Temperature';
|
||||
}
|
||||
if (count($oids) > 1)
|
||||
{
|
||||
if (count($oids) > 1) {
|
||||
$descr .= ' ' . $tempSensorId;
|
||||
}
|
||||
|
||||
@ -69,19 +61,17 @@ foreach ($oids as $index => $entry)
|
||||
$type = 'axisStatus';
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, array('entPhysicalClass' => 'other'));
|
||||
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, [ 'entPhysicalClass' => 'other' ]);
|
||||
}
|
||||
|
||||
// Fan Sensor
|
||||
$oids = snmpwalk_cache_oid($device, 'fanEntry', array(), $mib, NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
|
||||
$oids = snmpwalk_cache_oid($device, 'fanEntry', [], $mib, NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
|
||||
print_debug_vars($oids);
|
||||
|
||||
foreach ($oids as $index => $entry)
|
||||
{
|
||||
foreach ($oids as $index => $entry) {
|
||||
// common(1), housing(2), rack(3), cpu(4)
|
||||
list($SensorType, $SensorId) = explode('.', $index);
|
||||
switch ($SensorType)
|
||||
{
|
||||
switch ($SensorType) {
|
||||
case '1':
|
||||
$descr = 'System fan';
|
||||
break;
|
||||
@ -97,8 +87,7 @@ foreach ($oids as $index => $entry)
|
||||
default:
|
||||
$descr = 'Fan';
|
||||
}
|
||||
if (count($oids) > 1)
|
||||
{
|
||||
if (count($oids) > 1) {
|
||||
$descr .= ' ' . $SensorId;
|
||||
}
|
||||
|
||||
@ -107,7 +96,7 @@ foreach ($oids as $index => $entry)
|
||||
$type = 'axisStatus';
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, array('entPhysicalClass' => 'fan'));
|
||||
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, $type, $descr, $value, [ 'entPhysicalClass' => 'fan' ]);
|
||||
}
|
||||
|
||||
// EOF
|
||||
|
||||
@ -6,20 +6,16 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
$entity_array = snmpwalk_cache_oid($device, 'entSensorValueEntry', $entity_array, 'CISCO-ENTITY-SENSOR-MIB');
|
||||
if ($GLOBALS['snmp_status'])
|
||||
{
|
||||
if (is_array($GLOBALS['cache']['snmp']['ENTITY-MIB'][$device['device_id']]))
|
||||
{
|
||||
if (snmp_status()) {
|
||||
if (is_array($GLOBALS['cache']['snmp']['ENTITY-MIB'][$device['device_id']])) {
|
||||
// If this already received in inventory module, skip walking
|
||||
foreach ($GLOBALS['cache']['snmp']['ENTITY-MIB'][$device['device_id']] as $index => $entry)
|
||||
{
|
||||
if (isset($entity_array[$index]))
|
||||
{
|
||||
foreach ($GLOBALS['cache']['snmp']['ENTITY-MIB'][$device['device_id']] as $index => $entry) {
|
||||
if (isset($entity_array[$index])) {
|
||||
$entity_array[$index] = array_merge($entity_array[$index], $entry);
|
||||
} else {
|
||||
$entity_array[$index] = $entry;
|
||||
@ -54,10 +50,9 @@ if ($GLOBALS['snmp_status'])
|
||||
}
|
||||
}
|
||||
|
||||
$t_oids = array('entSensorThresholdSeverity', 'entSensorThresholdRelation', 'entSensorThresholdValue');
|
||||
$t_entity_array = array();
|
||||
foreach ($t_oids as $oid)
|
||||
{
|
||||
$t_oids = [ 'entSensorThresholdSeverity', 'entSensorThresholdRelation', 'entSensorThresholdValue' ];
|
||||
$t_entity_array = [];
|
||||
foreach ($t_oids as $oid) {
|
||||
$t_entity_array = snmpwalk_cache_twopart_oid($device, $oid, $t_entity_array, 'CISCO-ENTITY-SENSOR-MIB');
|
||||
}
|
||||
|
||||
@ -79,7 +74,7 @@ if ($GLOBALS['snmp_status'])
|
||||
dBm(14): dB relative to 1mW of power
|
||||
*/
|
||||
|
||||
$c_entitysensor = array(
|
||||
$c_entitysensor = [
|
||||
'voltsAC' => 'voltage',
|
||||
'voltsDC' => 'voltage',
|
||||
'amperes' => 'current',
|
||||
@ -92,14 +87,14 @@ if ($GLOBALS['snmp_status'])
|
||||
'truthvalue' => 'state',
|
||||
//'specialEnum' => 'gauge', // This sensors seems as useless
|
||||
'dBm' => 'dbm'
|
||||
);
|
||||
];
|
||||
|
||||
$i = [];
|
||||
foreach ($entity_array as $index => $entry) {
|
||||
if (is_numeric($index) && isset($c_entitysensor[$entry['entSensorType']]) &&
|
||||
is_numeric($entry['entSensorValue']) && $entry['entSensorStatus'] === 'ok') {
|
||||
$ok = TRUE;
|
||||
$options = array('entPhysicalIndex' => $index);
|
||||
$options = [ 'entPhysicalIndex' => $index ];
|
||||
|
||||
$descr = rewrite_entity_name($entry['entPhysicalDescr']);
|
||||
if ($device['os'] === 'cisco-firepower') {
|
||||
@ -174,7 +169,7 @@ if ($GLOBALS['snmp_status'])
|
||||
print_debug_vars($entry);
|
||||
|
||||
// Now try to search port bounded with sensor by ENTITY-MIB
|
||||
if ($ok && in_array($type, array('temperature', 'voltage', 'current', 'dbm', 'power'))) {
|
||||
if ($ok && in_array($type, [ 'temperature', 'voltage', 'current', 'dbm', 'power' ])) {
|
||||
$port = get_port_by_ent_index($device, $index);
|
||||
$options['entPhysicalIndex'] = $index;
|
||||
if (is_array($port)) {
|
||||
@ -209,17 +204,22 @@ if ($GLOBALS['snmp_status'])
|
||||
}
|
||||
|
||||
// Set thresholds for numeric sensors
|
||||
$limits = array();
|
||||
$limits = [];
|
||||
$scale = NULL;
|
||||
if ($c_entitysensor[$entry['entSensorType']] !== 'state') {
|
||||
$precision = $entry['entSensorPrecision'];
|
||||
// See: https://jira.observium.org/browse/OBS-3026
|
||||
// Note, issue not actual on firmware less than 16.11, not sure if fixed on more newer firmwares
|
||||
// Seems as not actual on 16.12.x, see: https://jira.observium.org/browse/OBS-3707
|
||||
if ($device['os'] === 'iosxe' && $precision > 0 &&
|
||||
version_compare($device['version'], '16.11', '>=') && version_compare($device['version'], '16.12', '<')) {
|
||||
// See: https://jira.observium.org/browse/OBS-3026
|
||||
// Note, issue not actual on firmware less than 16.11, not sure if fixed on newer firmwares
|
||||
// Seems as not actual on 16.12.x, see: https://jira.observium.org/browse/OBS-3707
|
||||
// I not sure that this fully correct, but for issue case - works
|
||||
$precision -= 1;
|
||||
} elseif ($device['os'] === 'iosxr' && $precision > 0 && $type === 'power' &&
|
||||
$device['version'] === '6.4.2' && preg_match('/ASR\-90\d{2}/', $device['hardware'])) {
|
||||
// See: https://jira.observium.org/browse/OBS-4079
|
||||
// ASR9k 32bit platform issue for power sensor
|
||||
$precision -= 1;
|
||||
}
|
||||
$scale = si_to_scale($entry['entSensorScale'], $precision);
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
@ -7,17 +6,16 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2014 Adam Armstrong
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
$hpups_array = array();
|
||||
$hpups_array = [];
|
||||
$hpups_array = snmpwalk_cache_oid($device, 'upsInput', $hpups_array, 'CPQPOWER-MIB');
|
||||
$hpups_array = snmpwalk_cache_oid($device, 'upsOutput', $hpups_array, 'CPQPOWER-MIB');
|
||||
$hpups_array = snmpwalk_cache_oid($device, 'upsBypass', $hpups_array, 'CPQPOWER-MIB');
|
||||
|
||||
foreach (array_slice(array_keys($hpups_array),1) as $phase)
|
||||
{
|
||||
foreach (array_slice(array_keys($hpups_array),1) as $phase) {
|
||||
# Skip garbage output:
|
||||
# upsOutput.6.0 = 0
|
||||
# upsOutput.7.0 = 0
|
||||
@ -39,8 +37,7 @@ foreach (array_slice(array_keys($hpups_array),1) as $phase)
|
||||
$oid = ".1.3.6.1.4.1.232.165.3.3.4.1.3.$index"; # CPQPOWER-MIB:upsInputCurrent.$index
|
||||
$value = $hpups_array[$phase]['upsInputCurrent'];
|
||||
|
||||
if ($value < 10000) # upsInputCurrent.1 = 136137420 ? really? You're nuts.
|
||||
{
|
||||
if ($value < 10000) { # upsInputCurrent.1 = 136137420 ? really? You're nuts.
|
||||
$options = [ 'rename_rrd' => "CPQPOWER-MIB-upsInputEntry.$index" ];
|
||||
discover_sensor_ng($device, 'current', $mib, 'upsInputCurrent', $oid, $index, NULL, $descr, 1, $value, $options);
|
||||
}
|
||||
@ -132,29 +129,26 @@ unset($hpups_array);
|
||||
//CPQPOWER-MIB::pduOutputPower.2 = INTEGER: 671
|
||||
//CPQPOWER-MIB::pduOutputNumBreakers.1 = INTEGER: 3
|
||||
//CPQPOWER-MIB::pduOutputNumBreakers.2 = INTEGER: 3
|
||||
$hppdu_array = snmpwalk_cache_oid($device, 'pduIdentTable', array(), 'CPQPOWER-MIB');
|
||||
$hppdu_array = snmpwalk_cache_oid($device, 'pduIdentTable', [], 'CPQPOWER-MIB');
|
||||
$hppdu_array = snmpwalk_cache_oid($device, 'pduOutputTable', $hppdu_array, 'CPQPOWER-MIB');
|
||||
foreach ($hppdu_array as $index => $entry)
|
||||
{
|
||||
foreach ($hppdu_array as $index => $entry) {
|
||||
// Monitor PDU Status
|
||||
$oid = ".1.3.6.1.4.1.232.165.2.1.2.1.8.$index";
|
||||
$descr = $entry['pduName'].' Status';
|
||||
if (!empty($entry['pduStatus']))
|
||||
{
|
||||
if (!empty($entry['pduStatus'])) {
|
||||
discover_status_ng($device, $mib, 'pduStatus', $oid, $index, 'cpqpower-pdu-status', $descr, $entry['pduStatus'], array('entPhysicalClass' => 'power', 'rename_rrd' => 'cpqpower-pdu-status-%index%'));
|
||||
}
|
||||
|
||||
// Monitor PDU Output load
|
||||
$oid = ".1.3.6.1.4.1.232.165.2.3.1.1.2.$index";
|
||||
$descr = $entry['pduName'].' Load';
|
||||
$limits = array();
|
||||
if (!empty($entry['pduOutputLoad']) && $entry['pduOutputLoad'] != '-1')
|
||||
{
|
||||
$limits = [];
|
||||
if (!empty($entry['pduOutputLoad']) && $entry['pduOutputLoad'] != '-1') {
|
||||
$options = [ 'rename_rrd' => "CPQPOWER-MIB-%index%" ];
|
||||
discover_sensor_ng($device, 'capacity', $mib, 'pduOutputLoad', $oid, $index, NULL, $descr, 1, $entry['pduOutputLoad'], $options);
|
||||
|
||||
// Find power limit by measure the reported output power divided by the reported load of the PDU
|
||||
$pdu_maxload = 100 * ($entry['pduOutputPower'] / $entry['pduOutputLoad']);
|
||||
$pdu_maxload = 100 * float_div($entry['pduOutputPower'], $entry['pduOutputLoad']);
|
||||
$pdu_warnload = 0.8 * $pdu_maxload;
|
||||
$limits = array('limit_high' => round($pdu_maxload, 2),
|
||||
'limit_high_warn' => round($pdu_warnload, 2));
|
||||
@ -164,8 +158,7 @@ foreach ($hppdu_array as $index => $entry)
|
||||
$oid = ".1.3.6.1.4.1.232.165.2.3.1.1.4.$index";
|
||||
$descr = $entry['pduName'].' Output Power';
|
||||
|
||||
if (!empty($entry['pduOutputPower']) && $entry['pduOutputPower'] != '-1')
|
||||
{
|
||||
if (!empty($entry['pduOutputPower']) && $entry['pduOutputPower'] != '-1') {
|
||||
$options = $limits;
|
||||
$options['rename_rrd'] = "CPQPOWER-MIB-%index%";
|
||||
discover_sensor_ng($device, 'power', $mib, 'pduOutputPower', $oid, $index, NULL, $descr, 1, $entry['pduOutputPower'], $options);
|
||||
@ -182,9 +175,8 @@ foreach ($hppdu_array as $index => $entry)
|
||||
//CPQPOWER-MIB::breakerPercentLoad.2.6 = INTEGER: 0
|
||||
//CPQPOWER-MIB::breakerStatus.1.1 = INTEGER: 0
|
||||
//CPQPOWER-MIB::breakerStatus.2.6 = INTEGER: 0
|
||||
$hppdu_breaker_array = snmpwalk_cache_oid($device, 'pduOutputBreakerTable', array(), 'CPQPOWER-MIB');
|
||||
foreach ($hppdu_breaker_array as $index => $entry)
|
||||
{
|
||||
$hppdu_breaker_array = snmpwalk_cache_oid($device, 'pduOutputBreakerTable', [], 'CPQPOWER-MIB');
|
||||
foreach ($hppdu_breaker_array as $index => $entry) {
|
||||
if ($entry['breakerVoltage'] <= 0) { continue; }
|
||||
|
||||
list($breaker_output, $breaker_unit) = explode('.', $index, 2);
|
||||
@ -192,7 +184,7 @@ foreach ($hppdu_breaker_array as $index => $entry)
|
||||
|
||||
// Find powerlimit by measure the reported output power devivded by the reported load of the PDU
|
||||
//$breaker_maxload = 100 * ($entry['breakerCurrent'] / $entry['breakerPercentLoad']);
|
||||
$breaker_maxload = $entry['breakerCurrent'] / $entry['breakerPercentLoad']; // breakerCurrent already scaled by 100
|
||||
$breaker_maxload = float_div($entry['breakerCurrent'], $entry['breakerPercentLoad']); // breakerCurrent already scaled by 100
|
||||
$breaker_warnload = 0.8 * $breaker_maxload;
|
||||
$limits = array('limit_high' => round($breaker_maxload, 2),
|
||||
'limit_high_warn' => round($breaker_warnload, 2));
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -113,12 +113,18 @@ foreach ($oids as $index => $entry) {
|
||||
$oid_num = '.1.3.6.1.4.1.171.12.72.2.1.1.1.2.'.$index;
|
||||
$scale = 1;
|
||||
$value = $entry[$oid_name];
|
||||
$limits = [
|
||||
'limit_high' => $oids_limit[$index]['temperature']['swDdmHighAlarm'],
|
||||
'limit_low' => $oids_limit[$index]['temperature']['swDdmLowAlarm'],
|
||||
'limit_high_warn' => $oids_limit[$index]['temperature']['swDdmHighWarning'],
|
||||
'limit_low_warn' => $oids_limit[$index]['temperature']['swDdmLowWarning']
|
||||
];
|
||||
|
||||
$limits = [];
|
||||
$limit_type = 'temperature';
|
||||
$limits_oids = [ 'limit_high' => 'swDdmHighAlarm', 'limit_high_warn' => 'swDdmHighWarning',
|
||||
'limit_low' => 'swDdmLowAlarm', 'limit_low_warn' => 'swDdmLowWarning' ];
|
||||
foreach ($limits_oids as $limit => $limit_oid) {
|
||||
// Prevent php8 fatal errors
|
||||
if (!is_numeric($oids_limit[$index][$limit_type][$limit_oid])) { continue; }
|
||||
|
||||
$limits[$limit] = $oids_limit[$index][$limit_type][$limit_oid] * $scale;
|
||||
}
|
||||
|
||||
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
|
||||
|
||||
// Voltage
|
||||
@ -128,12 +134,18 @@ foreach ($oids as $index => $entry) {
|
||||
$oid_num = '.1.3.6.1.4.1.171.12.72.2.1.1.1.3.'.$index;
|
||||
$scale = 1;
|
||||
$value = $entry[$oid_name];
|
||||
$limits = [
|
||||
'limit_high' => $oids_limit[$index]['voltage']['swDdmHighAlarm'],
|
||||
'limit_low' => $oids_limit[$index]['voltage']['swDdmLowAlarm'],
|
||||
'limit_high_warn' => $oids_limit[$index]['voltage']['swDdmHighWarning'],
|
||||
'limit_low_warn' => $oids_limit[$index]['voltage']['swDdmLowWarning']
|
||||
];
|
||||
|
||||
$limits = [];
|
||||
$limit_type = 'voltage';
|
||||
$limits_oids = [ 'limit_high' => 'swDdmHighAlarm', 'limit_high_warn' => 'swDdmHighWarning',
|
||||
'limit_low' => 'swDdmLowAlarm', 'limit_low_warn' => 'swDdmLowWarning' ];
|
||||
foreach ($limits_oids as $limit => $limit_oid) {
|
||||
// Prevent php8 fatal errors
|
||||
if (!is_numeric($oids_limit[$index][$limit_type][$limit_oid])) { continue; }
|
||||
|
||||
$limits[$limit] = $oids_limit[$index][$limit_type][$limit_oid] * $scale;
|
||||
}
|
||||
|
||||
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
|
||||
|
||||
// Tx Bias
|
||||
@ -143,12 +155,18 @@ foreach ($oids as $index => $entry) {
|
||||
$oid_num = '.1.3.6.1.4.1.171.12.72.2.1.1.1.4.'.$index;
|
||||
$scale = 0.001;
|
||||
$value = $entry[$oid_name];
|
||||
$limits = [
|
||||
'limit_high' => $oids_limit[$index]['bias']['swDdmHighAlarm'] * $scale,
|
||||
'limit_low' => $oids_limit[$index]['bias']['swDdmLowAlarm'] * $scale,
|
||||
'limit_high_warn' => $oids_limit[$index]['bias']['swDdmHighWarning'] * $scale,
|
||||
'limit_low_warn' => $oids_limit[$index]['bias']['swDdmLowWarning'] * $scale
|
||||
];
|
||||
|
||||
$limits = [];
|
||||
$limit_type = 'bias';
|
||||
$limits_oids = [ 'limit_high' => 'swDdmHighAlarm', 'limit_high_warn' => 'swDdmHighWarning',
|
||||
'limit_low' => 'swDdmLowAlarm', 'limit_low_warn' => 'swDdmLowWarning' ];
|
||||
foreach ($limits_oids as $limit => $limit_oid) {
|
||||
// Prevent php8 fatal errors
|
||||
if (!is_numeric($oids_limit[$index][$limit_type][$limit_oid])) { continue; }
|
||||
|
||||
$limits[$limit] = $oids_limit[$index][$limit_type][$limit_oid] * $scale;
|
||||
}
|
||||
|
||||
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
|
||||
|
||||
// Tx Power
|
||||
@ -158,12 +176,18 @@ foreach ($oids as $index => $entry) {
|
||||
$oid_num = '.1.3.6.1.4.1.171.12.72.2.1.1.1.5.'.$index;
|
||||
$scale = $power_unit === 'mw' ? 0.001 : 1;
|
||||
$value = $entry[$oid_name];
|
||||
$limits = [
|
||||
'limit_high' => $oids_limit[$index]['txPower']['swDdmHighAlarm'] * $scale,
|
||||
'limit_low' => $oids_limit[$index]['txPower']['swDdmLowAlarm'] * $scale,
|
||||
'limit_high_warn' => $oids_limit[$index]['txPower']['swDdmHighWarning'] * $scale,
|
||||
'limit_low_warn' => $oids_limit[$index]['txPower']['swDdmLowWarning'] * $scale
|
||||
];
|
||||
|
||||
$limits = [];
|
||||
$limit_type = 'txPower';
|
||||
$limits_oids = [ 'limit_high' => 'swDdmHighAlarm', 'limit_high_warn' => 'swDdmHighWarning',
|
||||
'limit_low' => 'swDdmLowAlarm', 'limit_low_warn' => 'swDdmLowWarning' ];
|
||||
foreach ($limits_oids as $limit => $limit_oid) {
|
||||
// Prevent php8 fatal errors
|
||||
if (!is_numeric($oids_limit[$index][$limit_type][$limit_oid])) { continue; }
|
||||
|
||||
$limits[$limit] = $oids_limit[$index][$limit_type][$limit_oid] * $scale;
|
||||
}
|
||||
|
||||
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
|
||||
|
||||
// Rx Power
|
||||
@ -173,12 +197,18 @@ foreach ($oids as $index => $entry) {
|
||||
$oid_num = '.1.3.6.1.4.1.171.12.72.2.1.1.1.6.'.$index;
|
||||
$scale = $power_unit === 'mw' ? 0.001 : 1;
|
||||
$value = $entry[$oid_name];
|
||||
$limits = [
|
||||
'limit_high' => $oids_limit[$index]['rxPower']['swDdmHighAlarm'] * $scale,
|
||||
'limit_low' => $oids_limit[$index]['rxPower']['swDdmLowAlarm'] * $scale,
|
||||
'limit_high_warn' => $oids_limit[$index]['rxPower']['swDdmHighWarning'] * $scale,
|
||||
'limit_low_warn' => $oids_limit[$index]['rxPower']['swDdmLowWarning'] * $scale
|
||||
];
|
||||
|
||||
$limits = [];
|
||||
$limit_type = 'rxPower';
|
||||
$limits_oids = [ 'limit_high' => 'swDdmHighAlarm', 'limit_high_warn' => 'swDdmHighWarning',
|
||||
'limit_low' => 'swDdmLowAlarm', 'limit_low_warn' => 'swDdmLowWarning' ];
|
||||
foreach ($limits_oids as $limit => $limit_oid) {
|
||||
// Prevent php8 fatal errors
|
||||
if (!is_numeric($oids_limit[$index][$limit_type][$limit_oid])) { continue; }
|
||||
|
||||
$limits[$limit] = $oids_limit[$index][$limit_type][$limit_oid] * $scale;
|
||||
}
|
||||
|
||||
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits));
|
||||
}
|
||||
|
||||
|
||||
@ -99,6 +99,7 @@ foreach ($cache_discovery['DKSF-48-4-X-X-1']['temphum'] as $index => $entry)
|
||||
}
|
||||
}
|
||||
|
||||
/* Moved to DEF
|
||||
$cache_discovery['DKSF-48-4-X-X-1']['thermo'] = snmpwalk_cache_oid($device, 'npThermoTable', array(), 'DKSF-48-4-X-X-1');
|
||||
foreach ($cache_discovery['DKSF-48-4-X-X-1']['thermo'] as $index => $entry)
|
||||
{
|
||||
@ -113,6 +114,7 @@ foreach ($cache_discovery['DKSF-48-4-X-X-1']['thermo'] as $index => $entry)
|
||||
discover_sensor('temperature', $device, $oid, "npThermoValue.$index", 'dskf-mib', $descr, 1, $value, $limits);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
$cache_discovery['DKSF-48-4-X-X-1']['io'] = snmpwalk_cache_oid($device, 'npIoTable', array(), 'DKSF-48-4-X-X-1');
|
||||
foreach ($cache_discovery['DKSF-48-4-X-X-1']['io'] as $index => $entry)
|
||||
|
||||
@ -73,6 +73,7 @@ foreach ($cache_discovery['DKSF-50-11-X-X-X']['loop'] as $index => $entry)
|
||||
}
|
||||
}
|
||||
|
||||
/* Moved to DEF
|
||||
$cache_discovery['DKSF-50-11-X-X-X']['temphum'] = snmpwalk_cache_oid($device, 'npRelHumTable', array(), 'DKSF-50-11-X-X-X');
|
||||
foreach ($cache_discovery['DKSF-50-11-X-X-X']['temphum'] as $index => $entry)
|
||||
{
|
||||
@ -113,6 +114,7 @@ foreach ($cache_discovery['DKSF-50-11-X-X-X']['thermo'] as $index => $entry)
|
||||
discover_sensor('temperature', $device, $oid, "npThermoValue.$index", 'dskf-mib', $descr, 1, $value, $limits);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
$cache_discovery['DKSF-50-11-X-X-X']['io'] = snmpwalk_cache_oid($device, 'npIoTable', array(), 'DKSF-50-11-X-X-X');
|
||||
foreach ($cache_discovery['DKSF-50-11-X-X-X']['io'] as $index => $entry)
|
||||
|
||||
@ -110,6 +110,7 @@ foreach ($cache_discovery['DKSF-60-4-X-X-X']['temphum'] as $index => $entry)
|
||||
}
|
||||
}
|
||||
|
||||
/* Moved to DEF
|
||||
$cache_discovery['DKSF-60-4-X-X-X']['thermo'] = snmpwalk_cache_oid($device, 'npThermoTable', array(), 'DKSF-60-4-X-X-X');
|
||||
foreach ($cache_discovery['DKSF-60-4-X-X-X']['thermo'] as $index => $entry)
|
||||
{
|
||||
@ -124,6 +125,7 @@ foreach ($cache_discovery['DKSF-60-4-X-X-X']['thermo'] as $index => $entry)
|
||||
discover_sensor('temperature', $device, $oid, "npThermoValue.$index", 'dskf-mib', $descr, 1, $value, $limits);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
$cache_discovery['DKSF-60-4-X-X-X']['io'] = snmpwalk_cache_oid($device, 'npIoTable', array(), 'DKSF-60-4-X-X-X');
|
||||
foreach ($cache_discovery['DKSF-60-4-X-X-X']['io'] as $index => $entry)
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
@ -7,14 +6,15 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
// FIXME migrate to definitions
|
||||
|
||||
$cache_discovery['DKSF-70-5-X-X-1']['smoke'] = snmpwalk_cache_oid($device, 'npSmokeTable', array(), 'DKSF-70-5-X-X-1');
|
||||
foreach ($cache_discovery['DKSF-70-5-X-X-1']['smoke'] as $index => $entry)
|
||||
/* It's broken and renamed, need device access
|
||||
$cache_discovery['DKSF-70-MIB']['smoke'] = snmpwalk_cache_oid($device, 'npSmokeTable', array(), 'DKSF-70-MIB');
|
||||
foreach ($cache_discovery['DKSF-70-MIB']['smoke'] as $index => $entry)
|
||||
{
|
||||
if ($entry['npSmokePower'] == 'off') { continue; }
|
||||
|
||||
@ -27,9 +27,10 @@ foreach ($cache_discovery['DKSF-70-5-X-X-1']['smoke'] as $index => $entry)
|
||||
discover_status($device, $oid, 'npSmokeStatus.'.$index, 'dskf-mib-smoke-state', $descr, $value, array('entPhysicalClass' => 'other'));
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
$cache_discovery['DKSF-70-5-X-X-1']['loop'] = snmpwalk_cache_oid($device, 'npCurLoopTable', array(), 'DKSF-70-5-X-X-1');
|
||||
foreach ($cache_discovery['DKSF-70-5-X-X-1']['loop'] as $index => $entry)
|
||||
$cache_discovery['DKSF-70-MIB']['loop'] = snmpwalk_cache_oid($device, 'npCurLoopTable', array(), 'DKSF-70-MIB');
|
||||
foreach ($cache_discovery['DKSF-70-MIB']['loop'] as $index => $entry)
|
||||
{
|
||||
if ($entry['npCurLoopPower'] == 'off' || $entry['npCurLoopStatus'] == 'notPowered') { continue; }
|
||||
|
||||
@ -72,8 +73,9 @@ foreach ($cache_discovery['DKSF-70-5-X-X-1']['loop'] as $index => $entry)
|
||||
}
|
||||
}
|
||||
|
||||
$cache_discovery['DKSF-70-5-X-X-1']['temphum'] = snmpwalk_cache_oid($device, 'npRelHumTable', array(), 'DKSF-70-5-X-X-1');
|
||||
foreach ($cache_discovery['DKSF-70-5-X-X-1']['temphum'] as $index => $entry)
|
||||
/* Moved to DEF
|
||||
$cache_discovery['DKSF-70-MIB']['temphum'] = snmpwalk_cache_oid($device, 'npRelHumTable', array(), 'DKSF-70-MIB');
|
||||
foreach ($cache_discovery['DKSF-70-MIB']['temphum'] as $index => $entry)
|
||||
{
|
||||
// Temperature
|
||||
$descr = ($entry['npRelHumMemo'] ? $entry['npRelHumMemo'] : 'Temperature '.$index);
|
||||
@ -98,8 +100,8 @@ foreach ($cache_discovery['DKSF-70-5-X-X-1']['temphum'] as $index => $entry)
|
||||
}
|
||||
}
|
||||
|
||||
$cache_discovery['DKSF-70-5-X-X-1']['thermo'] = snmpwalk_cache_oid($device, 'npThermoTable', array(), 'DKSF-70-5-X-X-1');
|
||||
foreach ($cache_discovery['DKSF-70-5-X-X-1']['thermo'] as $index => $entry)
|
||||
$cache_discovery['DKSF-70-MIB']['thermo'] = snmpwalk_cache_oid($device, 'npThermoTable', array(), 'DKSF-70-MIB');
|
||||
foreach ($cache_discovery['DKSF-70-MIB']['thermo'] as $index => $entry)
|
||||
{
|
||||
// Temperature
|
||||
$descr = ($entry['npThermoMemo'] ? $entry['npThermoMemo'] : 'Thermo '.$index);
|
||||
@ -112,9 +114,10 @@ foreach ($cache_discovery['DKSF-70-5-X-X-1']['thermo'] as $index => $entry)
|
||||
discover_sensor('temperature', $device, $oid, "npThermoValue.$index", 'dskf-mib', $descr, 1, $value, $limits);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
$cache_discovery['DKSF-70-5-X-X-1']['io'] = snmpwalk_cache_oid($device, 'npIoTable', array(), 'DKSF-70-5-X-X-1');
|
||||
foreach ($cache_discovery['DKSF-70-5-X-X-1']['io'] as $index => $entry)
|
||||
$cache_discovery['DKSF-70-MIB']['io'] = snmpwalk_cache_oid($device, 'npIoTable', array(), 'DKSF-70-MIB');
|
||||
foreach ($cache_discovery['DKSF-70-MIB']['io'] as $index => $entry)
|
||||
{
|
||||
if ($entry['npIoLevelIn'] == '0') { continue; }
|
||||
|
||||
@ -127,8 +130,8 @@ foreach ($cache_discovery['DKSF-70-5-X-X-1']['io'] as $index => $entry)
|
||||
discover_counter($device, 'counter', $mib, $oid_name, $oid, $index, $descr, 1, $value);
|
||||
}
|
||||
|
||||
print_debug_vars($cache_discovery['DKSF-70-5-X-X-1']);
|
||||
print_debug_vars($cache_discovery['DKSF-70-MIB']);
|
||||
|
||||
unset($cache_discovery['DKSF-70-5-X-X-1']);
|
||||
unset($cache_discovery['DKSF-70-MIB']);
|
||||
|
||||
// EOF
|
||||
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
@ -7,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -156,32 +155,39 @@ $outlets = snmpwalk_cache_twopart_oid($device, 'outletCurrentTable', $outle
|
||||
// Power statistics currently not collected.
|
||||
//$outlets = snmpwalk_cache_twopart_oid($device, 'outletCurrentTable', $outlets, 'EATON-EPDU-MIB');
|
||||
|
||||
foreach ($outlets AS $unit_id => $unit_data)
|
||||
{
|
||||
foreach ($unit_data AS $outlet_id => $outlet)
|
||||
{
|
||||
foreach ($outlets as $unit_id => $unit_data) {
|
||||
foreach ($unit_data as $outlet_id => $entry) {
|
||||
|
||||
$outlet_index = $unit_id.".".$outlet_id;
|
||||
$outlet_descr = "Unit $unit_id ".$outlet['outletName'] . " (".$outlet['outletType'].")";
|
||||
$outlet_capacity = $outlet['outletCurrentCapacity'] * 0.001;
|
||||
$outlet_descr = "Unit $unit_id ".$entry['outletName'] . " (".$entry['outletType'].")";
|
||||
$outlet_capacity = $entry['outletCurrentCapacity'] * 0.001;
|
||||
|
||||
$current_value = $outlet['outletCurrent'];
|
||||
$percent_value = $outlet['outletCurrentPercentLoad'];
|
||||
$status_value = $outlet['outletCurrentThStatus'];
|
||||
$crest_value = $outlet['outletCurrentCrestFactor'];
|
||||
$current_value = $entry['outletCurrent'];
|
||||
$percent_value = $entry['outletCurrentPercentLoad'];
|
||||
$status_value = $entry['outletCurrentThStatus'];
|
||||
$crest_value = $entry['outletCurrentCrestFactor'];
|
||||
|
||||
$current_oid = '.1.3.6.1.4.1.534.6.6.7.6.4.1.3.'.$outlet_index;
|
||||
$percent_oid = '.1.3.6.1.4.1.534.6.6.7.6.4.1.10.'.$outlet_index;
|
||||
$status_oid = '.1.3.6.1.4.1.534.6.6.7.6.4.1.4.'.$outlet_index;
|
||||
$crest_oid = '.1.3.6.1.4.1.534.6.6.7.6.4.1.9.'.$outlet_index;
|
||||
$crest_oid = '.1.3.6.1.4.1.534.6.6.7.6.4.1.9.'.$outlet_index;
|
||||
|
||||
discover_status($device, $status_oid, "outletCurrentThStatus.".$outlet_index, 'outletCurrentThStatus', $outlet_descr, $status_value, array('entPhysicalClass' => 'outlet'));
|
||||
discover_status($device, $status_oid, "outletCurrentThStatus.".$outlet_index, 'outletCurrentThStatus', $outlet_descr, $status_value, [ 'entPhysicalClass' => 'outlet' ]);
|
||||
|
||||
$limits = array('limit_low' => $entry['outletCurrentThLowerCritical']*0.001, 'limit_low_warn' => $entry['outletCurrentThLowerWarning']*0.001,
|
||||
'limit_high' => $entry['outletCurrentThUpperCritical']*0.001, 'limit_high_warn' => $entry['outletCurrentThUpperWarning']*0.001);
|
||||
$limits = [
|
||||
'limit_low' => $entry['outletCurrentThLowerCritical'] * 0.001,
|
||||
'limit_low_warn' => $entry['outletCurrentThLowerWarning'] * 0.001,
|
||||
'limit_high' => $entry['outletCurrentThUpperCritical'] * 0.001,
|
||||
'limit_high_warn' => $entry['outletCurrentThUpperWarning'] * 0.001
|
||||
];
|
||||
|
||||
discover_sensor('current', $device, $current_oid, "outletCurrent.$outlet_index", 'eaton-epdu-mib', $outlet_descr, 0.001, $current_value, $limits);
|
||||
discover_sensor('load', $device, $percent_oid, "outletCurrentPercentLoad.$outlet_index", 'eaton-epdu-mib', $outlet_descr, 1, $percent_value);
|
||||
discover_sensor('crestfactor', $device, $crest_oid, "outletCurrentCrestFactor.$outlet_index", 'eaton-epdu-mib', $outlet_descr, 1, $crest_value);
|
||||
if ($percent_value >= 0) {
|
||||
discover_sensor('load', $device, $percent_oid, "outletCurrentPercentLoad.$outlet_index", 'eaton-epdu-mib', $outlet_descr, 1, $percent_value);
|
||||
}
|
||||
if ($crest_value > 0) {
|
||||
discover_sensor('crestfactor', $device, $crest_oid, "outletCurrentCrestFactor.$outlet_index", 'eaton-epdu-mib', $outlet_descr, 0.001, $crest_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
96
includes/discovery/sensors/egw4mib.inc.php
Normal file
96
includes/discovery/sensors/egw4mib.inc.php
Normal file
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
// EGW4MIB::EGW4GatewaySensorDeviceCount.0 = INTEGER: 2
|
||||
|
||||
if (!snmp_get_oid($device, 'EGW4GatewaySensorDeviceCount.0', $mib)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceID.856694 = Gauge32: 856694
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceID.875433 = Gauge32: 875433
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceType.856694 = STRING: "WaterDetect"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceType.875433 = STRING: "Temperature+Humidity"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceReadingValuesAll.856694 = STRING: "No"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceReadingValuesAll.875433 = STRING: "24.57, 40.46"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceReadingUnitsAll.856694 = STRING: "Detected"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceReadingUnitsAll.875433 = STRING: "deg. C, RH"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceRptUT.856694 = STRING: "0x00"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceRptUT.875433 = STRING: "0x9909CE0F"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceReadingTime.856694 = STRING: "392901311"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceReadingTime.875433 = STRING: "392900464"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceReadingAge.856694 = Gauge32: 4511
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceReadingAge.875433 = Gauge32: 5358
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceTypeNo.856694 = STRING: "4"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceTypeNo.875433 = STRING: "43"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceRFStrength.856694 = STRING: "96"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceRFStrength.875433 = STRING: "34"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceActive.856694 = STRING: "Active"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceActive.875433 = STRING: "Active"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceAlarming.856694 = STRING: "Not alarming"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceAlarming.875433 = STRING: "Not alarming"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceVoltage.856694 = STRING: "3.02"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceVoltage.875433 = STRING: "3.04"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceWDIndexNo.856694 = Wrong Type (should be OCTET STRING): INTEGER: 1
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatSensorDeviceWDIndexNo.875433 = Wrong Type (should be OCTET STRING): INTEGER: 2
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatByDatumNumberSensorDeviceID.856694.1 = Gauge32: 856694
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatByDatumNumberSensorDeviceID.875433.1 = Gauge32: 875433
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatByDatumNumberSensorDeviceID.875433.2 = Gauge32: 875433
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatByDatumNumberDatumNumber.856694.1 = INTEGER: 1
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatByDatumNumberDatumNumber.875433.1 = INTEGER: 1
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatByDatumNumberDatumNumber.875433.2 = INTEGER: 2
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatByDatumNumberReadingValue.856694.1 = STRING: "No"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatByDatumNumberReadingValue.875433.1 = STRING: "24.57"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatByDatumNumberReadingValue.875433.2 = STRING: "40.46"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatByDatumNumberReadingUnits.856694.1 = STRING: "Detected"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatByDatumNumberReadingUnits.875433.1 = STRING: "deg. C"
|
||||
// EGW4MIB::EGW4SensorInfoTranslatedFormatByDatumNumberReadingUnits.875433.2 = STRING: "RH"
|
||||
|
||||
$egw4 = snmpwalk_cache_oid($device, 'EGW4SensorInfoTranslatedFormatEntry', [], $mib);
|
||||
$oids = snmpwalk_cache_twopart_oid($device, 'EGW4SensorInfoTranslatedFormatByDatumNumberEntry', [], $mib);
|
||||
foreach ($oids as $egw4deviceid => $egw4device) {
|
||||
if ($egw4[$egw4deviceid]['EGW4SensorInfoTranslatedFormatSensorDeviceActive'] !== 'Active') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$name = $egw4[$egw4deviceid]['EGW4SensorInfoTranslatedFormatSensorDeviceType'];
|
||||
$egw4count = count($egw4device);
|
||||
foreach ($egw4device as $sensorid => $entry) {
|
||||
//$entry = array_merge($entry, (array)$egw4[$egw4deviceid]);
|
||||
$descr = $name;
|
||||
if ($egw4count > 1) {
|
||||
$descr .= " #$sensorid";
|
||||
}
|
||||
$index = "$egw4deviceid.$sensorid";
|
||||
$oid_name = 'EGW4SensorInfoTranslatedFormatByDatumNumberReadingValue';
|
||||
$oid_num = '.1.3.6.1.4.1.41542.2.2.2.3.'.$index;
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
switch (strtolower($entry['EGW4SensorInfoTranslatedFormatByDatumNumberReadingUnits'])) {
|
||||
case 'deg. c':
|
||||
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, $index, NULL, $descr, 1, $value);
|
||||
break;
|
||||
case 'ph':
|
||||
discover_sensor_ng($device, 'humidity', $mib, $oid_name, $oid_num, $index, NULL, $descr, 1, $value);
|
||||
break;
|
||||
case 'detected':
|
||||
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'EGW4SensorDetected', $descr, $value, [ 'entPhysicalClass' => 'sensor' ]);
|
||||
break;
|
||||
default:
|
||||
print_warning("Unknown sensor Unit: ".$entry['EGW4SensorInfoTranslatedFormatByDatumNumberReadingUnits']);
|
||||
print_debug_vars($egw4[$egw4deviceid]);
|
||||
print_debug_vars($entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// EOF
|
||||
@ -6,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -38,7 +38,7 @@ $scale_current = 0.01;
|
||||
// ENLOGIC-PDU2-MIB::pduUnitConfigAlarmStateChangeDelay.1 = Wrong Type (should be Gauge32 or Unsigned32): INTEGER: 0
|
||||
// ENLOGIC-PDU2-MIB::pduUnitConfigEnabledThresholds.1 = BITS: 00
|
||||
|
||||
$oids = snmpwalk_cache_oid($device, 'pduUnitStatusEntry', array(), $mib);
|
||||
$oids = snmpwalk_cache_oid($device, 'pduUnitStatusEntry', [], $mib);
|
||||
$oids = snmpwalk_cache_oid($device, 'pduUnitConfigLowerCriticalThreshold', $oids, $mib);
|
||||
$oids = snmpwalk_cache_oid($device, 'pduUnitConfigLowerWarningThreshold', $oids, $mib);
|
||||
$oids = snmpwalk_cache_oid($device, 'pduUnitConfigUpperCriticalThreshold', $oids, $mib);
|
||||
@ -46,8 +46,7 @@ $oids = snmpwalk_cache_oid($device, 'pduUnitConfigUpperWarningThreshold', $oids
|
||||
$oids = snmpwalk_cache_oid($device, 'pduUnitConfigEnabledThresholds', $oids, $mib);
|
||||
print_debug_vars($oids);
|
||||
|
||||
foreach ($oids as $index => $entry)
|
||||
{
|
||||
foreach ($oids as $index => $entry) {
|
||||
$name = "Unit $index";
|
||||
|
||||
// pduUnitStatusLoadState
|
||||
@ -68,22 +67,18 @@ foreach ($oids as $index => $entry)
|
||||
// upperWarning (2),
|
||||
// upperCritical (3)
|
||||
// }
|
||||
$options = array();
|
||||
$options = [];
|
||||
$limits_flags = base_convert(str_replace(' ', '', $entry['pduUnitConfigEnabledThresholds']), 16, 10);
|
||||
if (is_flag_set(bindec(10000000), $limits_flags)) // 0b 1000 0000
|
||||
{
|
||||
if (is_flag_set(bindec(10000000), $limits_flags)) { // 0b 1000 0000
|
||||
$options['limit_low'] = $entry['pduUnitConfigLowerCriticalThreshold'] * $scale;
|
||||
}
|
||||
if (is_flag_set(bindec(1000000), $limits_flags)) // 0b 0100 0000
|
||||
{
|
||||
if (is_flag_set(bindec(1000000), $limits_flags)) { // 0b 0100 0000
|
||||
$options['limit_low_warn'] = $entry['pduUnitConfigLowerWarningThreshold'] * $scale;
|
||||
}
|
||||
if (is_flag_set(bindec(100000), $limits_flags)) // 0b 0010 0000
|
||||
{
|
||||
if (is_flag_set(bindec(100000), $limits_flags)) { // 0b 0010 0000
|
||||
$options['limit_high_warn'] = $entry['pduUnitConfigUpperWarningThreshold'] * $scale;
|
||||
}
|
||||
if (is_flag_set(bindec(10000), $limits_flags)) // 0b 0001 0000
|
||||
{
|
||||
if (is_flag_set(bindec(10000), $limits_flags)) { // 0b 0001 0000
|
||||
$options['limit_high'] = $entry['pduUnitConfigUpperCriticalThreshold'] * $scale;
|
||||
}
|
||||
|
||||
@ -110,8 +105,7 @@ foreach ($oids as $index => $entry)
|
||||
$oid_num = ".1.3.6.1.4.1.38446.1.2.4.1.9.$index";
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
if ($value > 0)
|
||||
{
|
||||
if ($value > 0) {
|
||||
discover_counter($device, 'energy', $mib, $oid_name, $oid_num, $index, $descr, 1, $value);
|
||||
}
|
||||
}
|
||||
@ -136,7 +130,7 @@ $units = snmpwalk_cache_oid($device, 'pduUnitPropertiesCircuitBreakerCount',
|
||||
$units = snmpwalk_cache_oid($device, 'pduUnitPropertiesConnExternalSensorCount', $units, $mib); // The current number of external sensors connected to the PDU
|
||||
print_debug_vars($units);
|
||||
|
||||
$oids = snmpwalk_cache_twopart_oid($device, 'pduInputPhaseStatusEntry', array(), $mib);
|
||||
$oids = snmpwalk_cache_twopart_oid($device, 'pduInputPhaseStatusEntry', [], $mib);
|
||||
|
||||
$oids = snmpwalk_cache_twopart_oid($device, 'pduInputPhaseConfigCurrentLowerCriticalThreshold', $oids, $mib);
|
||||
$oids = snmpwalk_cache_twopart_oid($device, 'pduInputPhaseConfigCurrentLowerWarningThreshold', $oids, $mib);
|
||||
@ -151,10 +145,8 @@ $oids = snmpwalk_cache_twopart_oid($device, 'pduInputPhaseConfigVoltageUpperWarn
|
||||
$oids = snmpwalk_cache_twopart_oid($device, 'pduInputPhaseConfigVoltageEnabledThresholds', $oids, $mib);
|
||||
print_debug_vars($oids);
|
||||
|
||||
foreach ($oids as $unit => $entry1)
|
||||
{
|
||||
foreach ($entry1 as $phase => $entry)
|
||||
{
|
||||
foreach ($oids as $unit => $entry1) {
|
||||
foreach ($entry1 as $phase => $entry) {
|
||||
if ($entry['pduInputPhaseStatusCount'] < 1) { continue; } // Skip not exist phases
|
||||
|
||||
$name = "Unit $unit, Phase $phase Input";
|
||||
@ -187,22 +179,18 @@ foreach ($oids as $unit => $entry1)
|
||||
// upperWarning (2),
|
||||
// upperCritical (3)
|
||||
// }
|
||||
$options = array();
|
||||
$options = [];
|
||||
$limits_flags = base_convert(str_replace(' ', '', $entry['pduInputPhaseConfigCurrentEnabledThresholds']), 16, 10);
|
||||
if (is_flag_set(bindec(10000000), $limits_flags)) // 0b 1000 0000
|
||||
{
|
||||
if (is_flag_set(bindec(10000000), $limits_flags)) { // 0b 1000 0000
|
||||
$options['limit_low'] = $entry['pduInputPhaseConfigCurrentLowerCriticalThreshold'] * $scale_current;
|
||||
}
|
||||
if (is_flag_set(bindec(1000000), $limits_flags)) // 0b 0100 0000
|
||||
{
|
||||
if (is_flag_set(bindec(1000000), $limits_flags)) { // 0b 0100 0000
|
||||
$options['limit_low_warn'] = $entry['pduInputPhaseConfigCurrentLowerWarningThreshold'] * $scale_current;
|
||||
}
|
||||
if (is_flag_set(bindec(100000), $limits_flags)) // 0b 0010 0000
|
||||
{
|
||||
if (is_flag_set(bindec(100000), $limits_flags)) { // 0b 0010 0000
|
||||
$options['limit_high_warn'] = $entry['pduInputPhaseConfigCurrentUpperWarningThreshold'] * $scale_current;
|
||||
}
|
||||
if (is_flag_set(bindec(10000), $limits_flags)) // 0b 0001 0000
|
||||
{
|
||||
if (is_flag_set(bindec(10000), $limits_flags)) { // 0b 0001 0000
|
||||
$options['limit_high'] = $entry['pduInputPhaseConfigCurrentUpperCriticalThreshold'] * $scale_current;
|
||||
}
|
||||
|
||||
@ -223,22 +211,18 @@ foreach ($oids as $unit => $entry1)
|
||||
// upperWarning (2),
|
||||
// upperCritical (3)
|
||||
// }
|
||||
$options = array();
|
||||
$options = [];
|
||||
$limits_flags = base_convert(str_replace(' ', '', $entry['pduInputPhaseConfigVoltageEnabledThresholds']), 16, 10);
|
||||
if (is_flag_set(bindec(10000000), $limits_flags)) // 0b 1000 0000
|
||||
{
|
||||
if (is_flag_set(bindec(10000000), $limits_flags)) { // 0b 1000 0000
|
||||
$options['limit_low'] = $entry['pduInputPhaseConfigVoltageLowerCriticalThreshold'] * $scale;
|
||||
}
|
||||
if (is_flag_set(bindec(1000000), $limits_flags)) // 0b 0100 0000
|
||||
{
|
||||
if (is_flag_set(bindec(1000000), $limits_flags)) { // 0b 0100 0000
|
||||
$options['limit_low_warn'] = $entry['pduInputPhaseConfigVoltageLowerWarningThreshold'] * $scale;
|
||||
}
|
||||
if (is_flag_set(bindec(100000), $limits_flags)) // 0b 0010 0000
|
||||
{
|
||||
if (is_flag_set(bindec(100000), $limits_flags)) { // 0b 0010 0000
|
||||
$options['limit_high_warn'] = $entry['pduInputPhaseConfigVoltageUpperWarningThreshold'] * $scale;
|
||||
}
|
||||
if (is_flag_set(bindec(10000), $limits_flags)) // 0b 0001 0000
|
||||
{
|
||||
if (is_flag_set(bindec(10000), $limits_flags)) { // 0b 0001 0000
|
||||
$options['limit_high'] = $entry['pduInputPhaseConfigVoltageUpperCriticalThreshold'] * $scale;
|
||||
}
|
||||
|
||||
@ -279,7 +263,7 @@ foreach ($oids as $unit => $entry1)
|
||||
}
|
||||
}
|
||||
|
||||
$oids = snmpwalk_cache_twopart_oid($device, 'pduCircuitBreakerStatusEntry', array(), $mib);
|
||||
$oids = snmpwalk_cache_twopart_oid($device, 'pduCircuitBreakerStatusEntry', [], $mib);
|
||||
|
||||
$oids = snmpwalk_cache_twopart_oid($device, 'pduCircuitBreakerConfigLowerCriticalThreshold', $oids, $mib);
|
||||
$oids = snmpwalk_cache_twopart_oid($device, 'pduCircuitBreakerConfigLowerWarningThreshold', $oids, $mib);
|
||||
@ -288,10 +272,8 @@ $oids = snmpwalk_cache_twopart_oid($device, 'pduCircuitBreakerConfigUpperWarning
|
||||
$oids = snmpwalk_cache_twopart_oid($device, 'pduCircuitBreakerConfigEnabledThresholds', $oids, $mib);
|
||||
print_debug_vars($oids);
|
||||
|
||||
foreach ($oids as $unit => $entry1)
|
||||
{
|
||||
foreach ($entry1 as $i => $entry)
|
||||
{
|
||||
foreach ($oids as $unit => $entry1) {
|
||||
foreach ($entry1 as $i => $entry) {
|
||||
if ($entry['pduCircuitBreakerStatusCount'] < 1) { continue; } // Skip not exist Circuit Breaker
|
||||
|
||||
$name = "Unit $unit, Circuit Breaker $i";
|
||||
@ -315,22 +297,18 @@ foreach ($oids as $unit => $entry1)
|
||||
// upperWarning (2),
|
||||
// upperCritical (3)
|
||||
// }
|
||||
$options = array();
|
||||
$options = [];
|
||||
$limits_flags = base_convert(str_replace(' ', '', $entry['pduCircuitBreakerConfigEnabledThresholds']), 16, 10);
|
||||
if (is_flag_set(bindec(10000000), $limits_flags)) // 0b 1000 0000
|
||||
{
|
||||
if (is_flag_set(bindec(10000000), $limits_flags)) { // 0b 1000 0000
|
||||
$options['limit_low'] = $entry['pduCircuitBreakerConfigLowerCriticalThreshold'] * $scale_current;
|
||||
}
|
||||
if (is_flag_set(bindec(1000000), $limits_flags)) // 0b 0100 0000
|
||||
{
|
||||
if (is_flag_set(bindec(1000000), $limits_flags)) { // 0b 0100 0000
|
||||
$options['limit_low_warn'] = $entry['pduCircuitBreakerConfigLowerWarningThreshold'] * $scale_current;
|
||||
}
|
||||
if (is_flag_set(bindec(100000), $limits_flags)) // 0b 0010 0000
|
||||
{
|
||||
if (is_flag_set(bindec(100000), $limits_flags)) { // 0b 0010 0000
|
||||
$options['limit_high_warn'] = $entry['pduCircuitBreakerConfigUpperWarningThreshold'] * $scale_current;
|
||||
}
|
||||
if (is_flag_set(bindec(10000), $limits_flags)) // 0b 0001 0000
|
||||
{
|
||||
if (is_flag_set(bindec(10000), $limits_flags)) { // 0b 0001 0000
|
||||
$options['limit_high'] = $entry['pduCircuitBreakerConfigUpperCriticalThreshold'] * $scale_current;
|
||||
}
|
||||
|
||||
@ -347,14 +325,13 @@ foreach ($oids as $unit => $entry1)
|
||||
|
||||
// NOTE, next part not tested, but should be working (mike)
|
||||
$sensors_count = 0;
|
||||
foreach ($units as $entry)
|
||||
{
|
||||
foreach ($units as $entry) {
|
||||
$sensors_count += $entry['pduUnitPropertiesConnExternalSensorCount'];
|
||||
}
|
||||
|
||||
if ($sensors_count == 0) { return; } // Skip next sensors discovery (not exist)
|
||||
|
||||
$oids = snmpwalk_cache_twopart_oid($device, 'pduExternalSensorStatusEntry', array(), $mib);
|
||||
$oids = snmpwalk_cache_twopart_oid($device, 'pduExternalSensorStatusEntry', [], $mib);
|
||||
|
||||
$oids = snmpwalk_cache_twopart_oid($device, 'pduExternalSensorNamePlateType', $oids, $mib);
|
||||
$oids = snmpwalk_cache_twopart_oid($device, 'pduExternalSensorNamePlateUnits', $oids, $mib);
|
||||
@ -366,10 +343,8 @@ $oids = snmpwalk_cache_twopart_oid($device, 'pduExternalSensorConfigUpperWarning
|
||||
$oids = snmpwalk_cache_twopart_oid($device, 'pduExternalSensorConfigEnabledThresholds', $oids, $mib);
|
||||
print_debug_vars($oids);
|
||||
|
||||
foreach ($oids as $unit => $entry1)
|
||||
{
|
||||
foreach ($entry1 as $i => $entry)
|
||||
{
|
||||
foreach ($oids as $unit => $entry1) {
|
||||
foreach ($entry1 as $i => $entry) {
|
||||
if ($entry['pduExternalSensorStatusState'] === 'notPresent') { continue; } // Skip not exist Sensors
|
||||
|
||||
$name = "Unit $unit, Sensor ".$entry['pduExternalSensorStatusName'];
|
||||
@ -394,22 +369,18 @@ foreach ($oids as $unit => $entry1)
|
||||
// upperWarning (2),
|
||||
// upperCritical (3)
|
||||
// }
|
||||
$options = array();
|
||||
$options = [];
|
||||
$limits_flags = base_convert(str_replace(' ', '', $entry['pduExternalSensorConfigEnabledThresholds']), 16, 10);
|
||||
if (is_flag_set(bindec(10000000), $limits_flags)) // 0b 1000 0000
|
||||
{
|
||||
if (is_flag_set(bindec(10000000), $limits_flags)) { // 0b 1000 0000
|
||||
$options['limit_low'] = $entry['pduExternalSensorConfigLowerCriticalThreshold'] * $scale;
|
||||
}
|
||||
if (is_flag_set(bindec(1000000), $limits_flags)) // 0b 0100 0000
|
||||
{
|
||||
if (is_flag_set(bindec(1000000), $limits_flags)) { // 0b 0100 0000
|
||||
$options['limit_low_warn'] = $entry['pduExternalSensorConfigLowerWarningThreshold'] * $scale;
|
||||
}
|
||||
if (is_flag_set(bindec(100000), $limits_flags)) // 0b 0010 0000
|
||||
{
|
||||
if (is_flag_set(bindec(100000), $limits_flags)) { // 0b 0010 0000
|
||||
$options['limit_high_warn'] = $entry['pduExternalSensorConfigUpperWarningThreshold'] * $scale;
|
||||
}
|
||||
if (is_flag_set(bindec(10000), $limits_flags)) // 0b 0001 0000
|
||||
{
|
||||
if (is_flag_set(bindec(10000), $limits_flags)) { // 0b 0001 0000
|
||||
$options['limit_high'] = $entry['pduExternalSensorConfigUpperCriticalThreshold'] * $scale;
|
||||
}
|
||||
|
||||
@ -427,8 +398,7 @@ foreach ($oids as $unit => $entry1)
|
||||
// modbusAdapter (17),
|
||||
// hidAdapter (18)
|
||||
// }
|
||||
switch ($entry['pduExternalSensorNamePlateType'])
|
||||
{
|
||||
switch ($entry['pduExternalSensorNamePlateType']) {
|
||||
case 'temperature':
|
||||
case 'humidity':
|
||||
$sensor_class = $entry['pduExternalSensorNamePlateType'];
|
||||
@ -439,13 +409,11 @@ foreach ($oids as $unit => $entry1)
|
||||
default:
|
||||
continue 2;
|
||||
}
|
||||
if ($entry['pduExternalSensorNamePlateUnits'] === 'degreeF')
|
||||
{
|
||||
if ($entry['pduExternalSensorNamePlateUnits'] === 'degreeF') {
|
||||
$options['sensor_unit'] = 'F';
|
||||
}
|
||||
|
||||
if (isset($entry['pduExternalSensorStatusHighPrecisionValue'])) // && $entry['pduExternalSensorStatusHighPrecisionValue'] > 0)
|
||||
{
|
||||
if (isset($entry['pduExternalSensorStatusHighPrecisionValue'])) { // && $entry['pduExternalSensorStatusHighPrecisionValue'] > 0)
|
||||
$scale = 0.1;
|
||||
$oid_name = 'pduExternalSensorStatusHighPrecisionValue';
|
||||
$oid_num = ".1.3.6.1.4.1.38446.1.6.4.1.8.$index";
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
@ -7,70 +6,199 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2015 Adam Armstrong
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
echo('Caching OIDs: ');
|
||||
$ups_array = array();
|
||||
|
||||
$InputTableCount = snmp_get($device, 'upsESystemInputNumPhases.0', '-OQv', $mib);
|
||||
echo('upsESystemInputTable ('.$InputTableCount.' entries)');
|
||||
$ups_array = snmpwalk_cache_oid($device, 'upsESystemInputTable', $ups_array, $mib);
|
||||
|
||||
$OutputTableCount = snmp_get($device, 'upsESystemOutputNumPhase.0', '-OQv', $mib);
|
||||
echo('upsESystemOutputTable ('.$OutputTableCount.' entries)');
|
||||
$ups_array = snmpwalk_cache_oid($device, 'upsESystemOutputTable', $ups_array, $mib);
|
||||
|
||||
$BypassTableCount = snmp_get($device, 'upsESystemBypassNumPhase.0', '-OQv', $mib);
|
||||
echo('upsESystemBypassTable ('.$BypassTableCount.' entries)');
|
||||
$ups_array = snmpwalk_cache_oid($device, 'upsESystemBypassTable', $ups_array, $mib);
|
||||
|
||||
$scale = 0.1;
|
||||
$nominal = snmp_get($device, 'upsESystemConfigOutputVoltage.0', '-OQv', $mib) * $scale;
|
||||
$voltage_limits = array('limit_high' => ($nominal * 1.03), 'limit_high_warn' => ($nominal * 1.01), 'limit_low' => ($nominal * 0.97), 'limit_low_warn' => ($nominal * 0.99));
|
||||
|
||||
# Input Sensors
|
||||
for ($index = 1; $index <= $InputTableCount; $index++)
|
||||
{
|
||||
$data = $ups_array[$index];
|
||||
|
||||
$descr = 'Input';
|
||||
$oid = '.1.3.6.1.4.1.935.10.1.1.2.16.1.3.'.$index; # EPPC-MIB:upsESystemInputVoltage.$index
|
||||
$value = $data['upsESystemInputVoltage'];
|
||||
discover_sensor('voltage', $device, $oid, "upsESystemInputVoltage.$index", 'eppc-mib', $descr, 0.1, $value, $voltage_limits);
|
||||
// EPPC-MIB::upsESystemConfigInputVoltage.0 = INTEGER: 2300
|
||||
// EPPC-MIB::upsESystemConfigInputFrequence.0 = INTEGER: 500
|
||||
// EPPC-MIB::upsESystemInputSourceNum.0 = INTEGER: 1
|
||||
// EPPC-MIB::upsESystemInputLineBads.0 = Counter32: 0
|
||||
// EPPC-MIB::upsESystemInputNumPhases.0 = INTEGER: 1
|
||||
// EPPC-MIB::upsESystemInputFrequency.1 = INTEGER: 500
|
||||
// EPPC-MIB::upsESystemInputVoltage.1 = INTEGER: 2301
|
||||
// EPPC-MIB::upsESystemInputCurrent.1 = INTEGER: -1
|
||||
// EPPC-MIB::upsESystemInputWatts.1 = INTEGER: -1
|
||||
$input_phases = snmp_get_oid($device, 'upsESystemInputNumPhases.0', $mib);
|
||||
if ($input_phases > 0) {
|
||||
echo('upsESystemInputTable ('.$input_phases.' phases)');
|
||||
|
||||
$descr = "Input";
|
||||
$oid = ".1.3.6.1.4.1.935.10.1.1.2.16.1.2.".$index; # EPPC-MIB:upsESystemInputFrequency.$index
|
||||
$value = $data['upsESystemInputFrequency'];
|
||||
$limits = array('limit_high' => 55, 'limit_high_warn' => 51, 'limit_low' => 45, 'limit_low_warn' => 49);
|
||||
discover_sensor('frequency', $device, $oid, "upsESystemInputFrequency.$index", 'eppc-mib', $descr, 0.1, $value, $limits);
|
||||
$scale = 0.1;
|
||||
$ups_array = snmpwalk_cache_oid($device, 'upsESystemInputTable', [], $mib);
|
||||
$input_voltage = snmp_get_oid($device, 'upsESystemConfigInputVoltage.0', $mib) * $scale;
|
||||
if ($input_voltage > 0) {
|
||||
$voltage_limits = [
|
||||
'limit_high' => $input_voltage * 1.03, 'limit_high_warn' => $input_voltage * 1.01,
|
||||
'limit_low' => $input_voltage * 0.97, 'limit_low_warn' => $input_voltage * 0.99
|
||||
];
|
||||
} else {
|
||||
$voltage_limits = [];
|
||||
}
|
||||
$input_frequency = snmp_get_oid($device, 'upsESystemConfigInputFrequence.0', $mib) * $scale;
|
||||
if ($input_frequency > 0) {
|
||||
$frequency_limits = [
|
||||
'limit_high' => $input_frequency * 1.10, 'limit_high_warn' => $input_frequency * 1.02,
|
||||
'limit_low' => $input_frequency * 0.90, 'limit_low_warn' => $input_frequency * 0.98
|
||||
];
|
||||
} else {
|
||||
$frequency_limits = [];
|
||||
}
|
||||
|
||||
foreach ($ups_array as $phase => $entry) {
|
||||
$descr = 'Input';
|
||||
if ($input_phases > 1) {
|
||||
$descr .= ' (Phase '.$phase.')';
|
||||
}
|
||||
|
||||
$oid_name = 'upsESystemInputVoltage';
|
||||
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.16.1.3.'.$phase;
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
$options = $voltage_limits;
|
||||
$options['rename_rrd'] = "eppc-mib-upsESystemInputVoltage.%index%";
|
||||
//discover_sensor('voltage', $device, $oid, "upsESystemInputVoltage.$index", 'eppc-mib', $descr, 0.1, $value, $voltage_limits);
|
||||
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid_num, $phase, NULL, $descr, $scale, $value, $options);
|
||||
|
||||
$oid_name = 'upsESystemInputFrequency';
|
||||
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.16.1.2.'.$phase;
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
$options = $frequency_limits;
|
||||
$options['rename_rrd'] = "eppc-mib-upsESystemInputFrequency.%index%";
|
||||
//discover_sensor('frequency', $device, $oid, "upsESystemInputFrequency.$index", 'eppc-mib', $descr, 0.1, $value, $limits);
|
||||
discover_sensor_ng($device, 'frequency', $mib, $oid_name, $oid_num, $phase, NULL, $descr, $scale, $value, $options);
|
||||
|
||||
if ($entry['upsESystemInputCurrent'] > 0) {
|
||||
$oid_name = 'upsESystemInputCurrent';
|
||||
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.16.1.4.'.$phase;
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid_num, $phase, NULL, $descr, $scale, $value);
|
||||
}
|
||||
|
||||
if ($entry['upsESystemInputWatts'] > 0) {
|
||||
$oid_name = 'upsESystemInputWatts';
|
||||
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.16.1.5.'.$phase;
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $phase, NULL, $descr, 1, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Output Sensors
|
||||
for ($index = 1; $index <= $InputTableCount; $index++)
|
||||
{
|
||||
$data = $ups_array[$index];
|
||||
// EPPC-MIB::upsESystemConfigOutputVoltage.0 = INTEGER: -1
|
||||
// EPPC-MIB::upsESystemConfigOutputFrequency.0 = INTEGER: -1
|
||||
// EPPC-MIB::upsESystemConfigOutputVA.0 = INTEGER: -1
|
||||
// EPPC-MIB::upsESystemConfigOutputPower.0 = INTEGER: -1
|
||||
// EPPC-MIB::upsESystemConfigOutputLoadHighSetPoint.0 = INTEGER: 90
|
||||
// EPPC-MIB::upsESystemOutputNumPhase.0 = INTEGER: 1
|
||||
// EPPC-MIB::upsESystemOutputFrequency.1 = INTEGER: 500
|
||||
// EPPC-MIB::upsESystemOutputVoltage.1 = INTEGER: 2299
|
||||
// EPPC-MIB::upsESystemOutputCurrent.1 = INTEGER: 64
|
||||
// EPPC-MIB::upsESystemOutputWatts.1 = INTEGER: 1300
|
||||
// EPPC-MIB::upsESystemOutputVA.1 = INTEGER: 1400
|
||||
// EPPC-MIB::upsESystemOutputLoad.1 = INTEGER: 24
|
||||
|
||||
$descr = "Output";
|
||||
$oid = ".1.3.6.1.4.1.935.10.1.1.2.18.1.3.$index"; # EPPC-MIB:upsESystemOutputVoltage.$index
|
||||
$value = $data['upsESystemOutputVoltage'];
|
||||
discover_sensor('voltage', $device, $oid, "upsESystemOutputVoltage.$index", 'eppc-mib', $descr, 0.1, $value, $voltage_limits);
|
||||
$output_phases = snmp_get_oid($device, 'upsESystemOutputNumPhase.0', $mib);
|
||||
if ($output_phases > 0) {
|
||||
echo('upsESystemOutputTable (' . $output_phases . ' phases)');
|
||||
|
||||
$descr = "Output";
|
||||
$oid = ".1.3.6.1.4.1.935.10.1.1.2.18.1.2.$index"; # EPPC-MIB:upsESystemOutputFrequency.$index
|
||||
$value = $data['upsESystemOutputFrequency'];
|
||||
$limits = array('limit_high' => 55, 'limit_high_warn' => 51, 'limit_low' => 45, 'limit_low_warn' => 49); // FIXME orly? 50Hz only?
|
||||
discover_sensor('frequency', $device, $oid, "upsESystemOutputFrequency.$index", 'eppc-mib', $descr, 0.1, $value, $limits);
|
||||
$scale = 0.1;
|
||||
$ups_array = snmpwalk_cache_oid($device, 'upsESystemOutputTable', [], $mib);
|
||||
|
||||
$descr = "Output";
|
||||
$oid = ".1.3.6.1.4.1.935.10.1.1.2.18.1.7.$index"; # EPPC-MIB:upsESystemOutputLoad.$index
|
||||
$value = $data['upsESystemOutputLoad'];
|
||||
$limits = array('limit_high' => 100, 'limit_high_warn' => 75, 'limit_low' => 0);
|
||||
discover_sensor('load', $device, $oid, "upsESystemOutputLoad.$index", 'eppc-mib', $descr, 1, $value, $limits);
|
||||
$output_voltage = snmp_get_oid($device, 'upsESystemConfigOutputVoltage.0', $mib) * $scale;
|
||||
if ($output_voltage > 0) {
|
||||
$voltage_limits = [
|
||||
'limit_high' => $output_voltage * 1.03, 'limit_high_warn' => $output_voltage * 1.01,
|
||||
'limit_low' => $output_voltage * 0.97, 'limit_low_warn' => $output_voltage * 0.99
|
||||
];
|
||||
} else {
|
||||
// Keep input voltage limits
|
||||
//$voltage_limits = [];
|
||||
}
|
||||
|
||||
$output_frequency = snmp_get_oid($device, 'upsESystemConfigOutputFrequency.0', $mib) * $scale;
|
||||
if ($output_frequency > 0) {
|
||||
$frequency_limits = [
|
||||
'limit_high' => $output_frequency * 1.10, 'limit_high_warn' => $output_frequency * 1.02,
|
||||
'limit_low' => $output_frequency * 0.90, 'limit_low_warn' => $output_frequency * 0.98
|
||||
];
|
||||
} else {
|
||||
// Keep input frequency limits
|
||||
//$frequency_limits = [];
|
||||
}
|
||||
|
||||
foreach ($ups_array as $phase => $entry) {
|
||||
$descr = 'Output';
|
||||
if ($input_phases > 1) {
|
||||
$descr .= ' (Phase ' . $phase . ')';
|
||||
}
|
||||
|
||||
$oid_name = 'upsESystemOutputVoltage';
|
||||
$oid_num = ".1.3.6.1.4.1.935.10.1.1.2.18.1.3.$index";
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
$options = $voltage_limits;
|
||||
$options['rename_rrd'] = "eppc-mib-upsESystemOutputVoltage.%index%";
|
||||
//discover_sensor('voltage', $device, $oid, "upsESystemOutputVoltage.$index", 'eppc-mib', $descr, 0.1, $value, $voltage_limits);
|
||||
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid_num, $phase, NULL, $descr, $scale, $value, $options);
|
||||
|
||||
$oid_name = 'upsESystemOutputFrequency';
|
||||
$oid_num = ".1.3.6.1.4.1.935.10.1.1.2.18.1.2.$index";
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
$options = $frequency_limits;
|
||||
$options['rename_rrd'] = "eppc-mib-upsESystemOutputFrequency.%index%";
|
||||
//discover_sensor('frequency', $device, $oid, "upsESystemOutputFrequency.$index", 'eppc-mib', $descr, 0.1, $value, $limits);
|
||||
discover_sensor_ng($device, 'frequency', $mib, $oid_name, $oid_num, $phase, NULL, $descr, $scale, $value, $options);
|
||||
|
||||
$oid_name = 'upsESystemOutputLoad';
|
||||
$oid_num = ".1.3.6.1.4.1.935.10.1.1.2.18.1.7.$index";
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
$options = [ 'limit_high' => 90, 'limit_high_warn' => 75 ];
|
||||
$options['rename_rrd'] = "eppc-mib-upsESystemOutputLoad.%index%";
|
||||
//discover_sensor('load', $device, $oid, "upsESystemOutputLoad.$index", 'eppc-mib', $descr, 1, $value, $limits);
|
||||
discover_sensor_ng($device, 'load', $mib, $oid_name, $oid_num, $phase, NULL, $descr, 1, $value, $options);
|
||||
|
||||
if ($entry['upsESystemOutputCurrent'] > 0) {
|
||||
$oid_name = 'upsESystemOutputCurrent';
|
||||
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.18.1.4.'.$phase;
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid_num, $phase, NULL, $descr, $scale, $value);
|
||||
}
|
||||
|
||||
if ($entry['upsESystemOutputWatts'] > 0) {
|
||||
$oid_name = 'upsESystemOutputWatts';
|
||||
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.18.1.5.'.$phase;
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $phase, NULL, $descr, 1, $value);
|
||||
}
|
||||
|
||||
if ($entry['upsESystemOutputVA'] > 0) {
|
||||
$oid_name = 'upsESystemOutputVA';
|
||||
$oid_num = '.1.3.6.1.4.1.935.10.1.1.2.18.1.6.'.$phase;
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
discover_sensor_ng($device, 'apower', $mib, $oid_name, $oid_num, $phase, NULL, $descr, 1, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME Sensors below are a definite candidate for definition-based discovery
|
||||
# bypass sensors
|
||||
// EPPC-MIB::upsESystemBypassNumPhase.0 = INTEGER: -1
|
||||
$bypass_phases = snmp_get_oid($device, 'upsESystemBypassNumPhase.0', $mib);
|
||||
if ($bypass_phases > 0) {
|
||||
echo('upsESystemBypassTable (' . $bypass_phases . ' phases)');
|
||||
$ups_array = snmpwalk_cache_oid($device, 'upsESystemBypassTable', [], $mib);
|
||||
}
|
||||
|
||||
/* FIXME Sensors below are a definite candidate for definition-based discovery
|
||||
|
||||
$descr = 'Charge Remaining';
|
||||
$oid = '.1.3.6.1.4.1.935.10.1.1.3.4.0'; # EPPC-MIB:upsEBatteryEstimatedChargeRemaining
|
||||
@ -96,7 +224,7 @@ $high = snmp_get($device, 'upsEEnvironmentTemperatureHighSetPoint.0', '-OQv',
|
||||
$low = snmp_get($device, 'upsEEnvironmentTemperatureLowSetPoint.0', '-OQv', $mib);
|
||||
$limits = array('limit_high' => $high * $scale, 'limit_high_warn' => ($high * $scale) * .75, 'limit_low' => $low * $scale);
|
||||
discover_sensor('temperature', $device, $oid, 'upsESystemTemperature', 'eppc-mib', $descr, $scale, $value, $limits); // FIXME should be upsESystemTemperature.0
|
||||
|
||||
*/
|
||||
unset($limits, $ups_array);
|
||||
|
||||
// EOF
|
||||
|
||||
@ -6,18 +6,17 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
// Currently not possible convert to definitions because type detection is hard, based on descriptions
|
||||
// SAME code in ATEN-IPMI-MIB
|
||||
|
||||
$oids = snmpwalk_multipart_oid($device, "fgHwSensorTable", array(), "FORTINET-FORTIGATE-MIB");
|
||||
$oids = snmpwalk_multipart_oid($device, "fgHwSensorTable", [], "FORTINET-FORTIGATE-MIB");
|
||||
print_debug_vars($oids);
|
||||
|
||||
foreach ($oids as $index => $entry)
|
||||
{
|
||||
foreach ($oids as $index => $entry) {
|
||||
$descr = $entry['fgHwSensorEntName'];
|
||||
|
||||
$oid_name = 'fgHwSensorEntValue';
|
||||
@ -25,6 +24,8 @@ foreach ($oids as $index => $entry)
|
||||
$scale = 1;
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
if (empty($descr) && $value == 0) { continue; }
|
||||
|
||||
// Detect class based on descr anv value (this is derp, table not have other data for detect class
|
||||
if (str_iends($descr, ' Temp')) {
|
||||
if ($value == 0) { continue; }
|
||||
@ -58,7 +59,10 @@ foreach ($oids as $index => $entry)
|
||||
$class = 'temperature';
|
||||
}
|
||||
|
||||
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value);
|
||||
discover_status_ng($device, $mib, `fgHwSensorEntAlarmStatus`, '.1.3.6.1.4.1.12356.101.4.3.2.1.4.'.$index, $index,
|
||||
'fgHwSensorEntAlarmStatus', $descr, $entry['fgHwSensorEntAlarmStatus']);
|
||||
|
||||
discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value);
|
||||
}
|
||||
|
||||
// EOF
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -105,6 +105,7 @@ $entity_array = [];
|
||||
*/
|
||||
$power_class = 'power';
|
||||
$power_scale = 0.000001;
|
||||
$power_scale_multi = 0.01;
|
||||
foreach (snmpwalk_cache_oid($device, 'hwEntityOpticalTemperature', [], 'HUAWEI-ENTITY-EXTENT-MIB') as $index => $entry) {
|
||||
// Ignore optical sensors with temperature of zero or negative
|
||||
if ($entry['hwEntityOpticalTemperature'] > 1) {
|
||||
@ -223,25 +224,40 @@ foreach ($entity_array as $index => $entry) {
|
||||
}
|
||||
|
||||
if ($multilane) {
|
||||
// Fix incorrect Power scale.. again
|
||||
// See: https://jira.observium.org/browse/OBS-4148
|
||||
/*
|
||||
hwEntityOpticalRxPower.16850463 = -121
|
||||
hwEntityOpticalRxHighThreshold.16850463 = 400
|
||||
hwEntityOpticalRxHighWarnThreshold.16850463 = No Such Object available on this agent at this OID
|
||||
hwEntityOpticalRxLowThreshold.16850463 = -1801
|
||||
hwEntityOpticalRxLowWarnThreshold.16850463 = No Such Object available on this agent at this OID
|
||||
hwEntityOpticalLaneRxPower.16850463 = -1.21,-1.51,-1.83,-2.18
|
||||
*/
|
||||
list($lane1_rxpower) = explode(',', $entry['hwEntityOpticalLaneRxPower']);
|
||||
if (($entry['hwEntityOpticalRxPower'] != -1) && float_cmp($entry['hwEntityOpticalRxPower'] * 0.01, $lane1_rxpower, 0.01) === 0) {
|
||||
$power_scale_multi = 1;
|
||||
}
|
||||
|
||||
$rxoptions['sensor_unit'] = 'split1';
|
||||
$lane_descr = $entry['ifDescr'] . ' Lane 1 Rx Power' . $trans;
|
||||
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneRxPower', $lane_oid, $index, NULL, $lane_descr, 0.01, $entry['hwEntityOpticalLaneRxPower'], $rxoptions);
|
||||
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneRxPower', $lane_oid, $index, NULL, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneRxPower'], $rxoptions);
|
||||
|
||||
$rxoptions['sensor_unit'] = 'split2';
|
||||
$lane_descr = $entry['ifDescr'] . ' Lane 2 Rx Power' . $trans;
|
||||
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneRxPower', $lane_oid, $index, NULL, $lane_descr, 0.01, $entry['hwEntityOpticalLaneRxPower'], $rxoptions);
|
||||
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneRxPower', $lane_oid, $index, NULL, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneRxPower'], $rxoptions);
|
||||
|
||||
$rxoptions['sensor_unit'] = 'split3';
|
||||
$lane_descr = $entry['ifDescr'] . ' Lane 3 Rx Power' . $trans;
|
||||
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneRxPower', $lane_oid, $index, NULL, $lane_descr, 0.01, $entry['hwEntityOpticalLaneRxPower'], $rxoptions);
|
||||
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneRxPower', $lane_oid, $index, NULL, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneRxPower'], $rxoptions);
|
||||
|
||||
$rxoptions['sensor_unit'] = 'split4';
|
||||
$lane_descr = $entry['ifDescr'] . ' Lane 4 Rx Power' . $trans;
|
||||
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneRxPower', $lane_oid, $index, NULL, $lane_descr, 0.01, $entry['hwEntityOpticalLaneRxPower'], $rxoptions);
|
||||
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneRxPower', $lane_oid, $index, NULL, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneRxPower'], $rxoptions);
|
||||
} else {
|
||||
$rxoptions['rename_rrd'] = "HUAWEI-ENTITY-EXTENT-MIB-hwEntityOpticalRxPower-$index";
|
||||
$lane_descr = $entry['ifDescr'] . ' Rx Power' . $trans;
|
||||
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneRxPower', $lane_oid, $index, NULL, $lane_descr, 0.01, $entry['hwEntityOpticalLaneRxPower'], $rxoptions);
|
||||
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneRxPower', $lane_oid, $index, NULL, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneRxPower'], $rxoptions);
|
||||
}
|
||||
} elseif ($entry['hwEntityOpticalRxPower'] != -1) {
|
||||
// Huawei does not follow their own MIB for some devices and instead reports Rx/Tx Power as dBm converted to mW then multiplied by 1000
|
||||
@ -275,21 +291,36 @@ foreach ($entity_array as $index => $entry) {
|
||||
}
|
||||
|
||||
if ($multilane) {
|
||||
// Fix incorrect Power scale.. again
|
||||
// See: https://jira.observium.org/browse/OBS-4148
|
||||
/*
|
||||
hwEntityOpticalTxPower.16850463 = -25
|
||||
hwEntityOpticalTxHighThreshold.16850463 = 400
|
||||
hwEntityOpticalTxHighWarnThreshold.16850463 = No Such Object available on this agent at this OID
|
||||
hwEntityOpticalTxLowThreshold.16850463 = -1060
|
||||
hwEntityOpticalTxLowWarnThreshold.16850463 = No Such Object available on this agent at this OID
|
||||
hwEntityOpticalLaneTxPower.16850463 = -0.25,-0.26,-0.26,-0.23
|
||||
*/
|
||||
list($lane1_txpower) = explode(',', $entry['hwEntityOpticalLaneTxPower']);
|
||||
if (($entry['hwEntityOpticalTxPower'] != -1) && float_cmp($entry['hwEntityOpticalTxPower'] * 0.01, $lane1_txpower, 0.01) === 0) {
|
||||
$power_scale_multi = 1;
|
||||
}
|
||||
|
||||
$txoptions['sensor_unit'] = 'split1';
|
||||
$lane_descr = $entry['ifDescr'] . ' Lane 1 Tx Power' . $trans;
|
||||
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneTxPower', $lane_oid, $index, NULL, $lane_descr, 0.01, $entry['hwEntityOpticalLaneTxPower'], $txoptions);
|
||||
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneTxPower', $lane_oid, $index, NULL, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneTxPower'], $txoptions);
|
||||
|
||||
$txoptions['sensor_unit'] = 'split2';
|
||||
$lane_descr = $entry['ifDescr'] . ' Lane 2 Tx Power' . $trans;
|
||||
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneTxPower', $lane_oid, $index, NULL, $lane_descr, 0.01, $entry['hwEntityOpticalLaneTxPower'], $txoptions);
|
||||
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneTxPower', $lane_oid, $index, NULL, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneTxPower'], $txoptions);
|
||||
|
||||
$txoptions['sensor_unit'] = 'split3';
|
||||
$lane_descr = $entry['ifDescr'] . ' Lane 3 Tx Power' . $trans;
|
||||
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneTxPower', $lane_oid, $index, NULL, $lane_descr, 0.01, $entry['hwEntityOpticalLaneTxPower'], $txoptions);
|
||||
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneTxPower', $lane_oid, $index, NULL, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneTxPower'], $txoptions);
|
||||
|
||||
$txoptions['sensor_unit'] = 'split4';
|
||||
$lane_descr = $entry['ifDescr'] . ' Lane 4 Tx Power' . $trans;
|
||||
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneTxPower', $lane_oid, $index, NULL, $lane_descr, 0.01, $entry['hwEntityOpticalLaneTxPower'], $txoptions);
|
||||
discover_sensor_ng($device, 'dbm', $mib, 'hwEntityOpticalLaneTxPower', $lane_oid, $index, NULL, $lane_descr, $power_scale_multi, $entry['hwEntityOpticalLaneTxPower'], $txoptions);
|
||||
} else {
|
||||
$txoptions['rename_rrd'] = "HUAWEI-ENTITY-EXTENT-MIB-hwEntityOpticalTxPower-$index";
|
||||
$lane_descr = $entry['ifDescr'] . ' Tx Power' . $trans;
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
@ -7,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -19,7 +18,7 @@
|
||||
//POWER-ETHERNET-MIB::pethMainPseConsumptionPower.10 = Gauge32: 0 Watts
|
||||
//POWER-ETHERNET-MIB::pethMainPseConsumptionPower.11 = Gauge32: 1 Watts
|
||||
|
||||
$oids = snmpwalk_cache_oid($device, 'pethMainPseTable', array(), 'POWER-ETHERNET-MIB');
|
||||
$oids = snmpwalk_cache_oid($device, 'pethMainPseTable', [], 'POWER-ETHERNET-MIB');
|
||||
|
||||
//NETONIX-SWITCH-MIB::poeStatus.10 = STRING: Off
|
||||
//NETONIX-SWITCH-MIB::poeStatus.11 = STRING: 48V
|
||||
@ -30,14 +29,12 @@ print_debug_vars($oids);
|
||||
|
||||
////// Per-port Statistics
|
||||
|
||||
foreach ($oids as $index => $entry)
|
||||
{
|
||||
$options = array('entPhysicalIndex' => $index);
|
||||
foreach ($oids as $index => $entry) {
|
||||
$options = [ 'entPhysicalIndex' => $index ];
|
||||
$port = get_port_by_ifIndex($device['device_id'], $index);
|
||||
// print_vars($port);
|
||||
|
||||
if (is_array($port))
|
||||
{
|
||||
if (is_array($port)) {
|
||||
$entry['ifDescr'] = $port['port_label'];
|
||||
$options['measured_class'] = 'port';
|
||||
$options['measured_entity'] = $port['port_id'];
|
||||
@ -55,8 +52,7 @@ foreach ($oids as $index => $entry)
|
||||
|
||||
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, $options);
|
||||
|
||||
if ($entry['pethMainPseOperStatus'] != 'off')
|
||||
{
|
||||
if ($entry['pethMainPseOperStatus'] != 'off') {
|
||||
$descr = $entry['ifDescr'] . ' PoE Power';
|
||||
|
||||
$oid_name = 'pethMainPseConsumptionPower';
|
||||
|
||||
@ -1407,7 +1407,7 @@ foreach ($cache['apc'] as $index => $entry)
|
||||
$descr = $entry['uioSensorStatusSensorName'];
|
||||
|
||||
$status = $entry['uioSensorStatusCommStatus'];
|
||||
if ($status != 'commsOK') { continue; } // Skip unconnected sensors entirely
|
||||
if ($status !== 'commsOK') { continue; } // Skip unconnected sensors entirely
|
||||
|
||||
// Humidity
|
||||
$value = $entry['uioSensorStatusHumidity'];
|
||||
@ -1417,7 +1417,7 @@ foreach ($cache['apc'] as $index => $entry)
|
||||
if ($value != '' && $value > 0) // Humidity = 0 or -1 -> Sensor not available
|
||||
{
|
||||
// Skip if already discovered through iem
|
||||
if (!in_array($descr, $iem_sensors['humidity']))
|
||||
if (!in_array($descr, (array)$iem_sensors['humidity']))
|
||||
{
|
||||
//discover_sensor('humidity', $device, $oid, "uioSensorStatusHumidity.$index", 'apc', $descr, 1, $value);
|
||||
$options = [ 'rename_rrd' => 'apc-uioSensorStatusHumidity.%index%' ];
|
||||
@ -1435,7 +1435,7 @@ foreach ($cache['apc'] as $index => $entry)
|
||||
if ($value != '' && $value != -1) // Temperature = -1 -> Sensor not available
|
||||
{
|
||||
// Skip if already discovered through iem
|
||||
if (!in_array($descr, $iem_sensors['temperature']))
|
||||
if (!in_array($descr, (array)$iem_sensors['temperature']))
|
||||
{
|
||||
//discover_sensor('temperature', $device, $oid, "uioSensorStatusTemperatureDegC.$index", 'apc', $descr, 1, $value);
|
||||
$options = [ 'rename_rrd' => 'apc-uioSensorStatusTemperatureDegC.%index%' ];
|
||||
|
||||
215
includes/discovery/sensors/pwtv1-mib.inc.php
Normal file
215
includes/discovery/sensors/pwtv1-mib.inc.php
Normal file
@ -0,0 +1,215 @@
|
||||
<?php
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
// Inlets
|
||||
// PWTv1-MIB::pduPwrMonitoringInletNum.0 = INTEGER: 1
|
||||
// PWTv1-MIB::inletIndex.1 = INTEGER: 0
|
||||
// PWTv1-MIB::inletPowerAll.1 = INTEGER: 11114 0.1W
|
||||
// PWTv1-MIB::inletResetFrom.1 = STRING: "07/02/2022 15:40:15"
|
||||
// PWTv1-MIB::inletEnergy.1 = INTEGER: 10526559 KWh
|
||||
// PWTv1-MIB::inletStatus.1 = INTEGER: normal(1)
|
||||
// PWTv1-MIB::inletCurrPhase1.1 = INTEGER: 526 0.01A
|
||||
// PWTv1-MIB::inletCurrPhase2.1 = INTEGER: 0 0.01A
|
||||
// PWTv1-MIB::inletCurrPhase3.1 = INTEGER: 0 0.01A
|
||||
// PWTv1-MIB::inletVoltPhase1.1 = INTEGER: 2291 0.1V
|
||||
// PWTv1-MIB::inletVoltPhase2.1 = INTEGER: 0 0.1V
|
||||
// PWTv1-MIB::inletVoltPhase3.1 = INTEGER: 0 0.1V
|
||||
// PWTv1-MIB::inletPowerPhase1.1 = INTEGER: 11114 0.1W
|
||||
// PWTv1-MIB::inletPowerPhase2.1 = INTEGER: 0 0.1W
|
||||
// PWTv1-MIB::inletPowerPhase3.1 = INTEGER: 0 0.1W
|
||||
|
||||
$inlet_count = snmp_get_oid($device, 'pduPwrMonitoringInletNum.0', 'PWTv1-MIB');
|
||||
|
||||
$oids = snmpwalk_cache_oid($device, 'pduPwrMonitoringInletStatusTable', [], 'PWTv1-MIB');
|
||||
$oids = snmpwalk_cache_oid($device, 'pduPwrMonitoringInletCfgTable', $oids, 'PWTv1-MIB');
|
||||
foreach ($oids as $index => $entry) {
|
||||
// PDU reports all inlets as "normal" status, but really only as in count
|
||||
if ($index > $inlet_count) { break; }
|
||||
|
||||
$name = $inlet_count > 1 ? " #$index" : '';
|
||||
|
||||
$descr = "Inlet Total".$name;
|
||||
$oid_num = ".1.3.6.1.4.1.42610.1.4.4.1.6.1.2.1.2.$index";
|
||||
$oid_name = 'inletPowerAll';
|
||||
$value = $entry[$oid_name];
|
||||
$scale = 0.1;
|
||||
$options = [
|
||||
'limit_high' => $entry['inletCfgLoadCritical'] * 1000 * $scale,
|
||||
'limit_high_warn' => $entry['inletCfgLoadWarning'] * 1000 * $scale
|
||||
];
|
||||
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
|
||||
|
||||
$descr = "Inlet Total".$name;
|
||||
$oid_num = ".1.3.6.1.4.1.42610.1.4.4.1.6.1.2.1.4.$index";
|
||||
$oid_name = 'inletEnergy';
|
||||
$value = $entry[$oid_name];
|
||||
$scale = 1000;
|
||||
$options = [];
|
||||
discover_counter($device, 'energy', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
|
||||
|
||||
$descr = "Inlet".$name;
|
||||
$oid_num = ".1.3.6.1.4.1.42610.1.4.4.1.6.1.2.1.5.$index";
|
||||
$oid_name = 'inletStatus';
|
||||
$value = $entry[$oid_name];
|
||||
$options = [];
|
||||
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'inletStatus', $descr, $value, $options);
|
||||
|
||||
$phase_count = ($entry['inletVoltPhase2'] > 0) || ($entry['inletVoltPhase3'] > 0) ? 3 : 1;
|
||||
|
||||
for ($phase = 1; $phase <= $phase_count; $phase++) {
|
||||
$phase_name = $phase_count > 1 ? " (Phase $phase)" : '';
|
||||
|
||||
$descr = "Inlet".$name.$phase_name;
|
||||
$oid_name = 'inletCurrPhase'.$phase;
|
||||
$oid_num = snmp_translate($oid_name, $mib).".$index";
|
||||
$value = $entry[$oid_name];
|
||||
$scale = 0.1;
|
||||
$options = [
|
||||
'limit_high' => $entry['inletCfgTotalCurrCritPhase'.$phase] * $scale,
|
||||
'limit_high_warn' => $entry['inletCfgTotalCurrWarnPhase'.$phase] * $scale
|
||||
];
|
||||
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
|
||||
|
||||
$descr = "Inlet".$name.$phase_name;
|
||||
$oid_name = 'inletVoltPhase'.$phase;
|
||||
$oid_num = snmp_translate($oid_name, $mib).".$index";
|
||||
$value = $entry[$oid_name];
|
||||
$scale = 0.1;
|
||||
$options = [
|
||||
'limit_high' => $entry['inletCfgVoltCritPhase'.$phase] * $scale,
|
||||
'limit_high_warn' => $entry['inletCfgVoltWarnPhase'.$phase] * $scale
|
||||
];
|
||||
discover_sensor_ng($device, 'voltage', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
|
||||
|
||||
$descr = "Inlet".$name.$phase_name;
|
||||
$oid_name = 'inletFreqPhase'.$phase;
|
||||
$oid_num = snmp_translate($oid_name, $mib).".$index";
|
||||
$value = $entry[$oid_name];
|
||||
$scale = 0.01;
|
||||
$options = [];
|
||||
discover_sensor_ng($device, 'frequency', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
|
||||
|
||||
if ($phase_count > 1) {
|
||||
// Three Phase
|
||||
$descr = "Inlet".$name.$phase_name;
|
||||
$oid_name = 'inletPowerPhase'.$phase;
|
||||
$oid_num = snmp_translate($oid_name, $mib).".$index";
|
||||
$value = $entry[$oid_name];
|
||||
$scale = 0.1;
|
||||
$options = [];
|
||||
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
|
||||
|
||||
$descr = "Inlet".$name.$phase_name;
|
||||
$oid_name = 'inletStatusPhase'.$phase;
|
||||
$oid_num = snmp_translate($oid_name, $mib).".$index";
|
||||
$value = $entry[$oid_name];
|
||||
$options = [];
|
||||
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'inletStatus', $descr, $value, $options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Outlets
|
||||
// PWTv1-MIB::pduPwrMonitoringOutletNumPduA.0 = INTEGER: 0
|
||||
// PWTv1-MIB::pduPwrMonitoringOutletNumPduB.0 = INTEGER: 0
|
||||
// PWTv1-MIB::pduPwrMonitoringOutletNumPduC.0 = INTEGER: 0
|
||||
// PWTv1-MIB::pduPwrMonitoringOutletNumPduD.0 = INTEGER: 0
|
||||
// PWTv1-MIB::pduPwrMonitoringOutletNumPduE.0 = INTEGER: 0
|
||||
// PWTv1-MIB::pduPwrMonitoringOutletNumPduF.0 = INTEGER: 0
|
||||
// PWTv1-MIB::pduPwrMonitoringOutletNumPduG.0 = INTEGER: 0
|
||||
// PWTv1-MIB::pduPwrMonitoringOutletNumPduH.0 = INTEGER: 0
|
||||
|
||||
// PWTv1-MIB::outletPduAIndex.11 = INTEGER: 10
|
||||
// PWTv1-MIB::outletPduAState.11 = INTEGER: off(1)
|
||||
// PWTv1-MIB::outletPduACurrent.11 = INTEGER: 0 0.01A
|
||||
// PWTv1-MIB::outletPduAPwrFactor.11 = INTEGER: 0 0.1%
|
||||
// PWTv1-MIB::outletPduAPower.11 = INTEGER: 0 0.1W
|
||||
// PWTv1-MIB::outletPduAEnergy.11 = INTEGER: 0 KWh
|
||||
// PWTv1-MIB::outletPduAResetFrom.11 = STRING: "07/02/2022 15:40:15"
|
||||
// PWTv1-MIB::outletPduAStatus.11 = INTEGER: normal(1)
|
||||
// PWTv1-MIB::outletPduAAppPower.11 = INTEGER: 0 0.1W
|
||||
// PWTv1-MIB::outletPduAVoltage.11 = INTEGER: 0 0.1V
|
||||
|
||||
// PWTv1-MIB::outletCfgPduAIndex.11 = INTEGER: 10
|
||||
// PWTv1-MIB::outletCfgPduAName.11 = STRING: "outlet 11"
|
||||
// PWTv1-MIB::outletCfgPduADelayOnStatus.11 = INTEGER: nodelay(1)
|
||||
// PWTv1-MIB::outletCfgPduADelayOnTime.11 = INTEGER: 11 seconds
|
||||
// PWTv1-MIB::outletCfgPduADelayOffStatus.11 = INTEGER: nodelay(1)
|
||||
// PWTv1-MIB::outletCfgPduADelayOffTime.11 = INTEGER: 11 seconds
|
||||
// PWTv1-MIB::outletCfgPduAReboot.11 = INTEGER: 5 seconds
|
||||
// PWTv1-MIB::outletCfgPduAOverCurrCritical.11 = INTEGER: 160 0.1A
|
||||
// PWTv1-MIB::outletCfgPduAOverCurrWarning.11 = INTEGER: 130 0.1A
|
||||
// PWTv1-MIB::outletCfgPduAOverPwrCritical.11 = INTEGER: 2500 1W
|
||||
// PWTv1-MIB::outletCfgPduAOverPwrWarning.11 = INTEGER: 2000 1W
|
||||
// PWTv1-MIB::outletCtlPduAIndex.11 = INTEGER: 10
|
||||
// PWTv1-MIB::outletCtlPduAControl.11 = INTEGER: nothing(1)
|
||||
foreach ([ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H' ] as $char) {
|
||||
if ($outlet_count = snmp_get_oid($device, "pduPwrMonitoringOutletNumPdu{$char}.0", 'PWTv1-MIB')) {
|
||||
$oids = snmpwalk_cache_oid($device, 'pduPwrMonitoringOutletStatusTablePdu'.$char, [], 'PWTv1-MIB');
|
||||
$oids = snmpwalk_cache_oid($device, 'pduPwrMonitoringOutletCfgTablePdu'.$char, $oids, 'PWTv1-MIB');
|
||||
|
||||
$name = "Pdu $char";
|
||||
foreach ($oids as $index => $entry) {
|
||||
// PDU reports all outlets as "normal" status, but really only as in count
|
||||
if ($index > $outlet_count) { break; }
|
||||
|
||||
$descr = "Outlet $index State ($name)";
|
||||
$oid_name = "outletPdu{$char}State";
|
||||
$oid_num = snmp_translate($oid_name, $mib).".$index";
|
||||
$value = $entry[$oid_name];
|
||||
$options = [];
|
||||
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'outletPduState', $descr, $value, $options);
|
||||
|
||||
$descr = "Outlet $index ($name)";
|
||||
$oid_name = "outletPdu{$char}Current";
|
||||
$oid_num = snmp_translate($oid_name, $mib).".$index";
|
||||
$value = $entry[$oid_name];
|
||||
$scale = 0.01;
|
||||
$options = [
|
||||
'limit_high' => $entry["outletCfgPdu{$char}OverCurrCritical"] * 0.1,
|
||||
'limit_high_warn' => $entry["outletCfgPdu{$char}OverCurrWarning"] * 0.1
|
||||
];
|
||||
discover_sensor_ng($device, 'current', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
|
||||
|
||||
$descr = "Outlet $index ($name)";
|
||||
$oid_name = "outletPdu{$char}Power";
|
||||
$oid_num = snmp_translate($oid_name, $mib).".$index";
|
||||
$value = $entry[$oid_name];
|
||||
$scale = 0.1;
|
||||
$options = [
|
||||
'limit_high' => $entry["outletCfgPdu{$char}OverPwrCritical"],
|
||||
'limit_high_warn' => $entry["outletCfgPdu{$char}OverPwrWarning"]
|
||||
];
|
||||
discover_sensor_ng($device, 'power', $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, $options);
|
||||
|
||||
$descr = "Outlet $index ($name)";
|
||||
$oid_name = "outletPdu{$char}Energy";
|
||||
$oid_num = snmp_translate($oid_name, $mib).".$index";
|
||||
$value = $entry[$oid_name];
|
||||
$scale = 1000;
|
||||
$options = [];
|
||||
if ($value > 0) {
|
||||
discover_counter($device, 'energy', $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options);
|
||||
}
|
||||
|
||||
$descr = "Outlet $index ($name)";
|
||||
$oid_name = "outletPdu{$char}Status";
|
||||
$oid_num = snmp_translate($oid_name, $mib).".$index";
|
||||
$value = $entry[$oid_name];
|
||||
$options = [];
|
||||
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'inletStatus', $descr, $value, $options);
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($inlet_count, $phase_count, $oids, $outlet_count);
|
||||
|
||||
// EOF
|
||||
@ -6,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -91,7 +91,7 @@ foreach ($physicalConnectorEntry as $ifIndex => $entry)
|
||||
//print_debug_vars($options);
|
||||
|
||||
$name = $options['port_label'];
|
||||
$name_ext = " (${entry['portMfgName']} ${entry['portVendorPartNo']} ${entry['physicalConnectorString']})";
|
||||
$name_ext = " ({$entry['portMfgName']} {$entry['portVendorPartNo']} {$entry['physicalConnectorString']})";
|
||||
|
||||
// Temperature
|
||||
$descr = $name . ' Temperature' . $name_ext;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -43,10 +43,10 @@ $temp_unit = snmp_get_oid($device, 'cmcIIISetTempUnit.0', $mib);
|
||||
//RITTAL-CMC-III-MIB::cmcIIIVarName.1.26 = STRING: Input 2.Delay
|
||||
//RITTAL-CMC-III-MIB::cmcIIIVarName.1.27 = STRING: Input 2.Status
|
||||
//RITTAL-CMC-III-MIB::cmcIIIVarName.1.28 = STRING: Input 2.Category
|
||||
$oids = snmpwalk_cache_oid($device, "cmcIIIVarTable", array(), $mib);
|
||||
$oids = snmpwalk_cache_oid($device, "cmcIIIVarTable", [], $mib);
|
||||
//print_debug_vars($oids);
|
||||
|
||||
$device_oids = snmpwalk_cache_oid($device, "cmcIIIDevTable", array(), $mib);
|
||||
$device_oids = snmpwalk_cache_oid($device, "cmcIIIDevTable", [], $mib);
|
||||
print_debug_vars($device_oids);
|
||||
|
||||
$device_names = [];
|
||||
@ -68,7 +68,7 @@ foreach ($device_oids as $index => $entry) {
|
||||
}
|
||||
|
||||
// Rearrage this dumb array as more logic
|
||||
$device_sensors = array();
|
||||
$device_sensors = [];
|
||||
foreach ($oids as $index => $entry) {
|
||||
$device_index = explode('.', $index)[0];
|
||||
|
||||
@ -96,8 +96,8 @@ foreach($device_sensors as $device_index => $sensors) {
|
||||
}
|
||||
|
||||
if (strlen($sensor['description']['cmcIIIVarValueStr'])) {
|
||||
$tmp = str_replace(array( '_', 'Sys ' ),
|
||||
array( ' ', 'System ' ), $sensor['description']['cmcIIIVarValueStr']);
|
||||
$tmp = str_replace([ '_', 'Sys ' ],
|
||||
[ ' ', 'System ' ], $sensor['description']['cmcIIIVarValueStr']);
|
||||
if (!str_contains_array($name, $tmp)) {
|
||||
$descr .= ' - ' . $sensor['description']['cmcIIIVarValueStr'];
|
||||
}
|
||||
@ -115,7 +115,6 @@ foreach($device_sensors as $device_index => $sensors) {
|
||||
$oid_num = '.1.3.6.1.4.1.2606.7.4.2.2.1.11.' . $index;
|
||||
|
||||
if ($datatype === 'enum') {
|
||||
//discover_status($device, $oid_num, "$oid_name.$index", 'cmcIIIMsgStatus', $descr, $value, array( 'entPhysicalClass' => 'other' ));
|
||||
discover_status_ng($device, $mib, $oid_name, $oid_num, $index, 'cmcIIIMsgStatus', $descr, $value, [ 'entPhysicalClass' => 'other' ]);
|
||||
}
|
||||
|
||||
@ -149,7 +148,7 @@ foreach($device_sensors as $device_index => $sensors) {
|
||||
$value = $entry['cmcIIIVarValueInt'];
|
||||
$oid_num = '.1.3.6.1.4.1.2606.7.4.2.2.1.11.' . $index;
|
||||
|
||||
$options = array();
|
||||
$options = [];
|
||||
/*
|
||||
if ($type == 'outputPWM')
|
||||
{
|
||||
@ -174,7 +173,7 @@ foreach($device_sensors as $device_index => $sensors) {
|
||||
} elseif (str_ends($unit, 'V')) {
|
||||
$type = "voltage";
|
||||
} elseif ($unit === "%") {
|
||||
if (str_icontains_array($name, [ 'RPM', ' Fan', 'Valve' ]) || str_iends($entry['cmcIIIVarName'], 'Rpm')) {
|
||||
if (str_icontains_array($descr, [ 'RPM', ' Fan', 'Valve', 'Airflow' ]) || str_iends($entry['cmcIIIVarName'], 'Rpm')) {
|
||||
$type = "load";
|
||||
} elseif (str_icontains_array($name, 'Humidity')) {
|
||||
$type = "humidity";
|
||||
|
||||
84
includes/discovery/sensors/roomalert12s-mib.inc.php
Normal file
84
includes/discovery/sensors/roomalert12s-mib.inc.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
$scale = 1; // Start at 1 for 2 digits setting.
|
||||
//$scale = 0.01;
|
||||
|
||||
$oids = snmpwalk_cache_oid($device, "digital", [], "ROOMALERT12S-MIB");
|
||||
|
||||
$index = 0;
|
||||
$i = 1;
|
||||
|
||||
//for ($i = 1; $i <= 2; $i++) {
|
||||
if (isset($oids[$index]["digital-sen$i-1"])) {
|
||||
$name = "External Digital Sensor";
|
||||
// Sensor is present.
|
||||
if (!isset($oids[$index]["digital-sen$i-3"])) {
|
||||
// Temp sensor
|
||||
$descr = "$name: Temperature";
|
||||
$oid = ".1.3.6.1.4.1.20916.1.12.1.2.$i.1.$index";
|
||||
$value = $oids[$index]["digital-sen$i-1"];
|
||||
if ($value > 100) { $scale = 0.01; }
|
||||
|
||||
discover_sensor_ng($device, 'temperature', $mib, "digital-sen$i-1", $oid, $index, NULL, $descr, $scale, $value);
|
||||
} elseif (isset($oids[$index]["digital-sen$i-5"])) {
|
||||
// Temp/Humidity sensor
|
||||
$descr = "$name: Temperature";
|
||||
$oid = ".1.3.6.1.4.1.20916.1.12.1.2.$i.1.$index";
|
||||
$value = $oids[$index]["digital-sen$i-1"];
|
||||
if ($value > 100) { $scale = 0.01; }
|
||||
|
||||
discover_sensor_ng($device, 'temperature', $mib, "digital-sen$i-1", $oid, $index, NULL, $descr, $scale, $value);
|
||||
|
||||
$descr = "$name: Heat index";
|
||||
$oid = ".1.3.6.1.4.1.20916.1.12.1.2.$i.5.$index";
|
||||
$value = $oids[$index]["digital-sen$i-5"];
|
||||
|
||||
discover_sensor_ng($device, 'temperature', $mib, "digital-sen$i-5", $oid, $index, NULL, $descr, $scale, $value);
|
||||
|
||||
$descr = "$name: Humidity";
|
||||
$oid = ".1.3.6.1.4.1.20916.1.12.1.2.$i.3.$index";
|
||||
$value = $oids[$index]["digital-sen$i-3"];
|
||||
|
||||
discover_sensor_ng($device, 'humidity', $mib, "digital-sen$i-3", $oid, $index, NULL, $descr, $scale, $value);
|
||||
|
||||
$descr = "$name: Dew Point";
|
||||
$oid = ".1.3.6.1.4.1.20916.1.12.1.2.$i.6.$index";
|
||||
$value = $oids[$index]["digital-sen$i-6"];
|
||||
|
||||
discover_sensor_ng($device, 'dewpoint', $mib, "digital-sen$i-6", $oid, $index, NULL, $descr, $scale, $value);
|
||||
} else {
|
||||
// Power sensor
|
||||
$descr = "Channel $i: Current";
|
||||
$oid = ".1.3.6.1.4.1.20916.1.12.1.2.$i.1.$index";
|
||||
$value = $oids[$index]["digital-sen$i-1"];
|
||||
discover_sensor('current', $device, $oid, "digital-sen$i-1.$index", 'roomalert', $descr, $scale, $value);
|
||||
|
||||
$descr = "Channel $i: Power";
|
||||
$oid = ".1.3.6.1.4.1.20916.1.12.1.2.$i.2.$index";
|
||||
$value = $oids[$index]["digital-sen$i-2"];
|
||||
discover_sensor('power', $device, $oid, "digital-sen$i-2.$index", 'roomalert', $descr, $scale, $value);
|
||||
|
||||
$descr = "Channel $i: Voltage";
|
||||
$oid = ".1.3.6.1.4.1.20916.1.12.1.2.$i.3.$index";
|
||||
$value = $oids[$index]["digital-sen$i-3"];
|
||||
discover_sensor('voltage', $device, $oid, "digital-sen$i-3.$index", 'roomalert', $descr, $scale, $value);
|
||||
|
||||
$descr = "Channel $i: Reference voltage";
|
||||
$oid = ".1.3.6.1.4.1.20916.1.12.1.2.$i.4.$index";
|
||||
$value = $oids[$index]["digital-sen$i-4"];
|
||||
discover_sensor('voltage', $device, $oid, "digital-sen$i-4.$index", 'roomalert', $descr, $scale, $value);
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
// EOF
|
||||
@ -77,13 +77,14 @@ for ($i = 1; $i <= 4; $i++) {
|
||||
discover_status($device, $oid, 'relay'.$i.'State.0', 'teracom-relay-state', $descr, $value, array('entPhysicalClass' => 'other'));
|
||||
}
|
||||
|
||||
// Status FIXME definition-based
|
||||
/* Status FIXME definition-based
|
||||
$value = snmp_get_oid($device, 'hardwareErr.0', $mib);
|
||||
if (!safe_empty($value)) {
|
||||
$descr = 'Status';
|
||||
$oid = '.1.3.6.1.4.1.38783.1.3.8.0';
|
||||
discover_status($device, $oid, 'hardwareErr.0', 'teracom-alarm-state', $descr, $value, array('entPhysicalClass' => 'other'));
|
||||
}
|
||||
*/
|
||||
|
||||
unset($data, $oid, $descr, $limits, $value);
|
||||
|
||||
|
||||
144
includes/discovery/sensors/teracom-tcw241-mib.inc.php
Normal file
144
includes/discovery/sensors/teracom-tcw241-mib.inc.php
Normal file
@ -0,0 +1,144 @@
|
||||
<?php
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
// Teracom MIBs are stupid
|
||||
|
||||
// TERACOM-TCW241-MIB::temperatureUnit.0 = INTEGER: celcius(0)
|
||||
$temp_unit = snmp_get_oid($device, 'temperatureUnit.0', $mib);
|
||||
$flags = OBS_QUOTES_TRIM | OBS_SNMP_DISPLAY_HINT; // disable use display-hint, for correct scales
|
||||
|
||||
$invalid = [ '0', '-2147483648' ];
|
||||
|
||||
// 1-Wire sensors
|
||||
for ($i = 1; $i <= 8; $i++) {
|
||||
// TERACOM-TCW241-MIB::s1description.0 = STRING: S1:TSH2xx
|
||||
// TERACOM-TCW241-MIB::s11MAXInt.0 = INTEGER: 85.000
|
||||
// TERACOM-TCW241-MIB::s11MINInt.0 = INTEGER: -40.000
|
||||
// TERACOM-TCW241-MIB::s11HYSTInt.0 = INTEGER: 8.500
|
||||
// TERACOM-TCW241-MIB::s12MAXInt.0 = INTEGER: 100.000
|
||||
// TERACOM-TCW241-MIB::s12MINInt.0 = INTEGER: .000
|
||||
// TERACOM-TCW241-MIB::s12HYSTInt.0 = INTEGER: 10.000
|
||||
// TERACOM-TCW241-MIB::s11Int.0 = INTEGER: 17.875
|
||||
// TERACOM-TCW241-MIB::s12Int.0 = INTEGER: 27.500
|
||||
// TERACOM-TCW241-MIB::s1ID.0 = STRING: 01FBBC5A1800FF40
|
||||
|
||||
$oids = [
|
||||
"s{$i}description.0", "s{$i}ID.0",
|
||||
"s{$i}1Int.0", "s{$i}1MAXInt.0", "s{$i}1MINInt.0",
|
||||
"s{$i}2Int.0", "s{$i}2MAXInt.0", "s{$i}2MINInt.0",
|
||||
];
|
||||
$data = snmp_get_multi_oid($device, $oids, [], $mib, NULL, $flags);
|
||||
if ($data[0]['s'.$i.'ID'] === '0000000000000000') { continue; }
|
||||
|
||||
if (!in_array($data[0]["s{$i}1Int"], $invalid)) {
|
||||
$descr = '#1 ' . $data[0]["s{$i}description"] . ' (' . $data[0]["s{$i}ID"] . ')';
|
||||
|
||||
$oid_num = ".1.3.6.1.4.1.38783.3.3.1.$i.1.0";
|
||||
$oid_name = "s{$i}1Int";
|
||||
$value = $data[0][$oid_name];
|
||||
$scale = 0.001;
|
||||
$options = [
|
||||
'limit_low' => $data[0]["s{$i}1MINInt"] * $scale,
|
||||
'limit_high' => $data[0]["s{$i}1MAXInt"] * $scale
|
||||
];
|
||||
if ($temp_unit === 'fahrenheit') {
|
||||
$options['sensor_unit'] = 'F';
|
||||
}
|
||||
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, 0, NULL, $descr, $scale, $value, $options);
|
||||
}
|
||||
if (!in_array($data[0]["s{$i}2Int"], $invalid)) {
|
||||
$descr = '#2 ' . $data[0]["s{$i}description"] . ' (' . $data[0]["s{$i}ID"] . ')';
|
||||
|
||||
$oid_num = ".1.3.6.1.4.1.38783.3.3.1.$i.2.0";
|
||||
$oid_name = "s{$i}2Int";
|
||||
$value = $data[0][$oid_name];
|
||||
$scale = 0.001;
|
||||
$options = [
|
||||
'limit_low' => $data[0]["s{$i}2MINInt"] * $scale,
|
||||
'limit_high' => $data[0]["s{$i}2MAXInt"] * $scale
|
||||
];
|
||||
if ($temp_unit === 'fahrenheit') {
|
||||
$options['sensor_unit'] = 'F';
|
||||
}
|
||||
discover_sensor_ng($device, 'temperature', $mib, $oid_name, $oid_num, 0, NULL, $descr, $scale, $value, $options);
|
||||
}
|
||||
}
|
||||
|
||||
// Analog inputs
|
||||
for ($i = 1; $i <= 4; $i++) {
|
||||
$oids = [
|
||||
"voltage{$i}description.0",
|
||||
"voltage{$i}Int.0", "voltage{$i}max.0", "voltage{$i}min.0",
|
||||
];
|
||||
$data = snmp_get_multi_oid($device, $oids, [], $mib, NULL, $flags);
|
||||
$descr = $data[0]["voltage{$i}description"];
|
||||
switch(substr($descr, 0, 2)) {
|
||||
case 'I ':
|
||||
$type = 'current';
|
||||
$descr = substr($descr, 2);
|
||||
break;
|
||||
case 'F ':
|
||||
$type = 'frequency';
|
||||
$descr = substr($descr, 2);
|
||||
break;
|
||||
case 'H ':
|
||||
$type = 'humidity';
|
||||
$descr = substr($descr, 2);
|
||||
break;
|
||||
default:
|
||||
$type = 'voltage';
|
||||
}
|
||||
|
||||
if (!in_array($data[0]["voltage{$i}Int"], $invalid)) {
|
||||
$oid_num = ".1.3.6.1.4.1.38783.3.3.2.$i.0";
|
||||
$oid_name = "voltage{$i}Int";
|
||||
$value = $data[0][$oid_name];
|
||||
$scale = 0.001;
|
||||
$options = [
|
||||
'limit_low' => $data[0]["voltage{$i}min"] * $scale,
|
||||
'limit_high' => $data[0]["voltage{$i}max"] * $scale
|
||||
];
|
||||
discover_sensor_ng($device, $type, $mib, $oid_name, $oid_num, 0, NULL, $descr, $scale, $value, $options);
|
||||
}
|
||||
}
|
||||
|
||||
// Digital inputs
|
||||
for ($i = 1; $i <= 4; $i++) {
|
||||
$oids = [
|
||||
"digitalInput{$i}description.0", "digitalInput{$i}State.0",
|
||||
];
|
||||
$data = snmp_get_multi_oid($device, $oids, [], $mib);
|
||||
|
||||
$descr = $data[0]["digitalInput{$i}description"];
|
||||
$oid_num = ".1.3.6.1.4.1.38783.3.3.3.$i.0";
|
||||
$oid_name = "digitalInput{$i}State";
|
||||
$value = $data[0][$oid_name];
|
||||
|
||||
discover_status_ng($device, $mib, $oid_name, $oid_num, 0, 'teracom-digitalin-state', $descr, $value, [ 'entPhysicalClass' => 'other' ]);
|
||||
}
|
||||
|
||||
// Relay outputs
|
||||
for ($i = 1; $i <= 4; $i++) {
|
||||
$oids = [
|
||||
"relay{$i}description.0", "relay{$i}State.0",
|
||||
];
|
||||
$data = snmp_get_multi_oid($device, $oids, [], $mib);
|
||||
|
||||
$descr = $data[0]["relay{$i}description"];
|
||||
$oid_num = ".1.3.6.1.4.1.38783.3.3.4.$i.1.0";
|
||||
$oid_name = "relay{$i}State";
|
||||
$value = $data[0][$oid_name];
|
||||
|
||||
discover_status_ng($device, $mib, $oid_name, $oid_num, 0, 'teracom-relay-state', $descr, $value, [ 'entPhysicalClass' => 'other' ]);
|
||||
}
|
||||
|
||||
// EOF
|
||||
@ -273,7 +273,8 @@ if (safe_count($ups_array)) {
|
||||
$oid_name = 'upsInputVoltage';
|
||||
if (isset($entry[$oid_name]) &&
|
||||
!discovery_check_if_type_exist([ 'voltage->TRIPPLITE-PRODUCTS-tlpUpsInputPhaseVoltage',
|
||||
'voltage->HUAWEI-UPS-MIB-hwUpsInputVoltageA' ], 'sensor')) {
|
||||
'voltage->HUAWEI-UPS-MIB-hwUpsInputVoltageA',
|
||||
'voltage->CPS-MIB-upsAdvanceInputLineVoltage' ], 'sensor')) {
|
||||
$oid = ".1.3.6.1.2.1.33.1.3.3.1.3.$index";
|
||||
//discover_sensor('voltage', $device, $oid, "upsInputEntry.".$phase, 'ups-mib', $descr, 1, $entry[$oid_name]);
|
||||
$options = [ 'rename_rrd' => 'ups-mib-upsInputEntry.'.$phase ];
|
||||
@ -368,7 +369,8 @@ if (safe_count($ups_array)) {
|
||||
$oid_name = 'upsOutputVoltage';
|
||||
if (isset($entry[$oid_name]) && $entry[$oid_name] > 0 &&
|
||||
!discovery_check_if_type_exist([ 'voltage->TRIPPLITE-PRODUCTS-tlpUpsOutputLineVoltage',
|
||||
'voltage->HUAWEI-UPS-MIB-hwUpsOutputVoltageA' ], 'sensor')) {
|
||||
'voltage->HUAWEI-UPS-MIB-hwUpsOutputVoltageA',
|
||||
'voltage->CPS-MIB-upsAdvanceOutputVoltage' ], 'sensor')) {
|
||||
$oid = ".1.3.6.1.2.1.33.1.4.4.1.2.$index";
|
||||
//discover_sensor('voltage', $device, $oid, "upsOutputEntry.".$phase, 'ups-mib', $descr, 1, $entry['upsOutputVoltage']);
|
||||
$options = [ 'rename_rrd' => 'ups-mib-upsOutputEntry.'.$phase ];
|
||||
@ -382,7 +384,8 @@ if (safe_count($ups_array)) {
|
||||
## Output current
|
||||
$oid_name = 'upsOutputCurrent';
|
||||
if (isset($entry[$oid_name]) && $ups_total[$oid_name] > 0 &&
|
||||
!discovery_check_if_type_exist([ 'current->HUAWEI-UPS-MIB-hwUpsOutputCurrentA' ], 'sensor')) {
|
||||
!discovery_check_if_type_exist([ 'current->HUAWEI-UPS-MIB-hwUpsOutputCurrentA',
|
||||
'current->CPS-MIB-upsAdvanceOutputCurrent' ], 'sensor')) {
|
||||
$oid = ".1.3.6.1.2.1.33.1.4.4.1.3.$index";
|
||||
//discover_sensor('current', $device, $oid, "upsOutputEntry.".$phase, 'ups-mib', $descr, $scale_current, $entry['upsOutputCurrent']);
|
||||
$options = [ 'rename_rrd' => 'ups-mib-upsOutputEntry.'.$phase ];
|
||||
@ -392,7 +395,8 @@ if (safe_count($ups_array)) {
|
||||
## Output power
|
||||
$oid_name = 'upsOutputPower';
|
||||
if (isset($entry[$oid_name]) && $ups_total[$oid_name] > 0 &&
|
||||
!discovery_check_if_type_exist('power->HUAWEI-UPS-MIB-hwUpsOutputActivePowerA', 'sensor')) {
|
||||
!discovery_check_if_type_exist([ 'power->HUAWEI-UPS-MIB-hwUpsOutputActivePowerA',
|
||||
'power->CPS-MIB-upsAdvanceOutputPower' ], 'sensor')) {
|
||||
$oid = ".1.3.6.1.2.1.33.1.4.4.1.4.$index";
|
||||
//discover_sensor('power', $device, $oid, "upsOutputEntry.".$phase, 'ups-mib', $descr, 1, $entry['upsOutputPower']);
|
||||
$options = [ 'rename_rrd' => 'ups-mib-upsOutputEntry.'.$phase ];
|
||||
@ -403,7 +407,7 @@ if (safe_count($ups_array)) {
|
||||
if (isset($entry[$oid_name]) &&
|
||||
!discovery_check_if_type_exist('load->HUAWEI-UPS-MIB-hwUpsOutputLoadA', 'sensor')) {
|
||||
$oid = ".1.3.6.1.2.1.33.1.4.4.1.5.$index";
|
||||
//rename_rrd($device, "sensor-capacity-ups-mib-upsOutputPercentLoad.${phase}", "sensor-load-ups-mib-upsOutputPercentLoad.${phase}");
|
||||
//rename_rrd($device, "sensor-capacity-ups-mib-upsOutputPercentLoad.{$phase}", "sensor-load-ups-mib-upsOutputPercentLoad.{$phase}");
|
||||
//discover_sensor('load', $device, $oid, "upsOutputPercentLoad.$phase", 'ups-mib', $descr, 1, $entry['upsOutputPercentLoad']);
|
||||
$options = [ 'rename_rrd' => 'ups-mib-upsOutputPercentLoad.'.$phase ];
|
||||
discover_sensor_ng($device, 'load', $mib, $oid_name, $oid, $index, NULL, $descr, 1, $entry[$oid_name], $options);
|
||||
|
||||
@ -6,11 +6,11 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
$xups_array = array();
|
||||
$xups_array = [];
|
||||
$xups_array = snmpwalk_cache_oid($device, "xupsInput", $xups_array, "XUPS-MIB");
|
||||
$xups_array = snmpwalk_cache_oid($device, "xupsOutput", $xups_array, "XUPS-MIB");
|
||||
$xups_array = snmpwalk_cache_oid($device, "xupsBypass", $xups_array, "XUPS-MIB");
|
||||
@ -27,14 +27,11 @@ $xups_array = snmpwalk_cache_oid($device, "xupsConfig", $xups_array, "XUPS-MIB")
|
||||
$xups_base = $xups_array[0];
|
||||
unset($xups_array[0]);
|
||||
|
||||
foreach ($xups_array as $index => $entry)
|
||||
{
|
||||
foreach ($xups_array as $index => $entry) {
|
||||
// Input
|
||||
if (isset($entry['xupsInputPhase']))
|
||||
{
|
||||
if (isset($entry['xupsInputPhase'])) {
|
||||
$descr = "Input";
|
||||
if ($xups_base['xupsInputNumPhases'] > 1)
|
||||
{
|
||||
if ($xups_base['xupsInputNumPhases'] > 1) {
|
||||
$descr .= " Phase $index";
|
||||
}
|
||||
|
||||
@ -43,12 +40,10 @@ foreach ($xups_array as $index => $entry)
|
||||
$value = $entry['xupsInputVoltage'];
|
||||
|
||||
if ($value != 0 &&
|
||||
!isset($valid['sensor']['voltage']['mge-ups'][100+$index]))
|
||||
{
|
||||
!isset($valid['sensor']['voltage']['mge-ups'][100+$index])) {
|
||||
// Limits
|
||||
$limits = [];
|
||||
if ($xups_base['xupsConfigInputVoltage'])
|
||||
{
|
||||
if ($xups_base['xupsConfigInputVoltage']) {
|
||||
$limits['limit_low'] = $xups_base['xupsConfigInputVoltage'] - 15;
|
||||
$limits['limit_high'] = $xups_base['xupsConfigInputVoltage'] + 15;
|
||||
}
|
||||
@ -60,16 +55,14 @@ foreach ($xups_array as $index => $entry)
|
||||
$value = $entry['xupsInputCurrent'];
|
||||
|
||||
if ($value != 0 && $value < 10000 && // xupsInputCurrent.1 = 136137420 ? really? You're nuts.
|
||||
!isset($valid['sensor']['current']['mge-ups'][100+$index]))
|
||||
{
|
||||
!isset($valid['sensor']['current']['mge-ups'][100+$index])) {
|
||||
discover_sensor('current', $device, $oid, "xupsInputEntry.".$index, 'xups', $descr, 1, $value);
|
||||
}
|
||||
|
||||
## Input power
|
||||
$oid = ".1.3.6.1.4.1.534.1.3.4.1.4.$index"; # XUPS-MIB::xupsInputWatts.$index
|
||||
$value = $entry['xupsInputWatts'];
|
||||
if ($value != 0)
|
||||
{
|
||||
if ($value != 0) {
|
||||
discover_sensor('power', $device, $oid, "xupsInputEntry.".$index, 'xups', $descr, 1, $value);
|
||||
}
|
||||
}
|
||||
@ -96,11 +89,9 @@ foreach ($xups_array as $index => $entry)
|
||||
// XUPS-MIB::xupsOutputTotalVA.0 = INTEGER: 98 VA
|
||||
// XUPS-MIB::xupsOutputAveragePowerFactor.0 = INTEGER: 33
|
||||
// XUPS-MIB::xupsOutput.10.0 = INTEGER: 3
|
||||
if (isset($entry['xupsOutputPhase']))
|
||||
{
|
||||
if (isset($entry['xupsOutputPhase'])) {
|
||||
$descr = "Output";
|
||||
if ($xups_base['xupsOutputNumPhases'] > 1)
|
||||
{
|
||||
if ($xups_base['xupsOutputNumPhases'] > 1) {
|
||||
$descr .= " Phase $index";
|
||||
}
|
||||
|
||||
@ -108,12 +99,10 @@ foreach ($xups_array as $index => $entry)
|
||||
$oid = ".1.3.6.1.4.1.534.1.4.4.1.2.$index"; # XUPS-MIB::xupsOutputVoltage.$index
|
||||
$value = $entry['xupsOutputVoltage'];
|
||||
if ($value != 0 &&
|
||||
!isset($valid['sensor']['voltage']['mge-ups'][$index]))
|
||||
{
|
||||
!isset($valid['sensor']['voltage']['mge-ups'][$index])) {
|
||||
// Limits
|
||||
$limits = [];
|
||||
if ($xups_base['xupsConfigLowOutputVoltageLimit'] && $xups_base['xupsConfigHighOutputVoltageLimit'])
|
||||
{
|
||||
if ($xups_base['xupsConfigLowOutputVoltageLimit'] && $xups_base['xupsConfigHighOutputVoltageLimit']) {
|
||||
$limits['limit_low'] = $xups_base['xupsConfigLowOutputVoltageLimit'];
|
||||
$limits['limit_high'] = $xups_base['xupsConfigHighOutputVoltageLimit'];
|
||||
}
|
||||
@ -121,19 +110,15 @@ foreach ($xups_array as $index => $entry)
|
||||
}
|
||||
|
||||
## Output current
|
||||
if (!isset($valid['sensor']['current']['mge-ups'][$index]))
|
||||
{
|
||||
if (!isset($valid['sensor']['current']['mge-ups'][$index])) {
|
||||
$options = [ 'rename_rrd' => 'xups-xupsOutputEntry.'.$index ];
|
||||
if (isset($entry['xupsOutputCurrentHighPrecision']) && $entry['xupsOutputCurrentHighPrecision'] != 0)
|
||||
{
|
||||
if (isset($entry['xupsOutputCurrentHighPrecision']) && $entry['xupsOutputCurrentHighPrecision'] != 0) {
|
||||
// Prefer High precision
|
||||
$oid = ".1.3.6.1.4.1.534.1.4.4.1.7.$index";
|
||||
$value = $entry['xupsOutputCurrentHighPrecision'];
|
||||
$options['limit_auto'] = FALSE; // Not sure
|
||||
discover_sensor_ng($device, 'current', 'XUPS-MIB', 'xupsOutputCurrentHighPrecision', $oid, $index, NULL, $descr, 0.1, $value, $options);
|
||||
}
|
||||
elseif ($entry['xupsOutputCurrent'] != 0)
|
||||
{
|
||||
} elseif ($entry['xupsOutputCurrent'] != 0) {
|
||||
$oid = ".1.3.6.1.4.1.534.1.4.4.1.3.$index"; # XUPS-MIB::xupsOutputCurrent.$index
|
||||
$value = $entry['xupsOutputCurrent'];
|
||||
discover_sensor_ng($device, 'current', 'XUPS-MIB', 'xupsOutputCurrent', $oid, $index, NULL, $descr, 1, $value, $options);
|
||||
@ -144,11 +129,9 @@ foreach ($xups_array as $index => $entry)
|
||||
## Output power
|
||||
$oid = ".1.3.6.1.4.1.534.1.4.4.1.4.$index"; # XUPS-MIB::xupsOutputWatts.$index
|
||||
$value = $entry['xupsOutputWatts'];
|
||||
if ($value != 0)
|
||||
{
|
||||
if ($value != 0) {
|
||||
$limits = [];
|
||||
if ($xups_base['xupsConfigOutputWatts'])
|
||||
{
|
||||
if ($xups_base['xupsConfigOutputWatts']) {
|
||||
$limits['limit_high_warn'] = $xups_base['xupsConfigOutputWatts'] * 0.8;
|
||||
$limits['limit_high'] = $xups_base['xupsConfigOutputWatts'] * 0.95;
|
||||
}
|
||||
@ -158,8 +141,7 @@ foreach ($xups_array as $index => $entry)
|
||||
## Output Active power
|
||||
$oid = ".1.3.6.1.4.1.534.1.4.4.1.9.$index"; # XUPS-MIB::xupsOutputVA.$index
|
||||
$value = $entry['xupsOutputVA'];
|
||||
if ($value != 0)
|
||||
{
|
||||
if ($value != 0) {
|
||||
discover_sensor_ng($device, 'apower', 'XUPS-MIB', 'xupsOutputVA', $oid, $index, NULL, $descr, 1, $value);
|
||||
}
|
||||
}
|
||||
@ -176,23 +158,19 @@ foreach ($xups_array as $index => $entry)
|
||||
|
||||
// XUPS-MIB::xupsBypassAverageVoltage.0 = INTEGER: 229 RMS Volts
|
||||
// XUPS-MIB::xupsBypassAverageCurrent.0 = INTEGER: 0 RMS tenth of Amps
|
||||
if (isset($entry['xupsBypassPhase']))
|
||||
{
|
||||
if (isset($entry['xupsBypassPhase'])) {
|
||||
$descr = "Bypass";
|
||||
if ($xups_base['xupsBypassNumPhases'] > 1)
|
||||
{
|
||||
if ($xups_base['xupsBypassNumPhases'] > 1) {
|
||||
$descr .= " Phase $index";
|
||||
}
|
||||
|
||||
## Bypass voltage
|
||||
$oid = ".1.3.6.1.4.1.534.1.5.3.1.2.$index"; # XUPS-MIB::xupsBypassVoltage.$index
|
||||
$value = $entry['xupsBypassVoltage'];
|
||||
if ($value != 0)
|
||||
{
|
||||
if ($value != 0) {
|
||||
discover_sensor('voltage', $device, $oid, "xupsBypassEntry." . $index, 'xups', $descr, 1, $value);
|
||||
|
||||
if (isset($entry['xupsBypassCurrentHighPrecision'])) // && $entry['xupsBypassCurrentHighPrecision'] != 0)
|
||||
{
|
||||
if (isset($entry['xupsBypassCurrentHighPrecision'])) { // && $entry['xupsBypassCurrentHighPrecision'] != 0)
|
||||
$oid = ".1.3.6.1.4.1.534.1.5.3.1.5.$index";
|
||||
$value = $entry['xupsBypassCurrentHighPrecision'];
|
||||
discover_sensor_ng($device, 'current', 'XUPS-MIB', 'xupsBypassCurrentHighPrecision', $oid, $index, NULL, $descr, 0.1, $value);
|
||||
@ -208,8 +186,7 @@ $oid = ".1.3.6.1.4.1.534.1.3.1.0"; # XUPS-MIB::xupsInputFrequency.0
|
||||
$scale = 0.1;
|
||||
$value = $entry['xupsInputFrequency'];
|
||||
if ($value != 0 &&
|
||||
!isset($valid['sensor']['frequency']['mge-ups'][101]))
|
||||
{
|
||||
!isset($valid['sensor']['frequency']['mge-ups'][101])) {
|
||||
discover_sensor('frequency', $device, $oid, "xupsInputFrequency.0", 'xups', "Input", $scale, $value);
|
||||
}
|
||||
|
||||
@ -217,8 +194,7 @@ if ($value != 0 &&
|
||||
$oid = ".1.3.6.1.4.1.534.1.4.1.0"; # XUPS-MIB::xupsOutputLoad.0
|
||||
$descr = "Output Load";
|
||||
$value = $entry['xupsOutputLoad'];
|
||||
if (!isset($valid['sensor']['load']['mge-ups']['mgoutputLoadPerPhase.1']))
|
||||
{
|
||||
if (!isset($valid['sensor']['load']['mge-ups']['mgoutputLoadPerPhase.1'])) {
|
||||
$limits = [ 'limit_high_warn' => 80, 'limit_high' => 95 ];
|
||||
discover_sensor('load', $device, $oid, "xupsOutputLoad.0", 'xups', $descr, 1, $value, $limits);
|
||||
}
|
||||
@ -227,11 +203,9 @@ if (!isset($valid['sensor']['load']['mge-ups']['mgoutputLoadPerPhase.1']))
|
||||
$oid = ".1.3.6.1.4.1.534.1.4.2.0"; # XUPS-MIB::xupsOutputFrequency.0
|
||||
$value = $entry['xupsOutputFrequency'];
|
||||
if ($value != 0 &&
|
||||
!isset($valid['sensor']['frequency']['mge-ups'][1]))
|
||||
{
|
||||
!isset($valid['sensor']['frequency']['mge-ups'][1])) {
|
||||
$limits = [];
|
||||
if ($xups_base['xupsConfigOutputFreq'])
|
||||
{
|
||||
if ($xups_base['xupsConfigOutputFreq']) {
|
||||
$limits['limit_low'] = $xups_base['xupsConfigOutputFreq'] * 0.099; // 50 -> 49,5
|
||||
$limits['limit_low_warn'] = $xups_base['xupsConfigOutputFreq'] * 0.0996; // 50 -> 49.8
|
||||
$limits['limit_high_warn'] = $xups_base['xupsConfigOutputFreq'] * 0.1004; // 50 -> 50.2
|
||||
@ -244,16 +218,14 @@ if ($value != 0 &&
|
||||
$oid = ".1.3.6.1.4.1.534.1.4.9.5.0"; # XUPS-MIB::xupsOutputAveragePowerFactor.0
|
||||
$descr = "Output Power Factor";
|
||||
$value = $entry['xupsOutputAveragePowerFactor'];
|
||||
if ($value != 0)
|
||||
{
|
||||
if ($value != 0) {
|
||||
discover_sensor_ng($device, 'powerfactor', 'XUPS-MIB', 'xupsOutputAveragePowerFactor', $oid, 0, NULL, $descr, 1, $value);
|
||||
}
|
||||
|
||||
## Bypass Frequency
|
||||
$oid = ".1.3.6.1.4.1.534.1.5.1.0"; # XUPS-MIB::xupsBypassFrequency.0
|
||||
$value = $entry['xupsBypassFrequency'];
|
||||
if ($value != 0)
|
||||
{
|
||||
if ($value != 0) {
|
||||
discover_sensor('frequency', $device, $oid, "xupsBypassFrequency.0", 'xups', "Bypass", $scale, $value);
|
||||
}
|
||||
|
||||
@ -264,7 +236,7 @@ $oid_num = '.1.3.6.1.4.1.534.1.3.5.0';
|
||||
$type = 'xupsInputSource';
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'other'));
|
||||
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, [ 'entPhysicalClass' => 'other' ]);
|
||||
|
||||
// xupsOutputSource
|
||||
$descr = 'Output Source';
|
||||
@ -273,7 +245,7 @@ $oid_num = '.1.3.6.1.4.1.534.1.4.5.0';
|
||||
$type = 'xupsOutputSource';
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'other'));
|
||||
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, [ 'entPhysicalClass' => 'other' ]);
|
||||
|
||||
// XUPS-MIB::xupsBatTimeRemaining.0 = INTEGER: 31500 seconds
|
||||
// XUPS-MIB::xupsBatVoltage.0 = INTEGER: 104 Volts DC
|
||||
@ -290,17 +262,15 @@ discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value,
|
||||
// XUPS-MIB::xupsEnvAmbientUpperLimit.0 = INTEGER: 40 degrees Centigrade
|
||||
// XUPS-MIB::xupsEnvNumContacts.0 = INTEGER: 0
|
||||
|
||||
$xups_array = array();
|
||||
$xups_array = [];
|
||||
$xups_array = snmpwalk_cache_oid($device, "xupsBattery", $xups_array, "XUPS-MIB");
|
||||
$xups_array = snmpwalk_cache_oid($device, "xupsEnvironment", $xups_array, "XUPS-MIB");
|
||||
|
||||
$entry = $xups_array[0];
|
||||
|
||||
if ($entry['xupsBatteryNotPresent'] !== 'yes')
|
||||
{
|
||||
if ($entry['xupsBatteryNotPresent'] !== 'yes') {
|
||||
if (isset($entry['xupsBatTimeRemaining']) &&
|
||||
!isset($valid['sensor']['runtime']['mge']['upsmgBatteryRemainingTime.0']))
|
||||
{
|
||||
!isset($valid['sensor']['runtime']['mge']['upsmgBatteryRemainingTime.0'])) {
|
||||
$oid = ".1.3.6.1.4.1.534.1.2.1.0"; # XUPS-MIB::xupsBatTimeRemaining.0
|
||||
$scale = 1/60;
|
||||
$value = $entry['xupsBatTimeRemaining'];
|
||||
@ -309,8 +279,7 @@ if ($entry['xupsBatteryNotPresent'] !== 'yes')
|
||||
}
|
||||
|
||||
if (isset($entry['xupsBatCapacity']) &&
|
||||
!isset($valid['sensor']['capacity']['mge']['upsmgBatteryLevel.0']))
|
||||
{
|
||||
!isset($valid['sensor']['capacity']['mge']['upsmgBatteryLevel.0'])) {
|
||||
$oid = ".1.3.6.1.4.1.534.1.2.4.0"; # XUPS-MIB::xupsBatCapacity.0
|
||||
$value = $entry['xupsBatCapacity'];
|
||||
|
||||
@ -318,8 +287,7 @@ if ($entry['xupsBatteryNotPresent'] !== 'yes')
|
||||
}
|
||||
|
||||
if (isset($entry['xupsBatVoltage']) && $entry['xupsBatVoltage'] != 0 &&
|
||||
!isset($valid['sensor']['voltage']['mge']['upsmgBatteryVoltage.0']))
|
||||
{
|
||||
!isset($valid['sensor']['voltage']['mge']['upsmgBatteryVoltage.0'])) {
|
||||
$oid = ".1.3.6.1.4.1.534.1.2.2.0"; # XUPS-MIB::xupsBatVoltage.0
|
||||
$value = $entry['xupsBatVoltage'];
|
||||
|
||||
@ -327,8 +295,7 @@ if ($entry['xupsBatteryNotPresent'] !== 'yes')
|
||||
}
|
||||
|
||||
if (isset($entry['xupsBatCurrent']) &&
|
||||
!isset($valid['sensor']['current']['mge']['upsmgBatteryCurrent.0']))
|
||||
{
|
||||
!isset($valid['sensor']['current']['mge']['upsmgBatteryCurrent.0'])) {
|
||||
$oid = ".1.3.6.1.4.1.534.1.2.3.0"; # XUPS-MIB::xupsBatCurrent.0
|
||||
$value = $entry['xupsBatCurrent'];
|
||||
|
||||
@ -342,7 +309,7 @@ if ($entry['xupsBatteryNotPresent'] !== 'yes')
|
||||
$type = 'xupsBatteryAbmStatus';
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'battery'));
|
||||
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, [ 'entPhysicalClass' => 'battery' ]);
|
||||
|
||||
// xupsBatteryFailure
|
||||
$descr = 'Battery Failure';
|
||||
@ -351,17 +318,17 @@ if ($entry['xupsBatteryNotPresent'] !== 'yes')
|
||||
$type = 'xupsBatteryFailure';
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'battery'));
|
||||
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, [ 'entPhysicalClass' => 'battery' ]);
|
||||
|
||||
// xupsBatteryAged
|
||||
$age = $entry['xupsBatteryLastReplacedDate'];
|
||||
$descr = "Battery over aged ($age)";
|
||||
$oid_name = 'xupsBatteryAged';
|
||||
$oid_num = '.1.3.6.1.4.1.534.1.2.9.0';
|
||||
$type = 'xupsBatteryFailure';
|
||||
$type = 'xupsBatteryWarning';
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'battery'));
|
||||
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, [ 'entPhysicalClass' => 'battery' ]);
|
||||
|
||||
// xupsBatteryLowCapacity
|
||||
$descr = 'Battery Low Capacity';
|
||||
@ -370,7 +337,7 @@ if ($entry['xupsBatteryNotPresent'] !== 'yes')
|
||||
$type = 'xupsBatteryFailure';
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'battery'));
|
||||
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, [ 'entPhysicalClass' => 'battery' ]);
|
||||
}
|
||||
|
||||
// xupsBatteryNotPresent
|
||||
@ -380,18 +347,16 @@ $oid_num = '.1.3.6.1.4.1.534.1.2.8.0';
|
||||
$type = 'xupsBatteryNotPresent';
|
||||
$value = $entry[$oid_name];
|
||||
|
||||
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'battery'));
|
||||
discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, [ 'entPhysicalClass' => 'battery' ]);
|
||||
|
||||
if (isset($entry['xupsEnvAmbientTemp']))
|
||||
{
|
||||
if (isset($entry['xupsEnvAmbientTemp'])) {
|
||||
$oid = ".1.3.6.1.4.1.534.1.6.1.0"; # XUPS-MIB:xupsEnvAmbientTemp.0
|
||||
$value = $entry['xupsEnvAmbientTemp'];
|
||||
|
||||
$limits = array('limit_low' => $xups_array[0]['upsEnvAmbientLowerLimit'],
|
||||
'limit_high' => $xups_array[0]['upsEnvAmbientUpperLimit']);
|
||||
$limits = [ 'limit_low' => $xups_array[0]['upsEnvAmbientLowerLimit'],
|
||||
'limit_high' => $xups_array[0]['upsEnvAmbientUpperLimit'] ];
|
||||
|
||||
if ($value != 0)
|
||||
{
|
||||
if ($value != 0) {
|
||||
discover_sensor('temperature', $device, $oid, "xupsEnvAmbientTemp.0", 'xups', "Ambient", 1, $value, $limits);
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,7 +73,6 @@ if (snmp_status())
|
||||
$oid = '.1.3.6.1.4.1.9.9.500.1.1.3.0';
|
||||
$descr = 'Stackports in redundant ring';
|
||||
discover_status_ng($device, $mib, 'cswRingRedundant', $oid, '0', 'cisco-stackwise-redundant-state', $descr, $stackredundant, array('entPhysicalClass' => 'stack'));
|
||||
//discover_status($device, $oid, "cswRingRedundant.0", 'cisco-stackwise-redundant-state', $descr, $stackredundant, array('entPhysicalClass' => 'stack'));
|
||||
|
||||
foreach ($stackportoper as $index => $entry)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -19,123 +19,12 @@ foreach (get_device_mibs_permitted($device) as $mib) {
|
||||
|
||||
if (!is_array($config['mibs'][$mib]['storage'])) { continue; }
|
||||
|
||||
echo("$mib ");
|
||||
print_cli_data_field($mib);
|
||||
foreach ($config['mibs'][$mib]['storage'] as $entry_name => $entry) {
|
||||
$entry['found'] = FALSE;
|
||||
discover_storage_definition($device, $mib, $entry, $entry_name);
|
||||
|
||||
$entry['mib'] = $mib;
|
||||
if (discovery_check_requires_pre($device, $entry, 'storage')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Init Precision (scale)/total/used/free
|
||||
$used = NULL;
|
||||
$total = NULL;
|
||||
$free = NULL;
|
||||
$perc = NULL;
|
||||
$options = [];
|
||||
if (isset($entry['scale']) && is_numeric($entry['scale']) && $entry['scale']) {
|
||||
$scale = $entry['scale'];
|
||||
} else {
|
||||
$scale = 1;
|
||||
}
|
||||
|
||||
/////////////////////
|
||||
// Table Discovery //
|
||||
/////////////////////
|
||||
|
||||
/* FIXME. Partially changed, need rewrite to common style
|
||||
// If the type is table, walk the table!
|
||||
if ($entry['type'] == "table")
|
||||
{
|
||||
$entry['oids'][$entry_name] = $entry_name;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Type is not table, so we have to walk each OID individually
|
||||
foreach (array('oid_total', 'oid_total', 'oid_free', 'oid_perc', 'oid_descr') as $oid)
|
||||
{
|
||||
if (isset($entry[$oid]))
|
||||
{
|
||||
$entry['oids'][$oid] = $entry[$oid];
|
||||
}
|
||||
}
|
||||
}
|
||||
// FIXME - cache this outside the storage array and then just array_merge it in. Descr OIDs are probably shared a lot
|
||||
// FIXME - Allow different MIBs for OIDs. Best done by prefixing with MIB and parsing it out?
|
||||
|
||||
if (isset($entry['extra_oids']))
|
||||
{
|
||||
foreach ((array)$entry['extra_oids'] as $oid)
|
||||
{
|
||||
$entry['oids'][$oid] = $oid;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($entry['oids'] as $oid)
|
||||
{
|
||||
$storage_array = snmpwalk_cache_oid($device, $oid, $storage_array, $mib);
|
||||
}
|
||||
*/
|
||||
|
||||
$table_oids = [ 'oid_total', 'oid_used', 'oid_free', 'oid_perc', 'oid_descr',
|
||||
'oid_scale', 'oid_unit', 'oid_extra',
|
||||
//'oid_limit_low', 'oid_limit_low_warn', 'oid_limit_high_warn', 'oid_limit_high',
|
||||
//'oid_limit_nominal', 'oid_limit_delta_warn', 'oid_limit_delta', 'oid_limit_scale'
|
||||
];
|
||||
$storage_array = discover_fetch_oids($device, $mib, $entry, $table_oids);
|
||||
|
||||
// FIXME - generify description generation code and just pass it template and OID array.
|
||||
|
||||
$i = 1; // Used in descr as %i%
|
||||
$storage_count = count($storage_array);
|
||||
foreach ($storage_array as $index => $storage_entry) {
|
||||
$oid_num = $entry['oid_num'] . '.' . $index;
|
||||
|
||||
// Generate storage description
|
||||
$storage_entry['i'] = $i;
|
||||
$storage_entry['index'] = $index;
|
||||
$descr = entity_descr_definition('storage', $entry, $storage_entry, $storage_count);
|
||||
|
||||
// Convert strings '3.40 TB' to value
|
||||
// See QNAP NAS-MIB or HIK-DEVICE-MIB
|
||||
$unit = isset($entry['unit']) ? $entry['unit'] : NULL;
|
||||
|
||||
// Fetch used, total, free and percentage values, if OIDs are defined for them
|
||||
if (!safe_empty($entry['oid_used'])) {
|
||||
$used = snmp_fix_numeric($storage_entry[$entry['oid_used']], $unit);
|
||||
}
|
||||
if (!safe_empty($entry['oid_free'])) {
|
||||
$free = snmp_fix_numeric($storage_entry[$entry['oid_free']], $unit);
|
||||
}
|
||||
if (!safe_empty($entry['oid_perc'])) {
|
||||
$perc = snmp_fix_numeric($storage_entry[$entry['oid_perc']]);
|
||||
}
|
||||
|
||||
// Prefer hardcoded total over SNMP OIDs
|
||||
if (!safe_empty($entry['total'])) {
|
||||
$total = $entry['total'];
|
||||
} elseif (!safe_empty($entry['oid_total'])) {
|
||||
$total = snmp_fix_numeric($storage_entry[$entry['oid_total']], $unit);
|
||||
}
|
||||
|
||||
// Extrapolate all values from the ones we have.
|
||||
$storage = calculate_mempool_properties($scale, $used, $total, $free, $perc, $options);
|
||||
|
||||
print_debug_vars(array($scale, $used, $total, $free, $perc, $options));
|
||||
print_debug_vars($storage_entry);
|
||||
print_debug_vars($storage);
|
||||
|
||||
print_debug_vars(array(is_numeric($storage['used']), is_numeric($storage['total'])));
|
||||
|
||||
// If we have valid used and total, discover the storage
|
||||
if (is_numeric($storage['used']) && is_numeric($storage['total'])) {
|
||||
discover_storage($valid['storage'], $device, $index, $entry_name, $mib, $descr, $scale, $storage['total'], $storage['used']); // FIXME storage_hc = ??
|
||||
$entry['found'] = TRUE;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print_cli(PHP_EOL);
|
||||
}
|
||||
|
||||
print_debug_vars($valid['storage']);
|
||||
@ -151,7 +40,7 @@ foreach (dbFetchRows($query, array($device['device_id'])) as $test_storage) {
|
||||
|
||||
if (!$valid['storage'][$storage_mib][$storage_index]) {
|
||||
$GLOBALS['module_stats']['storage']['deleted']++; //echo('-');
|
||||
dbDelete('storage', 'storage_id = ?', array($test_storage['storage_id']));
|
||||
dbDelete('storage', 'storage_id = ?', [ $test_storage['storage_id'] ]);
|
||||
log_event("Storage removed: index $storage_index, mib $storage_mib, descr $storage_descr", $device, 'storage', $test_storage['storage_id']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
# lookup for storage data
|
||||
$entry = snmpwalk_cache_oid($device, 'swStorage', NULL, 'EMBEDDED-NGX-MIB');
|
||||
|
||||
if (is_array($entry))
|
||||
{
|
||||
$index = 0;
|
||||
$descr = "Config Storage";
|
||||
$free = $entry[$index]['swStorageConfigFree'] * 1024;
|
||||
$total = $entry[$index]['swStorageConfigTotal'] * 1024;
|
||||
$used = $total - $free;
|
||||
|
||||
discover_storage($valid['storage'], $device, $index, 'StorageConfig', 'EMBEDDED-NGX-MIB', $descr, 1024, $total, $used);
|
||||
}
|
||||
|
||||
unset ($entry, $index, $descr, $total, $used, $free);
|
||||
|
||||
// EOF
|
||||
@ -1,52 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
$mib = 'GPFS-MIB';
|
||||
$cache_discovery['gpfs-mib'] = snmpwalk_cache_oid($device, "gpfsFileSystemStatusTable", array(), $mib);
|
||||
|
||||
if (safe_count($cache_discovery['gpfs-mib'])) {
|
||||
echo(" $mib ");
|
||||
|
||||
/*
|
||||
Available data:
|
||||
|
||||
Array
|
||||
(
|
||||
[gpfsFileSystemName] => scratch_gs
|
||||
[gpfsFileSystemStatus] => recovered
|
||||
[gpfsFileSystemXstatus] => OFW
|
||||
[gpfsFileSystemTotalSpaceL] => 1946157056
|
||||
[gpfsFileSystemTotalSpaceH] => 94
|
||||
[gpfsFileSystemNumTotalInodesL] => 402653184
|
||||
[gpfsFileSystemNumTotalInodesH] => 0
|
||||
[gpfsFileSystemFreeSpaceL] => 37208064
|
||||
[gpfsFileSystemFreeSpaceH] => 26
|
||||
[gpfsFileSystemNumFreeInodesL] => 326910126
|
||||
[gpfsFileSystemNumFreeInodesH] => 0
|
||||
)
|
||||
*/
|
||||
|
||||
foreach ($cache_discovery['gpfs-mib'] as $index => $storage)
|
||||
{
|
||||
$fstype = "gpfs";
|
||||
$descr = "/".$storage['gpfsFileSystemName'];
|
||||
$hc = 1;
|
||||
$size = snmp_size64_high_low($storage['gpfsFileSystemTotalSpaceH'], $storage['gpfsFileSystemTotalSpaceL']) * 1024;
|
||||
$free = snmp_size64_high_low($storage['gpfsFileSystemFreeSpaceH'], $storage['gpfsFileSystemFreeSpaceL']) * 1024;
|
||||
$used = $size - $free;
|
||||
|
||||
discover_storage($valid['storage'], $device, $index, $fstype, $mib, $descr, 1024, $size, $used, array('storage_hc' => $hc));
|
||||
|
||||
unset($deny, $fstype, $descr, $size, $used, $free, $percent, $hc);
|
||||
}
|
||||
unset($index, $storage);
|
||||
}
|
||||
@ -6,7 +6,7 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -101,10 +101,10 @@ if (!safe_empty($hrStorage)) {
|
||||
}
|
||||
}
|
||||
|
||||
if (is_numeric($index)) {
|
||||
if (is_numeric($index) && $size != 0) {
|
||||
discover_storage($valid['storage'], $device, $index, $fstype, $mib, $descr, $units, $size, $used, [ 'storage_hc' => $hc ]);
|
||||
|
||||
$dsk_done[$descr] = $descr;
|
||||
$dsk_done[$descr] = $path;
|
||||
}
|
||||
|
||||
unset($fstype, $descr, $size, $used, $units, $path, $dsk, $hc);
|
||||
@ -136,7 +136,7 @@ if (!safe_empty($cache_discovery['ucd-snmp-mib'])) {
|
||||
$used = $dsk['dskUsed'] * $units;
|
||||
}
|
||||
|
||||
if (is_numeric($index)) {
|
||||
if (is_numeric($index) && $size != 0) {
|
||||
discover_storage($valid['storage'], $device, $index, $fstype, $mib, $descr, $units, $size, $used, [ 'storage_hc' => $hc ]);
|
||||
}
|
||||
unset($fstype, $descr, $size, $used, $units, $hc);
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
// Note, this mountpoint '/ifs' also discovered in HOST-RESOURCES-MIB, but ignored
|
||||
|
||||
//ISILON-MIB::ifsTotalBytes.0 = Counter64: 71376260235264
|
||||
//ISILON-MIB::ifsUsedBytes.0 = Counter64: 38523365810176
|
||||
//ISILON-MIB::ifsAvailableBytes.0 = Counter64: 28651530510336
|
||||
//ISILON-MIB::ifsFreeBytes.0 = Counter64: 32852894425088
|
||||
$cache_discovery['ISILON-MIB'] = snmp_get_multi_oid($device, 'ifsTotalBytes.0 ifsUsedBytes.0', array(), 'ISILON-MIB');
|
||||
if (is_array($cache_discovery['ISILON-MIB'][0]))
|
||||
{
|
||||
$hc = 1;
|
||||
$size = $cache_discovery['ISILON-MIB'][0]['ifsTotalBytes'];
|
||||
$used = $cache_discovery['ISILON-MIB'][0]['ifsUsedBytes'];
|
||||
|
||||
discover_storage($valid['storage'], $device, 0, 'volume', 'ISILON-MIB', '/ifs', 1, $size, $used, array('storage_hc' => $hc));
|
||||
}
|
||||
|
||||
// EOF
|
||||
@ -1,98 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
$cache_discovery['netapp-mib'] = snmpwalk_cache_oid($device, "dfEntry", array(), 'NETAPP-MIB');
|
||||
|
||||
if (safe_count($cache_discovery['netapp-mib'])) {
|
||||
/*
|
||||
Available data:
|
||||
|
||||
array(40) {
|
||||
["dfIndex"]=> "3"
|
||||
["dfFileSys"]=> "/vol/vol0/"
|
||||
["dfKBytesTotal"]=> "158387408"
|
||||
["dfKBytesUsed"]=> "7600652"
|
||||
["dfKBytesAvail"]=> "150786756"
|
||||
["dfPerCentKBytesCapacity"]=> "5"
|
||||
["dfInodesUsed"]=> "9405"
|
||||
["dfInodesFree"]=> "14517028"
|
||||
["dfPerCentInodeCapacity"]=> "0"
|
||||
["dfMountedOn"]=> "/vol/vol0/"
|
||||
["dfMaxFilesAvail"]=> "14526433"
|
||||
["dfMaxFilesUsed"]=> "9405"
|
||||
["dfMaxFilesPossible"]=> "39596840"
|
||||
["dfHighTotalKBytes"]=> "0"
|
||||
["dfLowTotalKBytes"]=> "158387408"
|
||||
["dfHighUsedKBytes"]=> "0"
|
||||
["dfLowUsedKBytes"]=> "7600652"
|
||||
["dfHighAvailKBytes"]=> "0"
|
||||
["dfLowAvailKBytes"]=> "150786756"
|
||||
["dfStatus"]=> "mounted"
|
||||
["dfMirrorStatus"]=> "invalid"
|
||||
["dfPlexCount"]=> "0"
|
||||
["dfType"]=> "flexibleVolume"
|
||||
["dfHighSisSharedKBytes"]=> "0"
|
||||
["dfLowSisSharedKBytes"]=> "0"
|
||||
["dfHighSisSavedKBytes"]=> "0"
|
||||
["dfLowSisSavedKBytes"]=> "0"
|
||||
["dfPerCentSaved"]=> "0"
|
||||
["df64TotalKBytes"]=> "158387408"
|
||||
["df64UsedKBytes"]=> "7600644"
|
||||
["df64AvailKBytes"]=> "150786764"
|
||||
["df64SisSharedKBytes"]=> "0"
|
||||
["df64SisSavedKBytes"]=> "0"
|
||||
["df64CompressSaved"]=> "0"
|
||||
["dfCompressSavedPercent"]=> "0"
|
||||
["df64DedupeSaved"]=> "0"
|
||||
["dfDedupeSavedPercent"]=> "0"
|
||||
["df64TotalSaved"]=> "0"
|
||||
["dfTotalSavedPercent"]=> "0"
|
||||
["df64TotalReservedKBytes"]=> "263724"
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
foreach ($cache_discovery['netapp-mib'] as $index => $storage)
|
||||
{
|
||||
$fstype = $storage['dfType'];
|
||||
$descr = $storage['dfFileSys'];
|
||||
if (!empty($storage['dfVserver']))
|
||||
{
|
||||
// Add server info on cluster devices
|
||||
$descr .= ' - ' . $storage['dfVserver'];
|
||||
}
|
||||
$deny = FALSE;
|
||||
|
||||
if (!$deny)
|
||||
{
|
||||
if (is_numeric($storage['df64TotalKBytes']))
|
||||
{
|
||||
$size = $storage['df64TotalKBytes'] * 1024;
|
||||
$used = $storage['df64UsedKBytes'] * 1024;
|
||||
$hc = 1;
|
||||
} else {
|
||||
$size = $storage['dfKBytesTotal'] * 1024;
|
||||
$used = $storage['dfKBytesUsed'] * 1024;
|
||||
$hc = 0;
|
||||
}
|
||||
|
||||
if (is_numeric($index))
|
||||
{
|
||||
discover_storage($valid['storage'], $device, $index, $fstype, 'NETAPP-MIB', $descr, 1024, $size, $used, array('storage_hc' => $hc));
|
||||
}
|
||||
}
|
||||
unset($deny, $fstype, $descr, $size, $used, $free, $percent, $hc);
|
||||
}
|
||||
unset($index, $storage);
|
||||
}
|
||||
|
||||
// EOF
|
||||
@ -1,49 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
$mib = 'NIMBLE-MIB';
|
||||
|
||||
//$cache_discovery[$mib]
|
||||
$oids = snmpwalk_cache_oid($device, 'volName', array(), $mib);
|
||||
if (count($oids))
|
||||
{
|
||||
foreach (array('volSizeLow', 'volSizeHigh', 'volUsageLow', 'volUsageHigh', 'volOnline') as $oid)
|
||||
{
|
||||
$oids = snmpwalk_cache_oid($device, $oid, $oids, $mib);
|
||||
}
|
||||
if (OBS_DEBUG > 1) { print_vars($oids); }
|
||||
|
||||
foreach ($oids as $index => $storage)
|
||||
{
|
||||
$hc = 1;
|
||||
$fstype = 'volume';
|
||||
$descr = $storage['volName'];
|
||||
$units = 1048576; // Hardcode units. In MIB is written that bytes, but really Mbytes
|
||||
// FIXME, probably need additional field for storages like OperStatus up/down
|
||||
$ignore = in_array($storage['volOnline'], array('0', 'false')) ? 1 : 0;
|
||||
$deny = FALSE;
|
||||
|
||||
$size = snmp_size64_high_low($storage['volSizeHigh'], $storage['volSizeLow']) * $units;
|
||||
$used = snmp_size64_high_low($storage['volUsageHigh'], $storage['volUsageLow']) * $units;
|
||||
|
||||
if (!$deny && is_numeric($index))
|
||||
{
|
||||
discover_storage($valid['storage'], $device, $index, $fstype, $mib, $descr, $units, $size, $used, array('storage_hc' => $hc, 'storage_ignore' => $ignore));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
unset($oids, $deny, $fstype, $descr, $size, $used, $units, $hc);
|
||||
|
||||
// EOF
|
||||
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
@ -7,12 +6,12 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
// NOTE. Here only walking, because needed additional checks by HOST-RESOURCES-MIB (see host-resources-mib.inc.php in current directory)
|
||||
|
||||
$cache_discovery['ucd-snmp-mib'] = snmpwalk_cache_oid($device, 'dskEntry', array(), 'UCD-SNMP-MIB');
|
||||
$cache_discovery['ucd-snmp-mib'] = snmpwalk_cache_oid($device, 'dskEntry', [], 'UCD-SNMP-MIB');
|
||||
|
||||
// EOF
|
||||
|
||||
57
includes/discovery/vlans/a3com-huawei-lswvlan-mib.inc.php
Normal file
57
includes/discovery/vlans/a3com-huawei-lswvlan-mib.inc.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
$domain_index = '1';
|
||||
|
||||
$hwdot1qVlan = snmpwalk_cache_oid($device, 'hwdot1qVlanMIBTable', [], 'A3COM-HUAWEI-LswVLAN-MIB');
|
||||
|
||||
/* Base port ifIndex association */
|
||||
$dot1d_baseports = snmp_cache_table($device, 'dot1dBasePortIfIndex', [], 'BRIDGE-MIB');
|
||||
|
||||
foreach ($hwdot1qVlan as $vlan_num => $vlan) {
|
||||
|
||||
$vlan_array = [
|
||||
'ifIndex' => $vlan['hwVlanInterfaceIndex'],
|
||||
'vlan_domain' => $domain_index,
|
||||
'vlan_vlan' => $vlan_num,
|
||||
'vlan_name' => $vlan['hwdot1qVlanName'],
|
||||
//'vlan_mtu' => '',
|
||||
'vlan_type' => $vlan['hwdot1qVlanType'],
|
||||
'vlan_status' => 'operational'
|
||||
];
|
||||
$discovery_vlans[$domain_index][$vlan_num] = $vlan_array;
|
||||
|
||||
// Convert hex to binary map
|
||||
$binary = hex2binmap($vlan['hwdot1qVlanPorts']);
|
||||
|
||||
// Assign binary vlans map to ports
|
||||
$length = strlen($binary);
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
if ($binary[$i]) {
|
||||
|
||||
//if ($use_baseports) {
|
||||
// Skip all unknown indexes (OBS-2958)
|
||||
if (!isset($dot1d_baseports[$i + 1]['dot1dBasePortIfIndex'])) { continue; }
|
||||
$ifIndex = $dot1d_baseports[$i + 1]['dot1dBasePortIfIndex'];
|
||||
// } else {
|
||||
// $ifIndex = $i;
|
||||
// }
|
||||
//$binary_debug[$vlan_num][$i] = $ifIndex; // DEBUG
|
||||
|
||||
$discovery_ports_vlans[$ifIndex][$vlan_num] = [
|
||||
'vlan' => $vlan_num,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// EOF
|
||||
@ -86,7 +86,7 @@ foreach ($ports_vlans_oids as $ifIndex => $entry)
|
||||
{
|
||||
$vlan_num = $i;
|
||||
|
||||
//print_debug("ifIndex = $ifIndex, \$i = $i, mode ${entry['portMode']}");
|
||||
//print_debug("ifIndex = $ifIndex, \$i = $i, mode {$entry['portMode']}");
|
||||
if (isset($discovery_vlans[$vtp_domain_index][$vlan_num]))
|
||||
{
|
||||
$discovery_ports_vlans[$ifIndex][$vlan_num] = array('vlan' => $vlan_num);
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
/*
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage discovery
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
@ -20,13 +20,13 @@ $domain_index = '1';
|
||||
if (safe_count($discovery_vlans[$domain_index]) &&
|
||||
is_device_mib($device, [ 'CISCOSB-vlan-MIB', 'RADLAN-vlan-MIB', 'Dell-vlan-MIB',
|
||||
'DLINK-3100-vlan-MIB', 'EDGECORE-vlan-MIB', 'NETGEAR-RADLAN-vlan-MIB',
|
||||
'IEEE8021-Q-BRIDGE-MIB' ])) {
|
||||
'A3COM-HUAWEI-LswVLAN-MIB', 'IEEE8021-Q-BRIDGE-MIB' ])) {
|
||||
// Already discovered by RADLAN based vlans or IEEE8021-Q-BRIDGE-MIB
|
||||
return;
|
||||
}
|
||||
|
||||
// Simplify dot1qVlanStaticTable walk
|
||||
$dot1q_ports = snmpwalk_cache_oid($device, 'dot1qVlanStaticName', array(), 'Q-BRIDGE-MIB');
|
||||
$dot1q_ports = snmpwalk_cache_oid($device, 'dot1qVlanStaticName', [], 'Q-BRIDGE-MIB');
|
||||
//$dot1q_ports = snmpwalk_cache_oid($device, 'dot1qVlanStaticTable', array(), 'Q-BRIDGE-MIB', NULL, OBS_SNMP_ALL_MULTILINE | OBS_SNMP_HEX);
|
||||
if (!snmp_status()) {
|
||||
return;
|
||||
@ -35,14 +35,13 @@ if (!snmp_status()) {
|
||||
$dot1q_ports = snmpwalk_cache_oid($device, 'dot1qVlanStaticRowStatus', $dot1q_ports, 'Q-BRIDGE-MIB');
|
||||
$dot1q_ports = snmpwalk_cache_oid($device, 'dot1qVlanStaticEgressPorts', $dot1q_ports, 'Q-BRIDGE-MIB', NULL, OBS_SNMP_ALL_MULTILINE | OBS_SNMP_HEX);
|
||||
|
||||
if (is_device_mib($device, 'JUNIPER-VLAN-MIB')) // Unsure if other Juniper platforms "affected"
|
||||
{
|
||||
if (is_device_mib($device, 'JUNIPER-VLAN-MIB')) { // Unsure if other Juniper platforms "affected"
|
||||
// Fetch Juniper VLAN table for correct tag
|
||||
$dot1q_ports = snmpwalk_cache_oid($device, 'jnxExVlanTable', $dot1q_ports, 'JUNIPER-VLAN-MIB');
|
||||
}
|
||||
|
||||
/* Base port ifIndex association */
|
||||
$dot1d_baseports = snmp_cache_table($device, 'dot1dBasePortIfIndex', array(), 'BRIDGE-MIB');
|
||||
$dot1d_baseports = snmp_cache_table($device, 'dot1dBasePortIfIndex', [], 'BRIDGE-MIB');
|
||||
|
||||
// Detect min ifIndex for vlan base ports
|
||||
// Why, see here: http://jira.observium.org/browse/OBS-963
|
||||
@ -62,11 +61,11 @@ if ($use_baseports)
|
||||
}*/
|
||||
/* End base port ifIndex association */
|
||||
|
||||
$binary_debug = array(); // DEBUG
|
||||
$binary_debug = []; // DEBUG
|
||||
foreach ($dot1q_ports as $vlan_num => $vlan) {
|
||||
$vlan['ifIndex'] = $vlan_num;
|
||||
// FTOS vlan fix
|
||||
if ($device['os'] == 'ftos') {
|
||||
if ($device['os'] === 'ftos') {
|
||||
// Q-BRIDGE-MIB::dot1qVlanStaticEgressPorts.1107787777, where 1107787777 is ifIndex for Vlan interface
|
||||
//IF-MIB::ifDescr.1107787777 = STRING: Vlan 1
|
||||
//IF-MIB::ifDescr.1107787998 = STRING: Vlan 222
|
||||
@ -79,13 +78,15 @@ foreach ($dot1q_ports as $vlan_num => $vlan) {
|
||||
$vlan_num = $vlan['jnxExVlanTag'];
|
||||
}
|
||||
|
||||
$vlan_array = array('ifIndex' => $vlan['ifIndex'],
|
||||
'vlan_domain' => $domain_index,
|
||||
'vlan_vlan' => $vlan_num,
|
||||
'vlan_name' => $vlan['dot1qVlanStaticName'],
|
||||
//'vlan_mtu' => '',
|
||||
'vlan_type' => 'ethernet',
|
||||
'vlan_status' => 'operational');
|
||||
$vlan_array = [
|
||||
'ifIndex' => $vlan['ifIndex'],
|
||||
'vlan_domain' => $domain_index,
|
||||
'vlan_vlan' => $vlan_num,
|
||||
'vlan_name' => $vlan['dot1qVlanStaticName'],
|
||||
//'vlan_mtu' => '',
|
||||
'vlan_type' => 'ethernet',
|
||||
'vlan_status' => 'operational'
|
||||
];
|
||||
$discovery_vlans[$domain_index][$vlan_num] = $vlan_array;
|
||||
/* End vlans discovery */
|
||||
|
||||
@ -95,30 +96,27 @@ foreach ($dot1q_ports as $vlan_num => $vlan) {
|
||||
$binary = hex2binmap($vlan['dot1qVlanStaticEgressPorts']);
|
||||
|
||||
|
||||
if ($device['os'] == 'ftos') // FTOS specific
|
||||
{
|
||||
if ($device['os'] === 'ftos') { // FTOS specific
|
||||
// FTOS devices use harder way for detect VLANs and associate ports
|
||||
// See: https://www.force10networks.com/CSPortal20/TechTips/0041B_displaying_vlan_ports.aspx
|
||||
// Port associations based on slot/port, each 12 hex pair (96 bin) is slot
|
||||
|
||||
foreach (str_split($binary, 96) as $slot => $binary_map)
|
||||
{
|
||||
foreach (str_split($binary, 96) as $slot => $binary_map) {
|
||||
$length = strlen($binary_map);
|
||||
for ($i = 0; $i < $length; $i++)
|
||||
{
|
||||
if ($binary_map[$i])
|
||||
{
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
if ($binary_map[$i]) {
|
||||
// Now find slot/port from ifDescr
|
||||
$port_map = '% '.$slot.'/'.($i + 1);
|
||||
$ifIndex = dbFetchCell("SELECT `ifIndex` FROM `ports` WHERE `device_id` = ? AND `ifDescr` LIKE ? AND `deleted` = ? LIMIT 1", array($device['device_id'], $port_map, 0));
|
||||
$ifIndex = dbFetchCell("SELECT `ifIndex` FROM `ports` WHERE `device_id` = ? AND `ifDescr` LIKE ? AND `deleted` = ? LIMIT 1", [ $device['device_id'], $port_map, 0 ]);
|
||||
|
||||
$discovery_ports_vlans[$ifIndex][$vlan_num] = array('vlan' => $vlan_num,
|
||||
// FIXME. move STP to separate table
|
||||
//'baseport' => $vlan_port_id,
|
||||
//'priority' => $vlan_port['dot1dStpPortPriority'],
|
||||
//'state' => $vlan_port['dot1dStpPortState'],
|
||||
//'cost' => $vlan_port['dot1dStpPortPathCost']
|
||||
);
|
||||
$discovery_ports_vlans[$ifIndex][$vlan_num] = [
|
||||
'vlan' => $vlan_num,
|
||||
// FIXME. move STP to separate table
|
||||
//'baseport' => $vlan_port_id,
|
||||
//'priority' => $vlan_port['dot1dStpPortPriority'],
|
||||
//'state' => $vlan_port['dot1dStpPortState'],
|
||||
//'cost' => $vlan_port['dot1dStpPortPathCost']
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -128,13 +126,10 @@ foreach ($dot1q_ports as $vlan_num => $vlan) {
|
||||
|
||||
// Assign binary vlans map to ports
|
||||
$length = strlen($binary);
|
||||
for ($i = 0; $i < $length; $i++)
|
||||
{
|
||||
if ($binary[$i])
|
||||
{
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
if ($binary[$i]) {
|
||||
//$ifIndex = $i + $vlan_ifindex_min; // This is incorrect ifIndex association!
|
||||
if ($use_baseports)
|
||||
{
|
||||
if ($use_baseports) {
|
||||
// Skip all unknown indexes (OBS-2958)
|
||||
if (!isset($dot1d_baseports[$i + 1]['dot1dBasePortIfIndex'])) { continue; }
|
||||
$ifIndex = $dot1d_baseports[$i + 1]['dot1dBasePortIfIndex'];
|
||||
@ -143,13 +138,14 @@ foreach ($dot1q_ports as $vlan_num => $vlan) {
|
||||
}
|
||||
$binary_debug[$vlan_num][$i] = $ifIndex; // DEBUG
|
||||
|
||||
$discovery_ports_vlans[$ifIndex][$vlan_num] = array('vlan' => $vlan_num,
|
||||
// FIXME. move STP to separate table
|
||||
//'baseport' => $vlan_port_id,
|
||||
//'priority' => $vlan_port['dot1dStpPortPriority'],
|
||||
//'state' => $vlan_port['dot1dStpPortState'],
|
||||
//'cost' => $vlan_port['dot1dStpPortPathCost']
|
||||
);
|
||||
$discovery_ports_vlans[$ifIndex][$vlan_num] = [
|
||||
'vlan' => $vlan_num,
|
||||
// FIXME. move STP to separate table
|
||||
//'baseport' => $vlan_port_id,
|
||||
//'priority' => $vlan_port['dot1dStpPortPriority'],
|
||||
//'state' => $vlan_port['dot1dStpPortState'],
|
||||
//'cost' => $vlan_port['dot1dStpPortPathCost']
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,18 +154,18 @@ foreach ($dot1q_ports as $vlan_num => $vlan) {
|
||||
print_debug_vars($binary_debug); // DEBUG
|
||||
|
||||
// As last point validate access ports that vlan is added (some devices not report it in dot1qVlanStaticTable)
|
||||
$dot1q_ports = snmpwalk_cache_oid($device, 'dot1qPvid', array(), 'Q-BRIDGE-MIB');
|
||||
foreach ($dot1q_ports as $entry)
|
||||
{
|
||||
$dot1q_ports = snmpwalk_cache_oid($device, 'dot1qPvid', [], 'Q-BRIDGE-MIB');
|
||||
foreach ($dot1q_ports as $entry) {
|
||||
$vlan_num = $entry['dot1qPvid'];
|
||||
if (!isset($discovery_vlans[$domain_index][$vlan_num]))
|
||||
{
|
||||
$vlan_array = array('vlan_domain' => $domain_index,
|
||||
'vlan_vlan' => $vlan_num,
|
||||
'vlan_name' => 'VLAN '.$vlan_num,
|
||||
//'vlan_mtu' => '',
|
||||
'vlan_type' => 'ethernet',
|
||||
'vlan_status' => 'operational');
|
||||
if (!isset($discovery_vlans[$domain_index][$vlan_num])) {
|
||||
$vlan_array = [
|
||||
'vlan_domain' => $domain_index,
|
||||
'vlan_vlan' => $vlan_num,
|
||||
'vlan_name' => 'VLAN '.$vlan_num,
|
||||
//'vlan_mtu' => '',
|
||||
'vlan_type' => 'ethernet',
|
||||
'vlan_status' => 'operational'
|
||||
];
|
||||
$discovery_vlans[$domain_index][$vlan_num] = $vlan_array;
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ if (!$config['enable_vrfs']) {
|
||||
// Clean removed VRFs
|
||||
print_debug_vars($valid['vrf']);
|
||||
$where = '`device_id` = ?';
|
||||
$where .= generate_query_values(array_keys((array)$valid['vrf']), 'vrf_name', '!=');
|
||||
$where .= generate_query_values_and(array_keys((array)$valid['vrf']), 'vrf_name', '!=');
|
||||
if ($count = dbFetchCell("SELECT COUNT(*) FROM `vrfs` WHERE $where", [ $device['device_id'] ])) {
|
||||
$GLOBALS['module_stats'][$module]['deleted'] = $count;
|
||||
dbDelete('vrfs', $where, [ $device['device_id'] ]);
|
||||
@ -60,7 +60,7 @@ if (!$config['enable_vrfs']) {
|
||||
}
|
||||
print_debug_vars($vrf_ports);
|
||||
$where = '`device_id` = ? AND `ifVrf` IS NOT NULL';
|
||||
$where .= generate_query_values($vrf_ports, 'port_id', '!=');
|
||||
$where .= generate_query_values_and($vrf_ports, 'port_id', '!=');
|
||||
if ($count = dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE $where", [ $device['device_id'] ])) {
|
||||
//$GLOBALS['module_stats'][$module]['deleted'] = $count;
|
||||
dbUpdate([ 'ifVrf' => [ 'NULL' ] ], 'ports', $where, [ $device['device_id'] ]);
|
||||
|
||||
Reference in New Issue
Block a user