Index: includes/discovery/sensors/xups-mib.inc.php
===================================================================
--- includes/discovery/sensors/xups-mib.inc.php	(revision 10506)
+++ includes/discovery/sensors/xups-mib.inc.php	(working copy)
@@ -15,7 +15,6 @@
 $xups_array = snmpwalk_cache_multi_oid($device, "xupsOutput", $xups_array, "XUPS-MIB");
 $xups_array = snmpwalk_cache_multi_oid($device, "xupsBypass", $xups_array, "XUPS-MIB");
 $xups_array = snmpwalk_cache_multi_oid($device, "xupsConfig", $xups_array, "XUPS-MIB");
-
 // XUPS-MIB::xupsConfigOutputVoltage.0 = INTEGER: 230 RMS Volts
 // XUPS-MIB::xupsConfigInputVoltage.0 = INTEGER: 230 RMS Volts
 // XUPS-MIB::xupsConfigOutputWatts.0 = INTEGER: 2700 Watts
@@ -24,8 +23,15 @@
 // XUPS-MIB::xupsConfigLowOutputVoltageLimit.0 = INTEGER: 140 RMS Volts
 // XUPS-MIB::xupsConfigHighOutputVoltageLimit.0 = INTEGER: 276 RMS Volts
 
+
 $xups_base = $xups_array[0];
+
+
+
+
+
 unset($xups_array[0]);
+$mib = "XUPS-MIB::";
 
 foreach ($xups_array as $index => $entry)
 {
@@ -35,7 +41,7 @@
     $descr = "Input";
     if ($xups_base['xupsInputNumPhases'] > 1)
     {
-      $descr .= " Phase $index";
+      $descr .= "Phase $index";
     }
 
     ## Input voltage
@@ -75,6 +81,8 @@
   }
 
   // Output
+  
+
   if (isset($entry['xupsOutputPhase']))
   {
     $descr = "Output";
@@ -99,16 +107,28 @@
       discover_sensor('voltage', $device, $oid, "xupsOutputEntry.".$index, 'xups', $descr, 1, $value, $limits);
     }
 
-    ## Output current
-    $oid   = ".1.3.6.1.4.1.534.1.4.4.1.3.$index"; # XUPS-MIB::xupsOutputCurrent.$index
-    $value = $entry['xupsOutputCurrent'];
+    // Output current
+    $value = $entry['xupsOutputCurrentHighPrecision'];
+    $valueAlt = $entry['xupsOutputCurrent'];
+    $limits = [];
+
     if ($value != 0 &&
         !isset($valid['sensor']['current']['mge-ups'][$index]))
-    {
-      discover_sensor('current', $device, $oid, "xupsOutputEntry.".$index, 'xups', $descr, 1, $value);
-    }
+	    {
+       $limits = [];
+       $limits = array('limit_auto' => FALSE, );
+ 		   $oid   = ".1.3.6.1.4.1.534.1.4.4.1.7.$index"; # XUPS-MIB::xupsOutputCurrentHighPrecision.$index
+ 		   discover_sensor('current', $device, $oid, "xupsOutputEntry.".$index, 'xups', $descr, 0.1, $value, $limits );
+   		 }
 
-    ## Output power
+    elseif  ($valueAlt != 0 &&
+         !isset($valid['sensor']['current']['mge-ups'][$index]))
+     {
+			$oid   = ".1.3.6.1.4.1.534.1.4.4.1.3.$index"; # XUPS-MIB::xupsOutputCurrent.$index
+  	  discover_sensor('current', $device, $oid, "xupsOutputEntry.".$index, 'xups', $descr, 1, $valueAlt);
+      }
+
+    // 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)
@@ -120,7 +140,17 @@
         $limits['limit_high']       = $xups_base['xupsConfigOutputWatts'] * 0.95;
       }
       discover_sensor('power', $device, $oid, "xupsOutputEntry.".$index, 'xups', $descr, 1, $value, $limits);
