Index: includes/definitions/sensors.inc.php =================================================================== --- includes/definitions/sensors.inc.php (revision 5934) +++ includes/definitions/sensors.inc.php (working copy) @@ -246,6 +246,9 @@ $config['sensor_states']['ipso-sensor-state'][1] = array('name' => 'running', 'event' => 'up'); $config['sensor_states']['ipso-sensor-state'][2] = array('name' => 'notRunning', 'event' => 'alert'); +// SW-MIB +$config['sensor_states']['sw-mib'][1] = array('name' => 'normal', 'event' => 'up'); + // UNIX-AGENT $config['sensor_states']['unix-agent-state'][0] = array('name' => 'fail', 'event' => 'alert'); $config['sensor_states']['unix-agent-state'][1] = array('name' => 'ok', 'event' => 'up'); Index: includes/discovery/sensors/sw-mib.inc.php =================================================================== --- includes/discovery/sensors/sw-mib.inc.php (revision 5934) +++ includes/discovery/sensors/sw-mib.inc.php (working copy) @@ -11,55 +11,34 @@ * */ -# FIXME could do with a rewrite perhaps, with MIB and walk +$mib = 'SW-MIB'; +echo(" $mib "); -echo(" SW-MIB "); +$sensor_array = snmpwalk_cache_multi_oid($device, 'swSensorTable', array(), $mib); -$oids = snmp_walk($device,"1.3.6.1.4.1.1588.2.1.1.1.1.22.1.4","-Osqn"); -$oids = trim($oids); +$sensor_type_map = array( + 'temperature' => 'temperature', + 'fan' => 'fanspeed', + 'power-supply' => 'state'); -foreach (explode("\n", $oids) as $data) +foreach ($sensor_array as $index => $entry) { - $data = trim($data); - $data = substr($data, 35); - $sensorid = explode(" ", $data); - - if ($data) + if ($sensor_type_map[$entry['swSensorType']] && is_numeric($entry['swSensorValue'])) { - list($oid) = explode(" ", $data); - $sensor_oid = "1.3.6.1.4.1.1588.2.1.1.1.1.22.1.4.$oid"; - $descr_oid = "1.3.6.1.4.1.1588.2.1.1.1.1.22.1.5.$oid"; - $descr = snmp_get($device,$descr_oid,"-Oqv"); - $value = snmp_get($device,$sensor_oid,"-Oqv"); - $sensortype = 'unknown'; # reset sensor type. + $descr = rewrite_entity_name($entry['swSensorInfo']); + $oid = '.1.3.6.1.4.1.1588.2.1.1.1.1.22.1.4.'.$index; + $type = $sensor_type_map[$entry['swSensorType']]; + $value = $entry['swSensorValue']; - if (!strstr($value, "No") && $descr != "" && $value != "0") - { - $descr = str_replace("\"", "", $descr); - $descr = str_replace("sensor", "", $descr); - - if (strstr($descr, "FAN")) - { - $descr = str_replace("Speed", "", $descr); - $descr = str_replace("Fan Speed", "", $descr); - $sensortype = 'fanspeed'; - } - else if (strstr($descr, "TEMP")) - { - $descr = str_replace("temperature", "", $descr); - $sensortype = 'temperature'; - } - else if (strstr($descr, "Power Supply")) - { - $sensortype = 'state'; - } - - if ($sensortype != 'unknown') - { - discover_sensor($valid['sensor'], $sensortype, $device, $sensor_oid, $oid, '', trim($descr), 1, $value); - } - } + // Because I am nice, rename old RRDs - CLEANME remove in future version + $old_rrd = $config['rrd_dir'] . '/'.$device['hostname'].'/sensor-'.$type.'--'.$index.'.rrd'; + $new_rrd = $config['rrd_dir'] . '/'.$device['hostname'].'/sensor-'.$type.'-sw-mib-'.$index.'.rrd'; + if (is_file($old_rrd)) { rename($old_rrd, $new_rrd); print_warning('Moved RRD'); } + + discover_sensor($valid['sensor'], $type, $device, $oid, $index, 'sw-mib', $descr, 1, $value); } } +unset($sensor_type_map, $sensor_array, $index, $type, $value, $descr); + // EOF Index: includes/polling/os/fabos.inc.php =================================================================== --- includes/polling/os/fabos.inc.php (revision 5934) +++ includes/polling/os/fabos.inc.php (working copy) @@ -11,8 +11,8 @@ * */ -$version = trim(snmp_get($device, ".1.3.6.1.4.1.1588.2.1.1.1.1.6.0", "-Ovq"),'"'); -$hardware = trim(snmp_get($device, ".1.3.6.1.2.1.47.1.1.1.1.13.1", "-Ovq"),'"'); -$serial = trim(snmp_get($device, ".1.3.6.1.2.1.47.1.1.1.1.11.1", "-Ovq"),'"'); +$version = trim(snmp_get($device, 'swFirmwareVersion.0', '-Ovq', 'SW-MIB'),'"'); +$hardware = trim(snmp_get($device, 'entPhysicalDescr.1', '-Ovq', 'ENTITY-MIB'),'"'); +$serial = trim(snmp_get($device, 'entPhysicalSerialNum.1', '-Ovq', 'ENTITY-MIB'),'"'); // EOF