Index: /opt/observium/includes/definitions/mibs/nortel.inc.php
===================================================================
--- /opt/observium/includes/definitions/mibs/nortel.inc.php	(revision 9183)
+++ /opt/observium/includes/definitions/mibs/nortel.inc.php	(working copy)
@@ -24,6 +24,30 @@
                                                          'oid'     => 's5ChasUtilCPUUsageLast1Minute',
                                                          'oid_num' => '.1.3.6.1.4.1.45.1.6.3.8.1.1.5');
 
+// S5 Chassis states (Avaya models VSP7024, ERS5000, ERS4800, ERS4900, ERS3500)
+$config['mibs'][$mib]['status']['S5ChassisState']['tables'][] = array(
+  'table'    => 'S5ChassisState',
+  'type'     => 'S5OperState',
+  'oid'      => 's5ChasComOperState',
+  'oid_num'  => '.1.3.6.1.4.1.45.1.6.3.3.1.1.10',
+  'measured' => 'powersupply'
+);
+
+$type = 'S5OperState';
+$config['mibs'][$mib]['states'][$type][1] = array('name' => 'other', 'event' => 'exclude');
+$config['mibs'][$mib]['states'][$type][2] = array('name' => 'not Available', 'event' => 'exclude');
+$config['mibs'][$mib]['states'][$type][3] = array('name' => 'Removed', 'event' => 'exclude');
+$config['mibs'][$mib]['states'][$type][4] = array('name' => 'Disabled', 'event' => 'alert');
+$config['mibs'][$mib]['states'][$type][5] = array('name' => 'Normal', 'event' => 'ok');
+$config['mibs'][$mib]['states'][$type][6] = array('name' => 'ResetInProg', 'event' => 'alert');
+$config['mibs'][$mib]['states'][$type][7] = array('name' => 'Testing', 'event' => 'alert');
+$config['mibs'][$mib]['states'][$type][8] = array('name' => 'Warning', 'event' => 'alert');
+$config['mibs'][$mib]['states'][$type][9] = array('name' => 'nonFatalErr', 'event' => 'alert');
+$config['mibs'][$mib]['states'][$type][10] = array('name' => 'fatalErr', 'event' => 'alert');
+$config['mibs'][$mib]['states'][$type][11] = array('name' => 'notConfig', 'event' => 'ignore');
+$config['mibs'][$mib]['states'][$type][12] = array('name' => 'obsoleted', 'event' => 'alert');
+
+
 $mib = 'RAPID-CITY';
 $config['mibs'][$mib]['enable'] = 1;
 $config['mibs'][$mib]['identity_num'] = array('.1.3.6.1.4.1.2272',     // RAPID-CITY::rapidCity (MODULE-IDENTITY)
@@ -43,4 +67,39 @@
 );
 // Unused: RAPID-CITY::rcSysDramMaxBlockFree.0 = INTEGER: 122820
 
+
+// RAPID PSU states (Avaya models VSP8284 and VSP7254)
+$config['mibs'][$mib]['status']['RapidPowerState']['tables'][] = array(
+  'table' 	     => 'RapidPowerState',
+  'type'             => 'RapidPSUOperState',
+  'descr'            => 'Power Supply %index%',
+  'oid'              => 'rcChasPowerSupplyOperStatus',
+  'oid_num'          => '.1.3.6.1.4.1.2272.1.4.8.1.1.2',
+  'measured'         => 'powersupply',
+);
+
+$type = 'RapidPSUOperState';
+$config['mibs'][$mib]['states'][$type][1] = array('name' => 'unknown', 'event' => 'exclude');
+$config['mibs'][$mib]['states'][$type][2] = array('name' => 'empty', 'event' => 'exclude');
+$config['mibs'][$mib]['states'][$type][3] = array('name' => 'up', 'event' => 'ok');
+$config['mibs'][$mib]['states'][$type][4] = array('name' => 'down', 'event' => 'alert');
+
+
+// RAPID FAN states (Avaya models VSP8284 and VSP7254)
+$config['mibs'][$mib]['status']['RapidFANState']['tables'][] = array(
+  'table' 	     => 'RapidFANState',
+  'type'             => 'RapidFANOperState',
+  'descr'            => 'Chassis FAN %index%',
+  'oid'              => 'rcChasFanOperStatus',
+  'oid_num'          => '.1.3.6.1.4.1.2272.1.4.7.1.1.2',
+  'measured'         => 'fan',
+);
+
+$type = 'RapidFANOperState';
+$config['mibs'][$mib]['states'][$type][1] = array('name' => 'unknown', 'event' => 'exclude');
+$config['mibs'][$mib]['states'][$type][2] = array('name' => 'up', 'event' => 'ok');
+$config['mibs'][$mib]['states'][$type][3] = array('name' => 'down', 'event' => 'alert');
+$config['mibs'][$mib]['states'][$type][4] = array('name' => 'empty', 'event' => 'exclude');
+
+
 // EOF
