Index: includes/discovery/sensors/power-ethernet-mib.inc.php
===================================================================
--- includes/discovery/sensors/power-ethernet-mib.inc.php       (revision 10898)
+++ includes/discovery/sensors/power-ethernet-mib.inc.php       (working copy)
@@ -173,6 +173,19 @@
   $oids = snmpwalk_cache_oid($device, 'extremePethPsePortEntry', $oids, 'EXTREME-POE-MIB');
 }

+if (is_device_mib($device, 'BAY-STACK-PETH-EXT-MIB'))
+{
+  // BAY-STACK-PETH-EXT-MIB::bspePethPsePortExtPowerLimit.1.1 = 32
+  // BAY-STACK-PETH-EXT-MIB::bspePethPsePortExtMeasuredVoltage.1.1 = 0
+  // BAY-STACK-PETH-EXT-MIB::bspePethPsePortExtMeasuredCurrent.1.1 = 0
+  // BAY-STACK-PETH-EXT-MIB::bspePethPsePortExtMeasuredPower.1.1 = 0
+  // BAY-STACK-PETH-EXT-MIB::bspePethPsePortExtPowerUpMode.1.1 = dot3at
+  // BAY-STACK-PETH-EXT-MIB::bspePethPsePortExtPowerPairs.1.1 = signal
+
+
+  $oids = snmpwalk_cache_oid($device, 'BspePethPsePortExtEntry', $oids, 'BAY-STACK-PETH-EXT-MIB');
+}
+
 // Radlan based MIBs

 if (is_device_mib($device, 'CISCOSB-POE-MIB'))
@@ -470,7 +483,133 @@
       discover_sensor_ng($device, 'power', 'EXTREME-POE-MIB', $oid_name, $oid_num, $index, $type, $descr, 0.001, $value, $options);
     }
   }
+
+  // BAY-STACK-PETH-EXT-MIB
+
+  // BAY-STACK-PETH-EXT-MIB::pethPsePortAdminEnable.1.1 = true
+  // BAY-STACK-PETH-EXT-MIB::pethPsePortPowerPairsControlAbility.1.1 = false
+  // BAY-STACK-PETH-EXT-MIB::pethPsePortDetectionStatus.1.1 = searching
+  // BAY-STACK-PETH-EXT-MIB::pethPsePortPowerPriority.1.1 = low
+  // BAY-STACK-PETH-EXT-MIB::pethPsePortMPSAbsentCounter.1.1 = 0
+  // BAY-STACK-PETH-EXT-MIB::pethPsePortType.1.1 =
+  // BAY-STACK-PETH-EXT-MIB::pethPsePortPowerClassifications.1.1 = class0
+  // BAY-STACK-PETH-EXT-MIB::pethPsePortInvalidSignatureCounter.1.1 = 239
+  // BAY-STACK-PETH-EXT-MIB::pethPsePortPowerDeniedCounter.1.1 = 0
+  // BAY-STACK-PETH-EXT-MIB::pethPsePortOverLoadCounter.1.1 = 0
+  // BAY-STACK-PETH-EXT-MIB::pethPsePortShortCounter.1.1 = 0
+  // BAY-STACK-PETH-EXT-MIB::bspePethPsePortExtPowerLimit.1.1 = 32
+  // BAY-STACK-PETH-EXT-MIB::bspePethPsePortExtMeasuredVoltage.1.1 = 0
+  // BAY-STACK-PETH-EXT-MIB::bspePethPsePortExtMeasuredCurrent.1.1 = 0
+  // BAY-STACK-PETH-EXT-MIB::bspePethPsePortExtMeasuredPower.1.1 = 0
+  // BAY-STACK-PETH-EXT-MIB::bspePethPsePortExtPowerUpMode.1.1 = dot3at
+  // BAY-STACK-PETH-EXT-MIB::bspePethPsePortExtPowerPairs.1.1 = signal