+
     }
+        ## 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)
+    {
+      
+      discover_sensor('apower', $device, $oid, "xupsOutputEntry.".$index, 'xups', $descr, 1, $value);
+     }
+
   }
 
   // Bypass
@@ -138,6 +168,12 @@
     if ($value != 0)
     {
       discover_sensor('voltage', $device, $oid, "xupsBypassEntry.".$index, 'xups', $descr, 1, $value);
+ 
+
+    // Bypass current
+    $value = $entry['xupsBypassCurrentHighPrecision'];
+    $oid   = ".1.3.6.1.4.1.534.1.5.3.1.5.$index"; # XUPS-MIB::xupsBypassCurrentHighPrecision.$index
+    discover_sensor('current', $device, $oid, "xupsBypassEntry.".$index, 'xups', $descr, 0.1, $value);
     }
   }
 }
@@ -144,6 +180,8 @@
 
 $entry = $xups_base;
 
+
+
 ## Input frequency
 $oid   = ".1.3.6.1.4.1.534.1.3.1.0"; # XUPS-MIB::xupsInputFrequency.0
 $scale = 0.1;
@@ -163,7 +201,15 @@
   $limits = [ 'limit_high_warn' => 80, 'limit_high' => 95 ];
   discover_sensor('load', $device, $oid, "xupsOutputLoad.0", 'xups', $descr, 1, $value, $limits);
 }
+## Output Power Factor
+$oid   = ".1.3.6.1.4.1.534.1.4.9.5.0"; # XUPS-MIB::xupsOutputAveragePowerFactor.0
+$descr = "Output Power Factor";
+$value = $entry['xupsOutputAveragePowerFactor'];
 
+discover_sensor('powerfactor', $device, $oid, "xupsOutputAveragePowerFactor.0", 'xups', $descr, 1, $value);
+
+
+
 ## Output Frequency
 $oid   = ".1.3.6.1.4.1.534.1.4.2.0"; # XUPS-MIB::xupsOutputFrequency.0
 $value = $entry['xupsOutputFrequency'];
@@ -173,8 +219,10 @@
   $limits = [];
   if ($xups_base['xupsConfigOutputFreq'])
   {
-    $limits['limit_low']  = $xups_base['xupsConfigOutputFreq'] * 0.096; // 50 -> 48
-    $limits['limit_high'] = $xups_base['xupsConfigOutputFreq'] * 0.104; // 50 -> 52
+    $limits['limit_low'] 			 = $xups_base['xupsConfigOutputFreq'] * 0.099; // 50 -> 49,5
+    $limits['limit_high'] 		 = $xups_base['xupsConfigOutputFreq'] * 0.101; // 50 -> 50,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 
   }
   discover_sensor('frequency', $device, $oid, "xupsOutputFrequency.0", 'xups', "Output", $scale, $value, $limits);
 }
@@ -222,6 +270,8 @@
 
 $entry = $xups_array[0];
 
+
+
 if (isset($entry['xupsBatTimeRemaining']) &&
     !isset($valid['sensor']['runtime']['mge']['upsmgBatteryRemainingTime.0']))
 {
@@ -241,18 +291,7 @@
   discover_sensor('capacity', $device, $oid, "xupsBatCapacity.0", 'xups', "Battery Capacity", 1, $value);
 }
 
