diff --git a/html/includes/graphs/device_temperatures.inc.php b/html/includes/graphs/device_temperatures.inc.php
index 90f8c4df18..a810703d81 100644
--- a/html/includes/graphs/device_temperatures.inc.php
+++ b/html/includes/graphs/device_temperatures.inc.php
@@ -6,7 +6,7 @@ $device = device_by_id_cache($id);
$rrd_options .= " -l 0 -E ";
$iter = "1";
-$sql = mysql_query("SELECT * FROM temperature where device_id = '$id' ORDER BY temp_index");
+$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='temperature' AND device_id = '$id' ORDER BY sensor_index");
$rrd_options .= " COMMENT:' Cur Min Max\\n'";
while($temperature = mysql_fetch_array($sql))
{
@@ -37,13 +37,13 @@ while($temperature = mysql_fetch_array($sql))
break;
}
- $temperature['temp_descr_fixed'] = substr(str_pad($temperature['temp_descr'], 22),0,22);
- $temprrd = $config['rrd_dir'] . "/".$device['hostname']."/".safename("temp-" . $temperature['temp_descr'] . ".rrd");
- $rrd_options .= " DEF:temp" . $temperature[temp_id] . "=$temprrd:temp:AVERAGE ";
- $rrd_options .= " LINE1:temp" . $temperature[temp_id] . "#" . $colour . ":'" . str_replace(':','\:',str_replace('\*','*',quotemeta($temperature['temp_descr_fixed']))) . "' ";
- $rrd_options .= " GPRINT:temp" . $temperature[temp_id] . ":LAST:%3.0lfC ";
- $rrd_options .= " GPRINT:temp" . $temperature[temp_id] . ":MIN:%3.0lfC ";
- $rrd_options .= " GPRINT:temp" . $temperature[temp_id] . ":MAX:%3.0lfC\\\l ";
+ $temperature['sensor_descr_fixed'] = substr(str_pad($temperature['sensor_descr'], 22),0,22);
+ $temprrd = $config['rrd_dir'] . "/".$device['hostname']."/".safename("temp-" . $temperature['sensor_descr'] . ".rrd");
+ $rrd_options .= " DEF:temp" . $temperature['sensor_id'] . "=$temprrd:temp:AVERAGE ";
+ $rrd_options .= " LINE1:temp" . $temperature['sensor_id'] . "#" . $colour . ":'" . str_replace(':','\:',str_replace('\*','*',quotemeta($temperature['sensor_descr_fixed']))) . "' ";
+ $rrd_options .= " GPRINT:temp" . $temperature['sensor_id'] . ":LAST:%3.0lfC ";
+ $rrd_options .= " GPRINT:temp" . $temperature['sensor_id'] . ":MIN:%3.0lfC ";
+ $rrd_options .= " GPRINT:temp" . $temperature['sensor_id'] . ":MAX:%3.0lfC\\\l ";
$iter++;
}
diff --git a/html/includes/graphs/temperature.inc.php b/html/includes/graphs/temperature.inc.php
index bff7b60215..a01c6f45e7 100644
--- a/html/includes/graphs/temperature.inc.php
+++ b/html/includes/graphs/temperature.inc.php
@@ -7,19 +7,19 @@ include("common.inc.php");
$rrd_options .= " COMMENT:' Last Max\\n'";
- $temperature = mysql_fetch_array(mysql_query("SELECT * FROM temperature where temp_id = '".mres($_GET['id'])."'"));
+ $temperature = mysql_fetch_array(mysql_query("SELECT * FROM sensors where sensor_id = '".mres($_GET['id'])."'"));
$hostname = mysql_result(mysql_query("SELECT hostname FROM devices WHERE device_id = '" . $temperature['device_id'] . "'"),0);
- $temperature['temp_descr_fixed'] = substr(str_pad($temperature['temp_descr'], 28),0,28);
+ $temperature['sensor_descr_fixed'] = substr(str_pad($temperature['sensor_descr'], 28),0,28);
- $rrd_filename = $config['rrd_dir'] . "/".$hostname."/" . safename("temp-" . $temperature['temp_descr'] . ".rrd");
+ $rrd_filename = $config['rrd_dir'] . "/".$hostname."/" . safename("temp-" . $temperature['sensor_descr'] . ".rrd");
$rrd_options .= " DEF:temp=$rrd_filename:temp:AVERAGE";
$rrd_options .= " DEF:temp_max=$rrd_filename:temp:MAX";
$rrd_options .= " DEF:temp_min=$rrd_filename:temp:MIN";
- $rrd_options .= " CDEF:tempwarm=temp_max,".$temperature['temp_limit'].",GT,temp,UNKN,IF";
+ $rrd_options .= " CDEF:tempwarm=temp_max,".$temperature['sensor_limit'].",GT,temp,UNKN,IF";
$rrd_options .= " CDEF:tempcold=temp_min,20,LT,temp,UNKN,IF";
$rrd_options .= " AREA:temp_max#c5c5c5";
$rrd_options .= " AREA:temp_min#ffffffff";
@@ -29,7 +29,7 @@ include("common.inc.php");
# $rrd_options .= " AREA:temp#bbd392";
# $rrd_options .= " AREA:tempwarm#FFCCCC";
# $rrd_options .= " AREA:tempcold#CCCCFF";
- $rrd_options .= " LINE1:temp#cc0000:'" . str_replace(':','\:',str_replace('\*','*',quotemeta($temperature['temp_descr_fixed'])))."'"; # Ugly hack :(
+ $rrd_options .= " LINE1:temp#cc0000:'" . str_replace(':','\:',str_replace('\*','*',quotemeta($temperature['sensor_descr_fixed'])))."'"; # Ugly hack :(
$rrd_options .= " LINE1:tempwarm#660000";
$rrd_options .= " GPRINT:temp:LAST:%3.0lfC";
$rrd_options .= " GPRINT:temp:MAX:%3.0lfC\\\\l";
diff --git a/html/pages/device/health.inc.php b/html/pages/device/health.inc.php
index bc1ee400ff..e53303340f 100644
--- a/html/pages/device/health.inc.php
+++ b/html/pages/device/health.inc.php
@@ -1,6 +1,6 @@
");
@@ -12,10 +12,10 @@ while($temp = mysql_fetch_array($query)) {
if(!is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
echo("
- | " . $temp['temp_descr'] . " |
- " . print_temperature($temp['temp_current'], $temp['temp_limit']) . " °C |
- " . $temp['temp_limit'] . " °C |
- " . $temp['temp_notes'] . " |
+ " . $temp['sensor_descr'] . " |
+ " . print_temperature($temp['sensor_current'], $temp['sensor_limit']) . " °C |
+ " . $temp['sensor_limit'] . " °C |
+ " . $temp['sensor_notes'] . " |
\n");
echo("");
@@ -23,17 +23,17 @@ while($temp = mysql_fetch_array($query)) {
// start temperature graphs
- $daily_temp = "graph.php?id=" . $temp['temp_id'] . "&type=$graph_type&from=$day&to=$now&width=211&height=100";
- $daily_url = "graph.php?id=" . $temp['temp_id'] . "&type=$graph_type&from=$day&to=$now&width=400&height=150";
+ $daily_temp = "graph.php?id=" . $temp['sensor_id'] . "&type=$graph_type&from=$day&to=$now&width=211&height=100";
+ $daily_url = "graph.php?id=" . $temp['sensor_id'] . "&type=$graph_type&from=$day&to=$now&width=400&height=150";
- $weekly_temp = "graph.php?id=" . $temp['temp_id'] . "&type=$graph_type&from=$week&to=$now&width=211&height=100";
- $weekly_url = "graph.php?id=" . $temp['temp_id'] . "&type=$graph_type&from=$week&to=$now&width=400&height=150";
+ $weekly_temp = "graph.php?id=" . $temp['sensor_id'] . "&type=$graph_type&from=$week&to=$now&width=211&height=100";
+ $weekly_url = "graph.php?id=" . $temp['sensor_id'] . "&type=$graph_type&from=$week&to=$now&width=400&height=150";
- $monthly_temp = "graph.php?id=" . $temp['temp_id'] . "&type=$graph_type&from=$month&to=$now&width=211&height=100";
- $monthly_url = "graph.php?id=" . $temp['temp_id'] . "&type=$graph_type&from=$month&to=$now&width=400&height=150";
+ $monthly_temp = "graph.php?id=" . $temp['sensor_id'] . "&type=$graph_type&from=$month&to=$now&width=211&height=100";
+ $monthly_url = "graph.php?id=" . $temp['sensor_id'] . "&type=$graph_type&from=$month&to=$now&width=400&height=150";
- $yearly_temp = "graph.php?id=" . $temp['temp_id'] . "&type=$graph_type&from=$year&to=$now&width=211&height=100";
- $yearly_url = "graph.php?id=" . $temp['temp_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150";
+ $yearly_temp = "graph.php?id=" . $temp['sensor_id'] . "&type=$graph_type&from=$year&to=$now&width=211&height=100";
+ $yearly_url = "graph.php?id=" . $temp['sensor_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150";
echo("', LEFT);\" onmouseout=\"return nd();\">
");
@@ -55,5 +55,4 @@ while($temp = mysql_fetch_array($query)) {
echo("");
-?>
-
+?>
\ No newline at end of file
diff --git a/html/pages/device/overview/temperatures.inc.php b/html/pages/device/overview/temperatures.inc.php
index f3e633397f..0e32425fe1 100644
--- a/html/pages/device/overview/temperatures.inc.php
+++ b/html/pages/device/overview/temperatures.inc.php
@@ -1,12 +1,12 @@
");
echo(" Temperatures ");
$i = '1';
- $temps = mysql_query("SELECT * FROM temperature WHERE device_id = '" . $device['device_id'] . "' ORDER BY temp_index");
+ $temps = mysql_query("SELECT * FROM sensors WHERE sensor_class='temperature' AND device_id = '" . $device['device_id'] . "' ORDER BY sensor_index");
echo('');
echo('');
echo('');
@@ -15,23 +15,23 @@ if($total = mysql_result(mysql_query("SELECT count(temp_id) from temperature WHE
$graph_colour = str_replace("#", "", $row_colour);
- $temp_perc = $temp['temp_current'] / $temp['temp_limit'] * 100;
+ $temp_perc = $temp['sensor_current'] / $temp['sensor_limit'] * 100;
$temp_colour = percent_colour($temp_perc);
- $temp_day = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$day&to=$now&width=300&height=100";
- $temp_week = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$week&to=$now&width=300&height=100";
- $temp_month = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$month&to=$now&width=300&height=100";
- $temp_year = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$year&to=$now&width=300&height=100";
- $temp_minigraph = " ";
+ $temp_day = "graph.php?id=" . $temp['sensor_id'] . "&type=temperature&from=$day&to=$now&width=300&height=100";
+ $temp_week = "graph.php?id=" . $temp['sensor_id'] . "&type=temperature&from=$week&to=$now&width=300&height=100";
+ $temp_month = "graph.php?id=" . $temp['sensor_id'] . "&type=temperature&from=$month&to=$now&width=300&height=100";
+ $temp_year = "graph.php?id=" . $temp['sensor_id'] . "&type=temperature&from=$year&to=$now&width=300&height=100";
+ $temp_minigraph = " ";
$temp_link = "";
- $temp_link_c = $temp_link . "" . round($temp['temp_current'],0) . "°C";
+ $temp_link_c = $temp_link . "" . round($temp['sensor_current'],0) . "°C";
$temp_link_b = $temp_link . $temp_minigraph . "";
- $temp_link_a = $temp_link . $temp['temp_descr'] . "";
+ $temp_link_a = $temp_link . $temp['sensor_descr'] . "";
- $temp['temp_descr'] = truncate($temp['temp_descr'], 25, '');
+ $temp['sensor_descr'] = truncate($temp['sensor_descr'], 25, '');
echo("| $temp_link_a | $temp_link_b | $temp_link_c | ");
if($i == $rows) { echo(" | "); }
$i++;
diff --git a/html/pages/health/temperatures.inc.php b/html/pages/health/temperatures.inc.php
index 4c1847e491..7bb716f2b7 100644
--- a/html/pages/health/temperatures.inc.php
+++ b/html/pages/health/temperatures.inc.php
@@ -1,9 +1,9 @@
= '5') {
- $sql = "SELECT * FROM `temperature` AS T, `devices` AS D WHERE T.device_id = D.device_id ORDER BY D.hostname, T.temp_index, T.temp_descr";
+ $sql = "SELECT * FROM `sensors` AS S, `devices` AS D WHERE S.device_id = D.device_id ORDER BY D.hostname, S.sensor_index, S.sensor_descr";
} else {
- $sql = "SELECT * FROM `temperature` AS T, `devices` AS D, devices_perms as P WHERE T.device_id = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, T.temp_index, T.temp_descr";
+ $sql = "SELECT * FROM `sensors` AS S, `devices` AS D, devices_perms as P WHERE S.device_id = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, S.sensor_index, S.sensor_descr";
}
$query = mysql_query($sql);
@@ -26,24 +26,24 @@ while($temp = mysql_fetch_array($query))
{
if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
- $weekly_temp = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$week&to=$now&width=500&height=150";
+ $weekly_temp = "graph.php?id=" . $temp['sensor_id'] . "&type=temperature&from=$week&to=$now&width=500&height=150";
$temp_popup = "', LEFT);\" onmouseout=\"return nd();\">
- " . $temp['temp_descr'] . "";
+ " . $temp['sensor_descr'] . "";
- $temp['temp_current'] = round($temp['temp_current'],1);
+ $temp['sensor_current'] = round($temp['sensor_current'],1);
- $temp_perc = $temp['temp_current'] / $temp['temp_limit'] * 100;
+ $temp_perc = $temp['sensor_current'] / $temp['sensor_limit'] * 100;
$temp_colour = percent_colour($temp_perc);
- if($temp['temp_current'] >= $temp['temp_limit']) { $alert = ' '; } else { $alert = ""; }
+ if($temp['sensor_current'] >= $temp['sensor_limit']) { $alert = ' '; } else { $alert = ""; }
- $temp_day = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$day&to=$now&width=300&height=100";
- $temp_week = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$week&to=$now&width=300&height=100";
- $temp_month = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$month&to=$now&width=300&height=100";
- $temp_year = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$year&to=$now&width=300&height=100";
+ $temp_day = "graph.php?id=" . $temp['sensor_id'] . "&type=temperature&from=$day&to=$now&width=300&height=100";
+ $temp_week = "graph.php?id=" . $temp['sensor_id'] . "&type=temperature&from=$week&to=$now&width=300&height=100";
+ $temp_month = "graph.php?id=" . $temp['sensor_id'] . "&type=temperature&from=$month&to=$now&width=300&height=100";
+ $temp_year = "graph.php?id=" . $temp['sensor_id'] . "&type=temperature&from=$year&to=$now&width=300&height=100";
- $temp_minigraph = " ".$temp['hostname']." - ".$temp['temp_descr'];
+ $temp_minigraph = " ".$temp['hostname']." - ".$temp['sensor_descr'];
$temp_minigraph .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
echo("
@@ -51,26 +51,26 @@ while($temp = mysql_fetch_array($query))
| $temp_popup |
$temp_minigraph |
$alert |
- " . $temp['temp_current'] . " °C |
- " . $temp['temp_limit'] . " °C |
- " . (isset($temp['temp_notes']) ? $temp['temp_notes'] : '') . " |
+ " . $temp['sensor_current'] . " °C |
+ " . $temp['sensor_limit'] . " °C |
+ " . (isset($temp['sensor_notes']) ? $temp['sensor_notes'] : '') . " |
\n");
if($_GET['optb'] == "graphs") { ## If graphs
echo("");
- $daily_graph = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$day&to=$now&width=211&height=100";
- $daily_url = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$day&to=$now&width=400&height=150";
+ $daily_graph = "graph.php?id=" . $temp['sensor_id'] . "&type=temperature&from=$day&to=$now&width=211&height=100";
+ $daily_url = "graph.php?id=" . $temp['sensor_id'] . "&type=temperature&from=$day&to=$now&width=400&height=150";
- $weekly_graph = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$week&to=$now&width=211&height=100";
- $weekly_url = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$week&to=$now&width=400&height=150";
+ $weekly_graph = "graph.php?id=" . $temp['sensor_id'] . "&type=temperature&from=$week&to=$now&width=211&height=100";
+ $weekly_url = "graph.php?id=" . $temp['sensor_id'] . "&type=temperature&from=$week&to=$now&width=400&height=150";
- $monthly_graph = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$month&to=$now&width=211&height=100";
- $monthly_url = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$month&to=$now&width=400&height=150";
+ $monthly_graph = "graph.php?id=" . $temp['sensor_id'] . "&type=temperature&from=$month&to=$now&width=211&height=100";
+ $monthly_url = "graph.php?id=" . $temp['sensor_id'] . "&type=temperature&from=$month&to=$now&width=400&height=150";
- $yearly_graph = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$year&to=$now&width=211&height=100";
- $yearly_url = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$year&to=$now&width=400&height=150";
+ $yearly_graph = "graph.php?id=" . $temp['sensor_id'] . "&type=temperature&from=$year&to=$now&width=211&height=100";
+ $yearly_url = "graph.php?id=" . $temp['sensor_id'] . "&type=temperature&from=$year&to=$now&width=400&height=150";
echo("', LEFT);\" onmouseout=\"return nd();\">
");
diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php
index e234662aad..eb15a88723 100644
--- a/includes/discovery/functions.inc.php
+++ b/includes/discovery/functions.inc.php
@@ -143,25 +143,24 @@ function discover_temperature(&$valid, $device, $oid, $index, $type, $descr, $pr
global $config, $debug;
if($debug) { echo("$oid, $index, $type, $descr, $precision, $current\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')
+ if (mysql_result(mysql_query("SELECT COUNT(sensor_id) FROM `sensors` WHERE sensor_class='temperature' AND sensor_type = '$type' AND sensor_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`)";
- $query .= " values ('".$device['device_id']."', '$type','$index','$oid', '$descr','" . ($high_limit ? $high_limit : $config['defaults']['temp_limit']) . "', '$current', '$precision')";
+ $query = "INSERT INTO sensors (`sensor_class`, `device_id`, `sensor_type`,`sensor_index`,`sensor_oid`, `sensor_descr`, `sensor_limit`, `sensor_current`, `sensor_precision`)";
+ $query .= " values ('temperature','".$device['device_id']."', '$type','$index','$oid', '$descr','" . ($high_limit ? $high_limit : $config['defaults']['sensor_limit']) . "', '$current', '$precision')";
mysql_query($query);
echo("+");
}
else
{
- $entry = mysql_fetch_array(mysql_query("SELECT * FROM `temperature` WHERE device_id = '".$device['device_id']."' AND `temp_type` = '$type' AND `temp_index` = '$index'"));
+ $entry = mysql_fetch_array(mysql_query("SELECT * FROM `sensors` WHERE sensor_class='temperature' AND device_id = '".$device['device_id']."' AND `sensor_type` = '$type' AND `sensor_index` = '$index'"));
echo(mysql_error());
- if($oid == $entry['temp_oid'] && $descr == $entry['temp_descr'] && $precision == $entry['temp_precision'])
+ if($oid == $entry['sensor_oid'] && $descr == $entry['sensor_descr'] && $precision == $entry['sensor_precision'])
{
echo(".");
}
else
{
- mysql_query("UPDATE temperature SET `temp_descr` = '$descr', `temp_oid` = '$oid', `temp_precision` = '$precision' WHERE `temp_id` = '".$entry['temp_id']."'");
+ mysql_query("UPDATE sensors SET `sensor_descr` = '$descr', `sensor_oid` = '$oid', `sensor_precision` = '$precision' WHERE sensor_class` = 'temperature' AND`sensor_id` = '".$entry['sensor_id']."'");
echo("U");
}
}
diff --git a/includes/discovery/temperatures.inc.php b/includes/discovery/temperatures.inc.php
index be67016883..8a3403892f 100755
--- a/includes/discovery/temperatures.inc.php
+++ b/includes/discovery/temperatures.inc.php
@@ -310,18 +310,18 @@ if (strstr($device['hardware'], "dell"))
if($debug) { print_r($valid_temp); }
-$sql = "SELECT * FROM temperature AS T, devices AS D WHERE T.device_id = D.device_id AND D.device_id = '".$device['device_id']."'";
+$sql = "SELECT * FROM sensors AS S, devices AS D WHERE S.sensor_class='temperature' AND S.device_id = D.device_id AND D.device_id = '".$device['device_id']."'";
if ($query = mysql_query($sql))
{
while ($test_temperature = mysql_fetch_array($query))
{
- $temperature_index = $test_temperature['temp_index'];
- $temperature_type = $test_temperature['temp_type'];
+ $temperature_index = $test_temperature['sensor_index'];
+ $temperature_type = $test_temperature['sensor_type'];
if($debug) { echo($temperature_index . " -> " . $temperature_type . "\n"); }
if(!$valid_temp[$temperature_type][$temperature_index])
{
echo("-");
- mysql_query("DELETE FROM `temperature` WHERE temp_id = '" . $test_temperature['temp_id'] . "'");
+ mysql_query("DELETE FROM `sensors` WHERE sensor_class='temperature' AND sensor_id = '" . $test_temperature['sensor_id'] . "'");
}
unset($temperature_oid); unset($temperature_type);
}
diff --git a/includes/functions.php b/includes/functions.php
index c90d2ce21e..b095159369 100755
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -290,7 +290,6 @@ function delete_device($id)
mysql_query("DELETE FROM `devices_attribs` WHERE `device_id` = '$id'");
mysql_query("DELETE FROM `devices_perms` WHERE `device_id` = '$id'");
mysql_query("DELETE FROM `bgpPeers` WHERE `device_id` = '$id'");
- mysql_query("DELETE FROM `temperature` WHERE `device_id` = '$id'");
mysql_query("DELETE FROM `vlans` WHERE `device_id` = '$id'");
mysql_query("DELETE FROM `vrfs` WHERE `device_id` = '$id'");
mysql_query("DELETE FROM `storage` WHERE `device_id` = '$id'");
@@ -305,6 +304,7 @@ function delete_device($id)
mysql_query("DELETE FROM `toner` WHERE `device_id` = '$id'");
mysql_query("DELETE FROM `frequency` WHERE `device_id` = '$id'");
mysql_query("DELETE FROM `current` WHERE `device_id` = '$id'");
+ mysql_query("DELETE FROM `sensors` WHERE `device_id` = '$id'");
shell_exec("rm -rf ".$config['rrd_dir']."/$host");
return $ret . "Removed device $host\n";
}
diff --git a/includes/polling/temperatures.inc.php b/includes/polling/temperatures.inc.php
index 776f64e20d..988b5ca341 100755
--- a/includes/polling/temperatures.inc.php
+++ b/includes/polling/temperatures.inc.php
@@ -1,24 +1,24 @@
= $temperature['temp_limit']) {
+ if($temperature['sensor_current'] < $temperature['sensor_limit'] && $temp >= $temperature['sensor_limit']) {
if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
- $msg = "Temp Alarm: " . $device['hostname'] . " " . $temperature['temp_descr'] . " is " . $temp . " (Limit " . $temperature['temp_limit'];
+ $msg = "Temp Alarm: " . $device['hostname'] . " " . $temperature['sensor_descr'] . " is " . $temp . " (Limit " . $temperature['sensor_limit'];
$msg .= ") at " . date($config['timestamp_format']);
- mail($email, "Temp Alarm: " . $device['hostname'] . " " . $temperature['temp_descr'], $msg, $config['email_headers']);
- echo("Alerting for " . $device['hostname'] . " " . $temperature['temp_descr'] . "\n");
- log_event('Temperature ' . $temperature['temp_descr'] . " over threshold: " . $temp . " °C (> " . $temperature['temp_limit'] . " °C)", $device['device_id'], 'temperature', $temperature['temp_id']);
+ mail($email, "Temp Alarm: " . $device['hostname'] . " " . $temperature['sensor_descr'], $msg, $config['email_headers']);
+ echo("Alerting for " . $device['hostname'] . " " . $temperature['sensor_descr'] . "\n");
+ log_event('Temperature ' . $temperature['sensor_descr'] . " over threshold: " . $temp . " °C (> " . $temperature['sensor_limit'] . " °C)", $device['device_id'], 'temperature', $temperature['sensor_id']);
}
- mysql_query("UPDATE temperature SET temp_current = '$temp' WHERE temp_id = '" . $temperature['temp_id'] . "'");
+ mysql_query("UPDATE sensors SET sensor_current = '$temp' WHERE sensor_class='temperature' AND sensor_id = '" . $temperature['sensor_id'] . "'");
}
?>
| | |