+  if (isset($entry['bspePethPsePortExtMeasuredPower']))
+  {
+    $descr    = $entry['ifDescr'] . ' PoE Power' . $group;
+    $oid_name = 'bspePethPsePortExtMeasuredPower';
+    $oid_num  = ".1.3.6.1.4.1.45.5.8.1.1.1.7.$index";
+    $type     = 'BAY-STACK-PETH-EXT-MIB-' . $oid_name;
+    $value    = $entry[$oid_name];
+
+    // Limits
+       // bspePethPsePortExtPowerLimit.1.1 = 32
+    $options['limit_high'] = $entry['bspePethPsePortExtMeasuredPower'] > 0 ? $entry['bspePethPsePortExtPowerLimit'] : $entry['bspePethPsePortExtMeasuredPower'];
+    if ($options['limit_high'] > 0)
+    {
+      $options['limit_high_warn'] = $options['limit_high'] * $warning_threshold; // Warning at 90% of power limit - FIXME should move to centralized smart calculation function
+    } else {
+      unset($options['limit_high']);
+    }
+
+    // Skip not powered
+    $deny = in_array($entry['pethPsePortDetectionStatus'], ['searching', 'disabled', 'otherFault']) &&
+            $entry['bspePethPsePortExtMeasuredPower'] == '0' && $entry['bspePethPsePortExtMeasuredVoltage'] == '0' && $entry['bspePethPsePortExtMeasuredCurrent'] == '0';
+
+    if (!$deny)
+    {
+      discover_sensor_ng($device, 'power', 'BAY-STACK-PETH-EXT-MIB', $oid_name, $oid_num, $index, NULL, $descr, 0.001, $value, $options);
+    }
+
+    $descr    = $entry['ifDescr'] . ' PoE Current' . $group;
+    $oid_name = 'bspePethPsePortExtMeasuredCurrent';
+    $oid_num  = ".1.3.6.1.4.1.45.5.8.1.1.1.6.$index";
+    $type     = 'BAY-STACK-PETH-EXT-MIB-' . $oid_name;
+    $value    = $entry[$oid_name];
+
+    unset($options['limit_high'], $options['limit_high_warn']);
+
+    if (!$deny)
+    {
+      discover_sensor_ng($device, 'current', 'BAY-STACK-PETH-EXT-MIB', $oid_name, $oid_num, $index, NULL, $descr, 0.001, $value, $options);
+    }
+
+    $descr    = $entry['ifDescr'] . ' PoE Voltage' . $group;
+    $oid_name = 'bspePethPsePortExtMeasuredVoltage';
+    $oid_num  = ".1.3.6.1.4.1.45.5.8.1.1.1.5.$index";
+    $type     = 'BAY-STACK-PETH-EXT-MIB-' . $oid_name;
+    $value    = $entry[$oid_name];
+
+    unset($options['limit_high'], $options['limit_high_warn']);
+
+    if (!$deny)
+    {
+      discover_sensor_ng($device, 'voltage', 'BAY-STACK-PETH-EXT-MIB', $oid_name, $oid_num, $index, $type, $descr, 0.1, $value, $options);
+    }
+
+       $descr    = $entry['ifDescr'] . ' PoE Invalid Signature' . $group;
+    $oid_name = 'pethPsePortInvalidSignatureCounter';
+    $oid_num  = "1.3.6.1.2.1.105.1.1.1.11.$index";
+    $type     = 'POWER-ETHERNET-MIB-' . $oid_name;
+    $value    = $entry[$oid_name];
+
+    unset($options['limit_high'], $options['limit_high_warn']);
+
+    if (!$deny)
+    {
+         discover_counter($device, 'counter', 'POWER-ETHERNET-MIB', $oid_name, $oid_num, $index, $descr, 1, $value);
+    }
+
+       $descr    = $entry['ifDescr'] . ' PoE Power denied' . $group;
+    $oid_name = 'pethPsePortPowerDeniedCounter';
+    $oid_num  = "1.3.6.1.2.1.105.1.1.1.12.$index";
+    $type     = 'POWER-ETHERNET-MIB-' . $oid_name;
+    $value    = $entry[$oid_name];
+
+    unset($options['limit_high'], $options['limit_high_warn']);
+
+    if (!$deny)
+    {
+         discover_counter($device, 'counter', 'POWER-ETHERNET-MIB', $oid_name, $oid_num, $index, $descr, 1, $value);
+    }
+
+       $descr    = $entry['ifDescr'] . ' PoE Overload' . $group;
+    $oid_name = 'pethPsePortOverLoadCounter';
+    $oid_num  = "1.3.6.1.2.1.105.1.1.1.13.$index";
+    $type     = 'POWER-ETHERNET-MIB-' . $oid_name;
+    $value    = $entry[$oid_name];
+
+    unset($options['limit_high'], $options['limit_high_warn']);
+
+    if (!$deny)
+    {
+         discover_counter($device, 'counter', 'POWER-ETHERNET-MIB', $oid_name, $oid_num, $index, $descr, 1, $value);
+    }
+
+       $descr    = $entry['ifDescr'] . ' PoE Short' . $group;
+    $oid_name = 'pethPsePortShortCounter';
+    $oid_num  = "1.3.6.1.2.1.105.1.1.1.14.$index";
+    $type     = 'POWER-ETHERNET-MIB-' . $oid_name;
+    $value    = $entry[$oid_name];
+
+    unset($options['limit_high'], $options['limit_high_warn']);
+
+    if (!$deny)
+    {
+         discover_counter($device, 'counter', 'POWER-ETHERNET-MIB', $oid_name, $oid_num, $index, $descr, 1, $value);
+    }
+  }
+
   // CISCOSB-POE-MIB / MARVELL-POE-MIB

   if (isset($entry['rlPethPsePortOutputPower']))