diff --git a/database-update.sql b/database-update.sql
index 24f55ce5ea..187bc0c869 100644
--- a/database-update.sql
+++ b/database-update.sql
@@ -25,3 +25,4 @@ ALTER TABLE `sensors` CHANGE `sensor_index` `sensor_index` VARCHAR(10) NOT NU
DROP TABLE `fanspeed`;
DROP TABLE `temperature`;
DROP TABLE `voltage`;
+DROP TABLE `current`;
diff --git a/html/includes/graphs/current.inc.php b/html/includes/graphs/current.inc.php
index d411202541..76a6843881 100644
--- a/html/includes/graphs/current.inc.php
+++ b/html/includes/graphs/current.inc.php
@@ -6,16 +6,16 @@ include("common.inc.php");
$rrd_options .= " COMMENT:' Last Max\\n'";
- $current = mysql_fetch_array(mysql_query("SELECT * FROM current where current_id = '".mres($_GET['id'])."'"));
+ $current = mysql_fetch_array(mysql_query("SELECT * FROM sensors WHERE sensor_class='current' AND sensor_id = '".mres($_GET['id'])."'"));
$hostname = mysql_result(mysql_query("SELECT hostname FROM devices WHERE device_id = '" . $current['device_id'] . "'"),0);
- $current['current_descr_fixed'] = substr(str_pad($current['current_descr'], 28),0,28);
+ $current['sensor_descr_fixed'] = substr(str_pad($current['sensor_descr'], 28),0,28);
- $rrd_filename = $config['rrd_dir'] . "/".$hostname."/" . safename("current-" . $current['current_descr'] . ".rrd");
+ $rrd_filename = $config['rrd_dir'] . "/".$hostname."/" . safename("current-" . $current['sensor_descr'] . ".rrd");
$rrd_options .= " DEF:current=$rrd_filename:current:AVERAGE";
- $rrd_options .= " LINE1.5:current#cc0000:'" . $current['current_descr_fixed']."'";
+ $rrd_options .= " LINE1.5:current#cc0000:'" . $current['sensor_descr_fixed']."'";
$rrd_options .= " GPRINT:current:LAST:%3.0lfA";
$rrd_options .= " GPRINT:current:MAX:%3.0lfA\\\\l";
diff --git a/html/includes/graphs/device_current.inc.php b/html/includes/graphs/device_current.inc.php
index 2761256986..12034d3623 100644
--- a/html/includes/graphs/device_current.inc.php
+++ b/html/includes/graphs/device_current.inc.php
@@ -6,7 +6,7 @@ $device = device_by_id_cache($id);
$rrd_options .= " -l 0 -E ";
$iter = "1";
-$sql = mysql_query("SELECT * FROM current where device_id = '$id'");
+$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='current' AND device_id = '$id'");
$rrd_options .= " COMMENT:' Cur Min Max\\n'";
while($current = mysql_fetch_array($sql))
{
@@ -39,9 +39,9 @@ while($current = mysql_fetch_array($sql))
$hostname = gethostbyid($current['device_id']);
- $descr = substr(str_pad($current['current_descr'], 15),0,15);
- $rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("current-" . $current['current_descr'] . ".rrd");
- $current_id = $current['current_id'];
+ $descr = substr(str_pad($current['sensor_descr'], 15),0,15);
+ $rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("current-" . $current['sensor_descr'] . ".rrd");
+ $current_id = $current['sensor_id'];
$rrd_options .= " DEF:current$current_id=$rrd_filename:current:AVERAGE";
$rrd_options .= " LINE1:current$current_id#".$colour.":'" . $descr . "'";
diff --git a/html/pages/device/health.inc.php b/html/pages/device/health.inc.php
index faca834a7a..ed04bc9140 100644
--- a/html/pages/device/health.inc.php
+++ b/html/pages/device/health.inc.php
@@ -1,15 +1,16 @@
");
@@ -12,10 +12,10 @@ while($current = mysql_fetch_array($query)) {
if(!is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
echo("
");
@@ -23,17 +23,17 @@ while($current = mysql_fetch_array($query)) {
// start current graphs
- $daily_current = "graph.php?id=" . $current['current_id'] . "&type=$graph_type&from=$day&to=$now&width=211&height=100";
- $daily_url = "graph.php?id=" . $current['current_id'] . "&type=$graph_type&from=$day&to=$now&width=400&height=150";
+ $daily_current = "graph.php?id=" . $current['sensor_id'] . "&type=$graph_type&from=$day&to=$now&width=211&height=100";
+ $daily_url = "graph.php?id=" . $current['sensor_id'] . "&type=$graph_type&from=$day&to=$now&width=400&height=150";
- $weekly_current = "graph.php?id=" . $current['current_id'] . "&type=$graph_type&from=$week&to=$now&width=211&height=100";
- $weekly_url = "graph.php?id=" . $current['current_id'] . "&type=$graph_type&from=$week&to=$now&width=400&height=150";
+ $weekly_current = "graph.php?id=" . $current['sensor_id'] . "&type=$graph_type&from=$week&to=$now&width=211&height=100";
+ $weekly_url = "graph.php?id=" . $current['sensor_id'] . "&type=$graph_type&from=$week&to=$now&width=400&height=150";
- $monthly_current = "graph.php?id=" . $current['current_id'] . "&type=$graph_type&from=$month&to=$now&width=211&height=100";
- $monthly_url = "graph.php?id=" . $current['current_id'] . "&type=$graph_type&from=$month&to=$now&width=400&height=150";
+ $monthly_current = "graph.php?id=" . $current['sensor_id'] . "&type=$graph_type&from=$month&to=$now&width=211&height=100";
+ $monthly_url = "graph.php?id=" . $current['sensor_id'] . "&type=$graph_type&from=$month&to=$now&width=400&height=150";
- $yearly_current = "graph.php?id=" . $current['current_id'] . "&type=$graph_type&from=$year&to=$now&width=211&height=100";
- $yearly_url = "graph.php?id=" . $current['current_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150";
+ $yearly_current = "graph.php?id=" . $current['sensor_id'] . "&type=$graph_type&from=$year&to=$now&width=211&height=100";
+ $yearly_url = "graph.php?id=" . $current['sensor_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150";
echo("', LEFT);\" onmouseout=\"return nd();\">
");
diff --git a/html/pages/device/health/diskio.inc.php b/html/pages/device/health/diskio.inc.php
index f9d870fe4d..43aeaed647 100644
--- a/html/pages/device/health/diskio.inc.php
+++ b/html/pages/device/health/diskio.inc.php
@@ -1,6 +1,6 @@
");
diff --git a/html/pages/device/health/fanspeeds.inc.php b/html/pages/device/health/fanspeeds.inc.php
index a53774afb6..b12175729b 100644
--- a/html/pages/device/health/fanspeeds.inc.php
+++ b/html/pages/device/health/fanspeeds.inc.php
@@ -1,6 +1,6 @@
");
diff --git a/html/pages/device/health/frequencies.inc.php b/html/pages/device/health/frequencies.inc.php
index 7a925f48f5..b69f8dfa1f 100644
--- a/html/pages/device/health/frequencies.inc.php
+++ b/html/pages/device/health/frequencies.inc.php
@@ -1,6 +1,6 @@
");
diff --git a/html/pages/device/health/humidity.inc.php b/html/pages/device/health/humidity.inc.php
index 16dc503c7e..9deb032495 100644
--- a/html/pages/device/health/humidity.inc.php
+++ b/html/pages/device/health/humidity.inc.php
@@ -1,6 +1,6 @@
");
diff --git a/html/pages/device/health/storage.inc.php b/html/pages/device/health/storage.inc.php
index e9c69150ee..6ecea3ac72 100644
--- a/html/pages/device/health/storage.inc.php
+++ b/html/pages/device/health/storage.inc.php
@@ -1,6 +1,6 @@
");
diff --git a/html/pages/device/health/temperatures.inc.php b/html/pages/device/health/temperatures.inc.php
index 3b2728449a..9b6daa535c 100644
--- a/html/pages/device/health/temperatures.inc.php
+++ b/html/pages/device/health/temperatures.inc.php
@@ -1,6 +1,6 @@
");
diff --git a/html/pages/device/health/voltages.inc.php b/html/pages/device/health/voltages.inc.php
index ceaf571e48..cc838684ac 100644
--- a/html/pages/device/health/voltages.inc.php
+++ b/html/pages/device/health/voltages.inc.php
@@ -1,6 +1,6 @@
");
diff --git a/html/pages/device/overview/current.inc.php b/html/pages/device/overview/current.inc.php
index ef12364b7b..ecec1a4c60 100644
--- a/html/pages/device/overview/current.inc.php
+++ b/html/pages/device/overview/current.inc.php
@@ -1,13 +1,12 @@
");
echo(" Current ");
$i = '1';
- $currents = mysql_query("SELECT * FROM current WHERE device_id = '" . $device['device_id'] . "'");
+ $currents = mysql_query("SELECT * FROM sensors WHERE sensor_class='current' AND device_id = '" . $device['device_id'] . "'");
echo("");
echo("");
echo("");
@@ -16,21 +15,21 @@ if(mysql_result(mysql_query("SELECT count(current_id) from current WHERE device_
$graph_colour = str_replace("#", "", $row_colour);
- $current_day = "graph.php?id=" . $current['current_id'] . "&type=current&from=$day&to=$now&width=300&height=100";
- $current_week = "graph.php?id=" . $current['current_id'] . "&type=current&from=$week&to=$now&width=300&height=100";
- $current_month = "graph.php?id=" . $current['current_id'] . "&type=current&from=$month&to=$now&width=300&height=100";
- $current_year = "graph.php?id=" . $current['current_id'] . "&type=current&from=$year&to=$now&width=300&height=100";
- $current_minigraph = " ";
+ $current_day = "graph.php?id=" . $current['sensor_id'] . "&type=current&from=$day&to=$now&width=300&height=100";
+ $current_week = "graph.php?id=" . $current['sensor_id'] . "&type=current&from=$week&to=$now&width=300&height=100";
+ $current_month = "graph.php?id=" . $current['sensor_id'] . "&type=current&from=$month&to=$now&width=300&height=100";
+ $current_year = "graph.php?id=" . $current['sensor_id'] . "&type=current&from=$year&to=$now&width=300&height=100";
+ $current_minigraph = " ";
$current_link = "";
- $current_link_c = $current_link . " $current['current_limit'] ? "style='color: red'" : '') . '>' . $current['current_current'] . "A";
+ $current_link_c = $current_link . " $current['sensor_limit'] ? "style='color: red'" : '') . '>' . $current['sensor_current'] . "A";
$current_link_b = $current_link . $current_minigraph . "";
- $current_link_a = $current_link . $current['current_descr'] . "";
+ $current_link_a = $current_link . $current['sensor_descr'] . "";
- $current['current_descr'] = truncate($current['current_descr'], 25, '');
+ $current['sensor_descr'] = truncate($current['sensor_descr'], 25, '');
echo("$current_link_a | $current_link_b | $current_link_c | ");
if($i == $rows) { echo(" | "); }
$i++;
diff --git a/html/pages/health/current.inc.php b/html/pages/health/current.inc.php
index 1405a6fcad..d426ea0d84 100644
--- a/html/pages/health/current.inc.php
+++ b/html/pages/health/current.inc.php
@@ -1,9 +1,9 @@
= '5') {
- $sql = "SELECT * FROM `current` AS V, `devices` AS D WHERE V.device_id = D.device_id ORDER BY D.hostname, V.current_descr";
+ $sql = "SELECT * FROM `sensors` AS S, `devices` AS D WHERE S.sensor_class='current' AND S.device_id = D.device_id ORDER BY D.hostname, S.sensor_descr";
} else {
- $sql = "SELECT * FROM `current` AS V, `devices` AS D, devices_perms as P WHERE V.device_id = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, V.current_descr";
+ $sql = "SELECT * FROM `current` AS S, `devices` AS D, devices_perms as P WHERE S.sensor_class='current' AND 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_descr";
}
$query = mysql_query($sql);
@@ -27,19 +27,19 @@ while($current = mysql_fetch_array($query))
{
if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
- $weekly_current = "graph.php?id=" . $current['current_id'] . "&type=current&from=$week&to=$now&width=500&height=150";
+ $weekly_current = "graph.php?id=" . $current['sensor_id'] . "&type=current&from=$week&to=$now&width=500&height=150";
$current_popup = "', LEFT);\" onmouseout=\"return nd();\">
- " . $current['current_descr'] . "";
+ " . $current['sensor_descr'] . "";
- if($current['current_current'] >= $current['current_limit']) { $alert = ' '; } else { $alert = ""; }
+ if($current['sensor_current'] >= $current['sensor_limit']) { $alert = ' '; } else { $alert = ""; }
- $current_day = "graph.php?id=" . $current['current_id'] . "&type=current&from=$day&to=$now&width=300&height=100";
- $current_week = "graph.php?id=" . $current['current_id'] . "&type=current&from=$week&to=$now&width=300&height=100";
- $current_month = "graph.php?id=" . $current['current_id'] . "&type=current&from=$month&to=$now&width=300&height=100";
- $current_year = "graph.php?id=" . $current['current_id'] . "&type=current&from=$year&to=$now&width=300&height=100";
+ $current_day = "graph.php?id=" . $current['sensor_id'] . "&type=current&from=$day&to=$now&width=300&height=100";
+ $current_week = "graph.php?id=" . $current['sensor_id'] . "&type=current&from=$week&to=$now&width=300&height=100";
+ $current_month = "graph.php?id=" . $current['sensor_id'] . "&type=current&from=$month&to=$now&width=300&height=100";
+ $current_year = "graph.php?id=" . $current['sensor_id'] . "&type=current&from=$year&to=$now&width=300&height=100";
- $current_minigraph = " ".$current['hostname']." - ".$current['current_descr'];
+ $current_minigraph = " ".$current['hostname']." - ".$current['sensor_descr'];
$current_minigraph .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
echo("
@@ -47,27 +47,27 @@ while($current = mysql_fetch_array($query))
$current_popup |
$current_minigraph |
$alert |
- " . $current['current_current'] . "A |
- " . $current['current_limit_warn'] . "A |
- " . $current['current_limit'] . "A |
- " . (isset($current['current_notes']) ? $current['current_notes'] : '') . " |
+ " . $current['sensor_current'] . "A |
+ " . $current['sensor_limit_warn'] . "A |
+ " . $current['sensor_limit'] . "A |
+ " . (isset($current['sensor_notes']) ? $current['sensor_notes'] : '') . " |
\n");
if($_GET['optb'] == "graphs") { ## If graphs
echo("");
- $daily_graph = "graph.php?id=" . $current['current_id'] . "&type=current&from=$day&to=$now&width=211&height=100";
- $daily_url = "graph.php?id=" . $current['current_id'] . "&type=current&from=$day&to=$now&width=400&height=150";
+ $daily_graph = "graph.php?id=" . $current['sensor_id'] . "&type=current&from=$day&to=$now&width=211&height=100";
+ $daily_url = "graph.php?id=" . $current['sensor_id'] . "&type=current&from=$day&to=$now&width=400&height=150";
- $weekly_graph = "graph.php?id=" . $current['current_id'] . "&type=current&from=$week&to=$now&width=211&height=100";
- $weekly_url = "graph.php?id=" . $current['current_id'] . "&type=current&from=$week&to=$now&width=400&height=150";
+ $weekly_graph = "graph.php?id=" . $current['sensor_id'] . "&type=current&from=$week&to=$now&width=211&height=100";
+ $weekly_url = "graph.php?id=" . $current['sensor_id'] . "&type=current&from=$week&to=$now&width=400&height=150";
- $monthly_graph = "graph.php?id=" . $current['current_id'] . "&type=current&from=$month&to=$now&width=211&height=100";
- $monthly_url = "graph.php?id=" . $current['current_id'] . "&type=current&from=$month&to=$now&width=400&height=150";
+ $monthly_graph = "graph.php?id=" . $current['sensor_id'] . "&type=current&from=$month&to=$now&width=211&height=100";
+ $monthly_url = "graph.php?id=" . $current['sensor_id'] . "&type=current&from=$month&to=$now&width=400&height=150";
- $yearly_graph = "graph.php?id=" . $current['current_id'] . "&type=current&from=$year&to=$now&width=211&height=100";
- $yearly_url = "graph.php?id=" . $current['current_id'] . "&type=current&from=$year&to=$now&width=400&height=150";
+ $yearly_graph = "graph.php?id=" . $current['sensor_id'] . "&type=current&from=$year&to=$now&width=211&height=100";
+ $yearly_url = "graph.php?id=" . $current['sensor_id'] . "&type=current&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 56674639dc..5e2303f81d 100644
--- a/includes/discovery/functions.inc.php
+++ b/includes/discovery/functions.inc.php
@@ -341,24 +341,24 @@ function discover_current(&$valid, $device, $oid, $index, $type, $descr, $precis
$low_limit = $config['limit']['current'];
}
- if (mysql_result(mysql_query("SELECT count(current_id) FROM `current` WHERE device_id = '".$device['device_id']."' AND current_type = '$type' AND `current_index` = '$index'"),0) == '0')
+ if (mysql_result(mysql_query("SELECT count(sensor_id) FROM `sensors` WHERE sensor_class='current' AND device_id = '".$device['device_id']."' AND sensor_type = '$type' AND `sensor_index` = '$index'"),0) == '0')
{
- $query = "INSERT INTO current (`device_id`, `current_oid`, `current_index`, `current_type`, `current_descr`, `current_precision`, `current_limit`, `current_limit_warn`, `current_limit_low`, `current_current`) ";
- $query .= " VALUES ('".$device['device_id']."', '$oid', '$index', '$type', '$descr', '$precision', '$high_limit', '$warn_limit', '$low_limit', '$current')";
+ $query = "INSERT INTO sensors (`sensor_class`, `device_id`, `sensor_oid`, `sensor_index`, `sensor_type`, `sensor_descr`, `sensor_precision`, `sensor_limit`, `sensor_limit_warn`, `sensor_limit_low`, `sensor_current`) ";
+ $query .= " VALUES ('current', '".$device['device_id']."', '$oid', '$index', '$type', '$descr', '$precision', '$high_limit', '$warn_limit', '$low_limit', '$current')";
mysql_query($query);
if($debug) { echo("$query ". mysql_affected_rows() . " inserted"); }
echo("+");
}
else
{
- $current_entry = mysql_fetch_array(mysql_query("SELECT * FROM `current` WHERE device_id = '".$device['device_id']."' AND current_type = '$type' AND `current_index` = '$index'"));
- if($oid == $current_entry['current_oid'] && $descr == $current_entry['current_descr'] && $precision == $current_entry['current_precision'])
+ $current_entry = mysql_fetch_array(mysql_query("SELECT * FROM `sensors` WHERE sensor_class='current' AND device_id = '".$device['device_id']."' AND sensor_type = '$type' AND `sensor_index` = '$index'"));
+ if($oid == $current_entry['sensor_oid'] && $descr == $current_entry['sensor_descr'] && $precision == $current_entry['sensor_precision'])
{
echo(".");
}
else
{
- mysql_query("UPDATE current SET `current_descr` = '$descr', `current_oid` = '$oid', `current_precision` = '$precision' WHERE `device_id` = '" . $device['device_id'] . "' AND current_type = '$type' AND `current_index` = '$index' ");
+ mysql_query("UPDATE current SET `sensor_descr` = '$descr', `sensor_oid` = '$oid', `sensor_precision` = '$precision' WHERE `sensor_class`='current' AND `device_id` = '" . $device['device_id'] . "' AND sensor_type = '$type' AND `sensor_index` = '$index' ");
echo("U");
if($debug) { echo("$query ". mysql_affected_rows() . " updated"); }
}
diff --git a/includes/functions.php b/includes/functions.php
index eeb9c9177a..c82b0d3eb4 100755
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -277,7 +277,7 @@ function addHost($host, $community, $snmpver, $port = 161)
{
global $config;
list($hostshort) = explode(".", $host);
- if ( isDomainResolves($host)){
+ if ( isDomainResolves($host)) {
if ( isPingable($host)) {
if ( mysql_result(mysql_query("SELECT COUNT(*) FROM `devices` WHERE `hostname` = '$host'"), 0) == '0' ) {
$snmphost = shell_exec($config['snmpget'] ." -m SNMPv2-MIB -Oqv -$snmpver -c $community $host:$port sysName.0");
@@ -332,17 +332,17 @@ function formatUptime($diff, $format="long")
$uptime = "";
if ($format == "short") {
- if ($yearsDiff > '0'){ $uptime .= $yearsDiff . "y "; }
- if ($daysDiff > '0'){ $uptime .= $daysDiff . "d "; }
- if ($hrsDiff > '0'){ $uptime .= $hrsDiff . "h "; }
- if ($minsDiff > '0'){ $uptime .= $minsDiff . "m "; }
- if ($secsDiff > '0'){ $uptime .= $secsDiff . "s "; }
+ if ($yearsDiff > '0') { $uptime .= $yearsDiff . "y "; }
+ if ($daysDiff > '0') { $uptime .= $daysDiff . "d "; }
+ if ($hrsDiff > '0') { $uptime .= $hrsDiff . "h "; }
+ if ($minsDiff > '0') { $uptime .= $minsDiff . "m "; }
+ if ($secsDiff > '0') { $uptime .= $secsDiff . "s "; }
} else {
- if ($yearsDiff > '0'){ $uptime .= $yearsDiff . " years, "; }
- if ($daysDiff > '0'){ $uptime .= $daysDiff . " day" . ($daysDiff != 1 ? 's' : '' ) . ", "; }
- if ($hrsDiff > '0'){ $uptime .= $hrsDiff . "h "; }
- if ($minsDiff > '0'){ $uptime .= $minsDiff . "m "; }
- if ($secsDiff > '0'){ $uptime .= $secsDiff . "s "; }
+ if ($yearsDiff > '0') { $uptime .= $yearsDiff . " years, "; }
+ if ($daysDiff > '0') { $uptime .= $daysDiff . " day" . ($daysDiff != 1 ? 's' : '' ) . ", "; }
+ if ($hrsDiff > '0') { $uptime .= $hrsDiff . "h "; }
+ if ($minsDiff > '0') { $uptime .= $minsDiff . "m "; }
+ if ($secsDiff > '0') { $uptime .= $secsDiff . "s "; }
}
return trim($uptime);
}
@@ -368,7 +368,6 @@ function isPingable($hostname) {
}
}
-
function is_odd($number) {
return $number & 1; // 0 = even, 1 = odd
}
@@ -624,7 +623,6 @@ function log_event($text, $device = NULL, $type = NULL, $reference = NULL)
mysql_query($event_query);
}
-
function notify($device,$title,$message)
{
global $config;
@@ -633,7 +631,6 @@ function notify($device,$title,$message)
mail($email, $title, $message, $config['email_headers']);
}
-
function formatCiscoHardware(&$device, $short = false)
{
diff --git a/includes/polling/current.inc.php b/includes/polling/current.inc.php
index e791865ae2..2b8374132a 100644
--- a/includes/polling/current.inc.php
+++ b/includes/polling/current.inc.php
@@ -1,22 +1,19 @@
$dbcurrent['current_limit_low'] && $current <= $dbcurrent['current_limit_low'])
+ if($dbcurrent['sensor_current'] > $dbcurrent['sensor_limit_low'] && $current <= $dbcurrent['sensor_limit_low'])
{
if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
- $msg = "Current Alarm: " . $device['hostname'] . " " . $dbcurrent['current_descr'] . " is " . $current . "A (Limit " . $dbcurrent['current_limit'];
+ $msg = "Current Alarm: " . $device['hostname'] . " " . $dbcurrent['sensor_descr'] . " is " . $current . "A (Limit " . $dbcurrent['sensor_limit'];
$msg .= "A) at " . date($config['timestamp_format']);
- mail($email, "Current Alarm: " . $device['hostname'] . " " . $dbcurrent['current_descr'], $msg, $config['email_headers']);
- echo("Alerting for " . $device['hostname'] . " " . $dbcurrent['current_descr'] . "\n");
- log_event('Current ' . $dbcurrent['current_descr'] . " under threshold: " . $current . " A (< " . $dbcurrent['current_limit_low'] . " A)", $device['device_id'], 'current', $current['current_id']);
+ mail($email, "Current Alarm: " . $device['hostname'] . " " . $dbcurrent['sensor_descr'], $msg, $config['email_headers']);
+ echo("Alerting for " . $device['hostname'] . " " . $dbcurrent['sensor_descr'] . "\n");
+ log_event('Current ' . $dbcurrent['sensor_descr'] . " under threshold: " . $current . " A (< " . $dbcurrent['sensor_limit_low'] . " A)", $device['device_id'], 'current', $current['sensor_id']);
}
- else if($dbcurrent['current_current'] < $dbcurrent['current_limit'] && $current >= $dbcurrent['current_limit'])
+ else if($dbcurrent['sensor_current'] < $dbcurrent['sensor_limit'] && $current >= $dbcurrent['sensor_limit'])
{
if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
- $msg = "Current Alarm: " . $device['hostname'] . " " . $dbcurrent['current_descr'] . " is " . $current . "A (Limit " . $dbcurrent['current_limit'];
+ $msg = "Current Alarm: " . $device['hostname'] . " " . $dbcurrent['sensor_descr'] . " is " . $current . "A (Limit " . $dbcurrent['sensor_limit'];
$msg .= "A) at " . date($config['timestamp_format']);
- mail($email, "Current Alarm: " . $device['hostname'] . " " . $dbcurrent['current_descr'], $msg, $config['email_headers']);
- echo("Alerting for " . $device['hostname'] . " " . $dbcurrent['current_descr'] . "\n");
- log_event('Current ' . $dbcurrent['current_descr'] . " above threshold: " . $current . " A (> " . $dbcurrent['current_limit'] . " A)", $device['device_id'], 'current', $current['current_id']);
+ mail($email, "Current Alarm: " . $device['hostname'] . " " . $dbcurrent['sensor_descr'], $msg, $config['email_headers']);
+ echo("Alerting for " . $device['hostname'] . " " . $dbcurrent['sensor_descr'] . "\n");
+ log_event('Current ' . $dbcurrent['sensor_descr'] . " above threshold: " . $current . " A (> " . $dbcurrent['sensor_limit'] . " A)", $device['device_id'], 'current', $current['sensor_id']);
}
- mysql_query("UPDATE current SET current_current = '$current' WHERE current_id = '" . $dbcurrent['current_id'] . "'");
+ mysql_query("UPDATE sensors SET sensor_current = '$current' WHERE sensor_class='current' AND sensor_id = '" . $dbcurrent['sensor_id'] . "'");
}
?>
| | |