diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index 1580026b72..1993e51247 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 c48b2b81ac..7cbe185c76 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']);