From bcc874ed94bf6dc9f3476a352cda6368d97ab7f3 Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Tue, 17 Apr 2012 11:14:03 +0000 Subject: [PATCH] add external sensor support for APC UPS git-svn-id: http://www.observium.org/svn/observer/trunk@3040 61d68cd4-352d-0410-923a-c4978735b2b8 --- includes/discovery/humidity/apc.inc.php | 29 ++++++++++++++ includes/discovery/temperatures/apc.inc.php | 42 ++++++++++++++++++++- 2 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 includes/discovery/humidity/apc.inc.php diff --git a/includes/discovery/humidity/apc.inc.php b/includes/discovery/humidity/apc.inc.php new file mode 100644 index 0000000000..46926a72e4 --- /dev/null +++ b/includes/discovery/humidity/apc.inc.php @@ -0,0 +1,29 @@ + Sensor not available + discover_sensor($valid['sensor'], 'humidity', $device, $oid, $index, $sensorType, $descr, '1', '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit , $current); + } + } +} + +?> diff --git a/includes/discovery/temperatures/apc.inc.php b/includes/discovery/temperatures/apc.inc.php index 93855b146e..96467af663 100644 --- a/includes/discovery/temperatures/apc.inc.php +++ b/includes/discovery/temperatures/apc.inc.php @@ -9,12 +9,50 @@ if ($device['os'] == "apc") echo("APC UPS Internal "); list($oid,$current) = explode(' ',$oids); $precision = 1; - $type = "apc"; + $sensorType = "apc"; $index = 0; $descr = "Internal Temperature"; - discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'apc', $descr, '1', '1', NULL, NULL, NULL, NULL, $current); + discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, $sensorType, $descr, '1', '1', NULL, NULL, NULL, NULL, $current); } + + # Environmental monitoring on UPSes etc + # FIXME emConfigProbesTable may also be used? But not filled out on my device... + $apc_env_data = snmpwalk_cache_oid($device, "iemConfigProbesTable", array(), "PowerNet-MIB"); + $apc_env_data = snmpwalk_cache_oid($device, "iemStatusProbesTable", $apc_env_data, "PowerNet-MIB"); + + foreach (array_keys($apc_env_data) as $index) + { + $descr = $apc_env_data[$index]['iemStatusProbeName']; + $current = $apc_env_data[$index]['iemStatusProbeCurrentTemp']; + $sensorType = 'apc'; + $oid = '.1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.' . $index; + $low_limit = ($apc_env_data[$index]['iemConfigProbeMinTempEnable'] != 'disabled' ? $apc_env_data[$index]['iemConfigProbeMinTempThreshold'] : NULL); + $low_warn_limit = ($apc_env_data[$index]['iemConfigProbeLowTempEnable'] != 'disabled' ? $apc_env_data[$index]['iemConfigProbeLowTempThreshold'] : NULL); + $high_warn_limit = ($apc_env_data[$index]['iemConfigProbeHighTempEnable'] != 'disabled' ? $apc_env_data[$index]['iemConfigProbeHighTempThreshold'] : NULL); + $high_limit = ($apc_env_data[$index]['iemConfigProbeMaxTempEnable'] != 'disabled' ? $apc_env_data[$index]['iemConfigProbeMaxTempThreshold'] : NULL); + + discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, $sensorType, $descr, '1', '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit , $current); + } + +/* + [iemConfigProbeHighHumidThreshold] => -1 + [iemConfigProbeLowHumidThreshold] => -1 + [iemConfigProbeHighHumidEnable] => disabled + [iemConfigProbeLowHumidEnable] => disabled + [iemConfigProbeMaxHumidThreshold] => -1 + [iemConfigProbeMinHumidThreshold] => -1 + [iemConfigProbeMaxHumidEnable] => disabled + [iemConfigProbeMinHumidEnable] => disabled + [iemConfigProbeHumidHysteresis] => -1 + + [iemStatusProbeStatus] => connected + [iemStatusProbeCurrentTemp] => 25 + [iemStatusProbeTempUnits] => celsius + + [iemStatusProbeCurrentHumid] => 0 +*/ + # InRow Chiller. # A silly check to find out if it's the right hardware. $oids = snmp_get($device, "airIRRCGroupSetpointsCoolMetric.0", "-OsqnU", "PowerNet-MIB");