Index: includes/discovery/sensors/foundry-sn-agent-mib.inc.php
===================================================================
--- includes/discovery/sensors/foundry-sn-agent-mib.inc.php	(revision 5451)
+++ includes/discovery/sensors/foundry-sn-agent-mib.inc.php	(working copy)
@@ -50,4 +50,76 @@
   }
 }
 
+// State sensors
+$cache['fnsnagent'] = array();
+$stackable=0;
+
+// Power Suplies
+
+// Stackable Switches
+foreach (array("snChasPwrSupply2Table") as $table) {
+    echo("$table ");
+    $cache['fnsnagent'] = snmpwalk_cache_multi_oid($device, $table, $cache['fnsnagent'], "FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB", mib_dirs('foundry'), TRUE);
+}
+
+foreach ($cache['fnsnagent'] as $index => $entry) {
+    $descr = "Power Supply $index";
+    $oid   = ".1.3.6.1.4.1.1991.1.1.1.2.2.1.4.$index";
+    $value = state_string_to_numeric('foundry-sn-agent-oper-state',$entry['snChasPwrSupply2OperStatus']);
+    discover_sensor($valid['sensor'], 'state', $device, $oid, "snChasPwrSupply2OperStatus.$index", 'foundry-sn-agent-oper-state', $descr, NULL, $value, array('entPhysicalClass' => 'powerSupply'));
+    $stackable=1;
+}
+
+// Chassis and Non Stackable Switches
+if ($stackable==0) {
+  $cache['fnsnagent'] = array();
+
+  foreach (array("snChasPwrSupplyTable") as $table) {
+    echo("$table ");
+    $cache['fnsnagent'] = snmpwalk_cache_multi_oid($device, $table, $cache['fnsnagent'], "FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB", mib_dirs('foundry'), TRUE);
+  }
+
+  foreach ($cache['fnsnagent'] as $index => $entry) {
+    $descr = "Power Supply $index";
+    $oid   = ".1.3.6.1.4.1.1991.1.1.1.2.1.1.3.$index";
+    $value = state_string_to_numeric('foundry-sn-agent-oper-state',$entry['snChasPwrSupplyOperStatus']);
+    discover_sensor($valid['sensor'], 'state', $device, $oid, "snChasPwrSupplyOperStatus.$index", 'foundry-sn-agent-oper-state', $descr, NULL, $value, array('entPhysicalClass' => 'powerSupply'));
+  }
+}
+
+
+// Fans
+
+// Stackable Switches
+foreach (array("snChasFan2Table") as $table) {
+    echo("$table ");
+    $cache['fnsnagent'] = snmpwalk_cache_multi_oid($device, $table, $cache['fnsnagent'], "FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB", mib_dirs('foundry'), TRUE);
+}
+
+foreach ($cache['fnsnagent'] as $index => $entry) {
+    $descr = "Fan $index";
+    $oid   = ".1.3.6.1.4.1.1991.1.1.1.3.2.1.4.$index";
+    $value = state_string_to_numeric('foundry-sn-agent-oper-state',$entry['snChasFan2OperStatus']);
+    discover_sensor($valid['sensor'], 'state', $device, $oid, "snChasFan2OperStatus.$index", 'foundry-sn-agent-oper-state', $descr, NULL, $value, array('entPhysicalClass' => 'fan'));
+    $stackable=1;
+}
+
+// Chassis and Non Stackable Switches
+if ($stackable==0) {
+  $cache['fnsnagent'] = array();
+
+  foreach (array("snChasPwrSupplyTable") as $table) {
+    echo("$table ");
+    $cache['fnsnagent'] = snmpwalk_cache_multi_oid($device, $table, $cache['fnsnagent'], "FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB", mib_dirs('foundry'), TRUE);
+  }
+
+  foreach ($cache['fnsnagent'] as $index => $entry) {
+    $descr = "Fan $index";
+    $oid   = ".1.3.6.1.4.1.1991.1.1.1.2.1.1.3.$index";
+    $value = state_string_to_numeric('foundry-sn-agent-oper-state',$entry['snChasFanOperStatus']);
+    discover_sensor($valid['sensor'], 'state', $device, $oid, "snChasFanOperStatus.$index", 'foundry-sn-agent-oper-state', $descr, NULL, $value, array('entPhysicalClass' => 'fan'));
+  }
+}
+
+
 // EOF
Index: includes/definitions/sensors.inc.php
===================================================================
--- includes/definitions/sensors.inc.php	(revision 5451)
+++ includes/definitions/sensors.inc.php	(working copy)
@@ -179,6 +179,12 @@
 $config['sensor']['cache_oids']['entity-sensor']         = array('.1.3.6.1.2.1.99.1.1.1.4');
 $config['sensor']['cache_oids']['equallogic']            = array('.1.3.6.1.4.1.12740.2.1.6.1.3.1', '.1.3.6.1.4.1.12740.2.1.7.1.3.1');
 
+// FOUNDRY-SN-AGENT-MIB
+$config['sensor_states']['foundry-sn-agent-oper-state'][1] = array('name' => 'other',   'event' => 'ignore');
+$config['sensor_states']['foundry-sn-agent-oper-state'][2] = array('name' => 'normal',  'event' => 'up');
+$config['sensor_states']['foundry-sn-agent-oper-state'][3] = array('name' => 'failure', 'event' => 'alert');
+
+
 // IPMI sensor type mappings
 $config['ipmi_unit']['Volts']     = 'voltage';
 $config['ipmi_unit']['degrees C'] = 'temperature';