Index: /opt/observium/includes/discovery/sensors/rapid-city.inc.php
===================================================================
--- /opt/observium/includes/discovery/sensors/rapid-city.inc.php	(nonexistent)
+++ /opt/observium/includes/discovery/sensors/rapid-city.inc.php	(working copy)
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ * Observium
+ *
+ *   This file is part of Observium.
+ *
+ * @package    observium
+ * @subpackage discovery
+ * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
+ *
+ */
+
+// RAPID PSU states (Avaya models VSP8284 and VSP7254)
+$oids = snmpwalk_cache_oid($device, 'rcChasPowerSupplyOperStatus', array(), 'RAPID-CITY');
+
+foreach ($oids as $index => $entry)
+{
+  $descr = "Power Supply $index";
+  $oid   = ".1.3.6.1.4.1.2272.1.4.8.1.1.2.$index";
+  $value = $entry['rcChasPowerSupplyOperStatus'];
+  discover_sensor($valid['sensor'], 'state', $device, $oid, 'supply-'.$index, 'RapidPSUOperState', $descr, NULL, $value, array('entPhysicalClass' => 'powersupply'));
+}
+
+// RAPID FAN states (Avaya models VSP8284 and VSP7254)
+$oids = snmpwalk_cache_oid($device, 'rcChasFanOperStatus', array(), 'RAPID-CITY');
+
+foreach ($oids as $index => $entry)
+{
+  $descr = "Chassis FAN $index";
+  $oid   = ".1.3.6.1.4.1.2272.1.4.7.1.1.2.$index";
+  $value = $entry['rcChasFanOperStatus'];
+  discover_sensor($valid['sensor'], 'state', $device, $oid, 'fan-'.$index, 'RapidFANOperState', $descr, NULL, $value, array('entPhysicalClass' => 'fan'));
+}
+
+// EOF
Index: /opt/observium/includes/discovery/sensors/s5-chassis-mib.inc.php
===================================================================
--- /opt/observium/includes/discovery/sensors/s5-chassis-mib.inc.php	(revision 9183)
+++ /opt/observium/includes/discovery/sensors/s5-chassis-mib.inc.php	(working copy)
@@ -15,11 +15,16 @@
 
 # Get major version number of running firmware
 $fw_major_version = Null;
-preg_match("/[0-9]\.[0-9]/", $device['version'], $fw_major_version);
+preg_match("/^[0-9]{0,3}\.[0-9]/", $device['version'], $fw_major_version); //adjusted to cover version 10 and upper
 $fw_major_version = $fw_major_version[0];
 
-# Temperature info only known to be present in firmware 6.1 or higher
-if ($fw_major_version >= 6.1)
+# Get Hardware model
+$hw_model = Null;
+$hw_var = explode (" ", $device['hardware']);
+$hw_model = $hw_var[3];
+
+# Temperature info only known to be present in firmware 5.0 or higher
+if ($fw_major_version >= 5.0)
 {
   $temps = snmp_walk($device, "1.3.6.1.4.1.45.1.6.3.7.1.1.5.5", "-Osqn");
   $scale = 0.5;
@@ -32,4 +37,72 @@
   }
 }
 