-if (isset($entry['xupsBatCurrent']))
-{
-  $oid   = ".1.3.6.1.4.1.534.1.2.3.0"; # XUPS-MIB::xupsBatCurrent.0
-  $value = $entry['xupsBatCurrent'];
 
-  if ($value != 0 &&
-      !isset($valid['sensor']['current']['mge']['upsmgBatteryCurrent.0']))
-  {
-    discover_sensor('current', $device, $oid, "xupsBatCurrent.0", 'xups', "Battery", 1, $value);
-  }
-}
-
 if (isset($entry['xupsBatVoltage']))
 {
   $oid   = ".1.3.6.1.4.1.534.1.2.2.0"; # XUPS-MIB::xupsBatVoltage.0
@@ -263,6 +302,14 @@
   {
     discover_sensor('voltage', $device, $oid, "xupsBatVoltage.0", 'xups', "Battery", 1, $value);
   }
+  
+   $oid   = ".1.3.6.1.4.1.534.1.2.3.0"; # XUPS-MIB::xupsBatCurrent.0
+  $value = $entry['xupsBatCurrent'];
+
+  if ( !isset($valid['sensor']['current']['mge']['upsmgBatteryCurrent.0']))
+  {
+    discover_sensor('current', $device, $oid, "xupsBatCurrent.0", 'xups', "Battery", 1, $value);
+  }
 }
 
 // xupsBatteryAbmStatus
@@ -274,6 +321,49 @@
 
 discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'battery'));
 
+// xupsBatteryFailure
+$descr    = 'Battery Failure';
+$oid_name = 'xupsBatteryFailure';
+$oid_num  = '.1.3.6.1.4.1.534.1.2.7.0';
+$type     = 'xupsYesNoA';
+$value    = $entry[$oid_name];
+
+discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'battery'));
+
+// xupsBatteryNotPresent
+$descr    = 'Battery Not Present';
+$oid_name = 'xupsBatteryNotPresent';
+$oid_num  = '.1.3.6.1.4.1.534.1.2.8.0';
+$type     = 'xupsYesNoA';
+$value    = $entry[$oid_name];
+
+discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'battery'));
+
+
+// xupsBatteryAged
+$age 			=	$entry['xupsBatteryLastReplacedDate'];
+$descr    = "Battery Old Age ($age)";
+$oid_name = 'xupsBatteryAged';
+$oid_num  = '.1.3.6.1.4.1.534.1.2.9.0';
+$type     = 'xupsYesNoW';
+$value    = $entry[$oid_name];
+//print (($entry['xupsBatteryLastReplacedDate']));
+
+discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'battery'));
+
+// xupsBatteryLowCapacity
+$descr    = 'Battery Low Capacity';
+$oid_name = 'xupsBatteryLowCapacity';
+$oid_num  = '.1.3.6.1.4.1.534.1.2.10.0';
+$type     = 'xupsYesNoW';
+$value    = $entry[$oid_name];
+
+discover_status($device, $oid_num, $oid_name.'.'.$index, $type, $descr, $value, array('entPhysicalClass' => 'battery'));
+
+
+
+
+
 if (isset($entry['xupsEnvAmbientTemp']))
 {
   $oid   = ".1.3.6.1.4.1.534.1.6.1.0"; # XUPS-MIB:xupsEnvAmbientTemp.0
Index: includes/definitions/mibs/eaton.inc.php
===================================================================
--- includes/definitions/mibs/eaton.inc.php	(revision 10506)
+++ includes/definitions/mibs/eaton.inc.php	(working copy)
@@ -84,6 +84,16 @@
 $config['mibs'][$mib]['states'][$type][7] = array('name' => 'batteryUnderTest', 'event' => 'ok');
 $config['mibs'][$mib]['states'][$type][8] = array('name' => 'checkBattery', 'event' => 'alert');
 
+$type = 'xupsYesNoA';
+$config['mibs'][$mib]['states'][$type][1] = array('name' => 'yes', 'event' => 'alert');
+$config['mibs'][$mib]['states'][$type][2] = array('name' => 'no', 'event' => 'ok');
+
+$type = 'xupsYesNoW';
+$config['mibs'][$mib]['states'][$type][1] = array('name' => 'yes', 'event' => 'warning');
+$config['mibs'][$mib]['states'][$type][2] = array('name' => 'no', 'event' => 'ok');
+
+
+
 $config['mibs'][$mib]['status'][] = array(
    'table'                 => 'xupsContactsTableEntry',
    'oid_descr'             => 'xupsContactDescr',
