From 0625d880c69ee7c34d757250b660d96ec7d1276e Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Sat, 13 Mar 2010 16:52:03 +0000 Subject: [PATCH] fix fans to notify *BELOW* speed not above! :D git-svn-id: http://www.observium.org/svn/observer/trunk@1022 61d68cd4-352d-0410-923a-c4978735b2b8 --- includes/discovery/functions.inc.php | 6 ++---- includes/polling/fanspeeds.inc.php | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index 1580026b7..1993e5124 100644 --- a/includes/discovery/functions.inc.php +++ b/includes/discovery/functions.inc.php @@ -138,9 +138,9 @@ function discover_mempool(&$valid_mempool, $device, $index, $type, $descr, $prec function discover_temperature(&$valid_temp, $device, $oid, $index, $type, $descr, $precision = 1, $low_limit = NULL, $high_limit = NULL, $current) { - global $config, $debug; - + global $config, $debug; if($debug) { echo("$oid, $index, $type, $descr, $precision\n"); } + if (mysql_result(mysql_query("SELECT COUNT(temp_id) FROM `temperature` WHERE temp_type = '$type' AND temp_index = '$index' AND device_id = '".$device['device_id']."'"),0) == '0') { $query = "INSERT INTO temperature (`device_id`, `temp_type`,`temp_index`,`temp_oid`, `temp_descr`, `temp_limit`, `temp_current`, `temp_precision`)"; @@ -162,8 +162,6 @@ function discover_temperature(&$valid_temp, $device, $oid, $index, $type, $descr echo("U"); } } - - echo(mysql_error()); $valid_temp[$type][$index] = 1; return $return; } diff --git a/includes/polling/fanspeeds.inc.php b/includes/polling/fanspeeds.inc.php index c48b2b81a..7cbe185c7 100755 --- a/includes/polling/fanspeeds.inc.php +++ b/includes/polling/fanspeeds.inc.php @@ -27,7 +27,7 @@ while($fanspeed = mysql_fetch_array($fan_data)) { rrdtool_update($fanrrd,"N:$fan"); - if($fanspeed['fan_current'] > $fanspeed['fan_limit'] && $fan <= $fanspeed['fan_limit']) { + if($fanspeed['fan_current'] < $fanspeed['fan_limit'] && $fan >= $fanspeed['fan_limit']) { if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; } $msg = "Fan Alarm: " . $device['hostname'] . " " . $fanspeed['fan_descr'] . " is " . $fan . "rpm (Limit " . $fanspeed['fan_limit']; $msg .= "rpm) at " . date($config['timestamp_format']);