+# Power Supply and FAN Units (Avaya models VSP7024, ERS5000, ERS4800, ERS4900, ERS3500)
+
+  $oids = snmpwalk_cache_multi_oid($device, 's5ChasComEntry', array(), 'S5-CHASSIS-MIB');
+  foreach ($oids as $index => $entry)
+  {
+  	switch ($entry['s5ChasComGrpIndx'])
+  	{
+        	case 4: // 4 = PowerSupply
+			$v = explode(".",$index);       //index exp. 4.10.0
+			$unitbase = str_split($v[1]);   //isolate the 2nd number "10"
+                        $unit = $unitbase[0];           //isolate the 1st number as unit number "1". The 2nd number represents 0 for primary and 1 for redundant
+			if(preg_match('/^35/', $hw_model) ? true : false){   // psu description adjustment for models ERS3500
+			switch($unitbase[1])
+                                {
+                                        case 0:
+                                                $descr_name = "Primary Power Supply";
+                                                break;
+                                        case 1:
+                                                $descr_name = "Redundant Power Supply";
+                                                break;
+                                        default:
+                                                $descr_name = rewrite_entity_name($entry['s5ChasComDescr']);
+                                }
+			}elseif(preg_match('/AC-DC/', $entry['s5ChasComDescr']) ? true : false){   // psu description adjustment for models VSP7000 and ERS4900
+				switch($unitbase[1])
+				{
+					case 0:
+						$descr_name = "Primary Power Supply";
+						break;
+					case 1:
+						$descr_name = "Redundant Power Supply";
+						break;
+					default:
+						$descr_name = rewrite_entity_name($entry['s5ChasComDescr']);
+				}
+			}else{
+	                	$descr_name = rewrite_entity_name($entry['s5ChasComDescr']);
+			}
+        	        $descr = "Unit $unit - $descr_name";
+                	$oid = ".1.3.6.1.4.1.45.1.6.3.3.1.1.10.$index";
+                	$value = $entry['s5ChasComOperState'];
+                	discover_sensor($valid['sensor'], 'state', $device, $oid, 's5ChasComDescr.'.$index, 'S5OperState', $descr, NULL, $value, array('entPhysicalClass' => 'powersupply'));
+			break;
+
+		case 5: // 5 = Temperature sensor
+			$v = explode(".",$index);
+			$unitbase = str_split($v[1]);
+			$unit = $unitbase[0];
+                       	$descr_name = rewrite_entity_name($entry['s5ChasComDescr']);
+       	                $descr = "Unit $unit - $descr_name";
+               	        $oid = ".1.3.6.1.4.1.45.1.6.3.3.1.1.10.$index";
+               		$value = $entry['s5ChasComOperState'];
+                        discover_sensor($valid['sensor'], 'state', $device, $oid, 's5ChasComDescr.'.$index, 'S5OperState', $descr, NULL, $value, array('entPhysicalClass' => 'temperature'));
+                        break;
+
+		case 6: // 6 = FAN sensor
+			$v = explode(".",$index);
+                        $unitbase = str_split($v[1]);
+                        $unit = $unitbase[0];
+                        $descr_name = rewrite_entity_name($entry['s5ChasComDescr']);
+                        $descr = "Unit $unit - $descr_name";
+                        $oid = ".1.3.6.1.4.1.45.1.6.3.3.1.1.10.$index";
+                        $value = $entry['s5ChasComOperState'];
+                        discover_sensor($valid['sensor'], 'state', $device, $oid, 's5ChasComDescr.'.$index, 'S5OperState', $descr, NULL, $value, array('entPhysicalClass' => 'fan'));
+                        break;
+        }
+  }
+
 // EOF