");
echo("");
@@ -16,21 +15,21 @@ if(mysql_result(mysql_query("SELECT count(volt_id) from voltage WHERE device_id
$graph_colour = str_replace("#", "", $row_colour);
- $volt_day = "graph.php?id=" . $volt['volt_id'] . "&type=voltage&from=$day&to=$now&width=300&height=100";
- $volt_week = "graph.php?id=" . $volt['volt_id'] . "&type=voltage&from=$week&to=$now&width=300&height=100";
- $volt_month = "graph.php?id=" . $volt['volt_id'] . "&type=voltage&from=$month&to=$now&width=300&height=100";
- $volt_year = "graph.php?id=" . $volt['volt_id'] . "&type=voltage&from=$year&to=$now&width=300&height=100";
- $volt_minigraph = " ";
+ $volt_day = "graph.php?id=" . $volt['sensor_id'] . "&type=voltage&from=$day&to=$now&width=300&height=100";
+ $volt_week = "graph.php?id=" . $volt['sensor_id'] . "&type=voltage&from=$week&to=$now&width=300&height=100";
+ $volt_month = "graph.php?id=" . $volt['sensor_id'] . "&type=voltage&from=$month&to=$now&width=300&height=100";
+ $volt_year = "graph.php?id=" . $volt['sensor_id'] . "&type=voltage&from=$year&to=$now&width=300&height=100";
+ $volt_minigraph = " ";
$volt_link = "";
- $volt_link_c = $volt_link . " $volt['volt_limit'] ? "style='color: red'" : '') . '>' . $volt['volt_current'] . "V";
+ $volt_link_c = $volt_link . " $volt['sensor_limit'] ? "style='color: red'" : '') . '>' . $volt['sensor_current'] . "V";
$volt_link_b = $volt_link . $volt_minigraph . "";
- $volt_link_a = $volt_link . $volt['volt_descr'] . "";
+ $volt_link_a = $volt_link . $volt['sensor_descr'] . "";
- $volt['volt_descr'] = truncate($volt['volt_descr'], 25, '');
+ $volt['sensor_descr'] = truncate($volt['sensor_descr'], 25, '');
echo("| $volt_link_a | $volt_link_b | $volt_link_c | ");
if($i == $rows) { echo(" | "); }
$i++;
diff --git a/html/pages/health/voltages.inc.php b/html/pages/health/voltages.inc.php
index 710340cf6..d58941c20 100644
--- a/html/pages/health/voltages.inc.php
+++ b/html/pages/health/voltages.inc.php
@@ -1,9 +1,9 @@
= '5') {
- $sql = "SELECT * FROM `voltage` AS V, `devices` AS D WHERE V.device_id = D.device_id ORDER BY D.hostname, V.volt_descr";
+ $sql = "SELECT * FROM `sensors` AS S, `devices` AS D WHERE S.sensor_class='voltage' AND S.device_id = D.device_id ORDER BY D.hostname, S.sensor_descr";
} else {
- $sql = "SELECT * FROM `voltage` 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.volt_descr";
+ $sql = "SELECT * FROM `sensors` AS S, `devices` AS D, devices_perms as P WHERE S.sensor_class='voltage' 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);
@@ -26,19 +26,19 @@ while($volt = mysql_fetch_array($query))
{
if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
- $weekly_volt = "graph.php?id=" . $volt['volt_id'] . "&type=voltage&from=$week&to=$now&width=500&height=150";
+ $weekly_volt = "graph.php?id=" . $volt['sensor_id'] . "&type=voltage&from=$week&to=$now&width=500&height=150";
$volt_popup = "', LEFT);\" onmouseout=\"return nd();\">
- " . $volt['volt_descr'] . "";
+ " . $volt['sensor_descr'] . "";
- if($volt['volt_current'] >= $volt['volt_limit']) { $alert = ' '; } else { $alert = ""; }
+ if($volt['sensor_current'] >= $volt['sensor_limit']) { $alert = ' '; } else { $alert = ""; }
- $volt_day = "graph.php?id=" . $volt['volt_id'] . "&type=voltage&from=$day&to=$now&width=300&height=100";
- $volt_week = "graph.php?id=" . $volt['volt_id'] . "&type=voltage&from=$week&to=$now&width=300&height=100";
- $volt_month = "graph.php?id=" . $volt['volt_id'] . "&type=voltage&from=$month&to=$now&width=300&height=100";
- $volt_year = "graph.php?id=" . $volt['volt_id'] . "&type=voltage&from=$year&to=$now&width=300&height=100";
+ $volt_day = "graph.php?id=" . $volt['sensor_id'] . "&type=voltage&from=$day&to=$now&width=300&height=100";
+ $volt_week = "graph.php?id=" . $volt['sensor_id'] . "&type=voltage&from=$week&to=$now&width=300&height=100";
+ $volt_month = "graph.php?id=" . $volt['sensor_id'] . "&type=voltage&from=$month&to=$now&width=300&height=100";
+ $volt_year = "graph.php?id=" . $volt['sensor_id'] . "&type=voltage&from=$year&to=$now&width=300&height=100";
- $volt_minigraph = " ".$volt['hostname']." - ".$volt['volt_descr'];
+ $volt_minigraph = " ".$volt['hostname']." - ".$volt['sensor_descr'];
$volt_minigraph .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
echo("
@@ -46,26 +46,26 @@ while($volt = mysql_fetch_array($query))
| $volt_popup |
$volt_minigraph |
$alert |
- " . $volt['volt_current'] . "V |
- " . $volt['volt_limit_low'] . "V - " . $volt['volt_limit'] . "V |
- " . (isset($volt['volt_notes']) ? $volt['volt_notes'] : '') . " |
+ " . $volt['sensor_current'] . "V |
+ " . $volt['sensor_limit_low'] . "V - " . $volt['sensor_limit'] . "V |
+ " . (isset($volt['sensor_notes']) ? $volt['sensor_notes'] : '') . " |
\n");
if($_GET['optb'] == "graphs") { ## If graphs
echo("");
- $daily_graph = "graph.php?id=" . $volt['volt_id'] . "&type=voltage&from=$day&to=$now&width=211&height=100";
- $daily_url = "graph.php?id=" . $volt['volt_id'] . "&type=voltage&from=$day&to=$now&width=400&height=150";
+ $daily_graph = "graph.php?id=" . $volt['sensor_id'] . "&type=voltage&from=$day&to=$now&width=211&height=100";
+ $daily_url = "graph.php?id=" . $volt['sensor_id'] . "&type=voltage&from=$day&to=$now&width=400&height=150";
- $weekly_graph = "graph.php?id=" . $volt['volt_id'] . "&type=voltage&from=$week&to=$now&width=211&height=100";
- $weekly_url = "graph.php?id=" . $volt['volt_id'] . "&type=voltage&from=$week&to=$now&width=400&height=150";
+ $weekly_graph = "graph.php?id=" . $volt['sensor_id'] . "&type=voltage&from=$week&to=$now&width=211&height=100";
+ $weekly_url = "graph.php?id=" . $volt['sensor_id'] . "&type=voltage&from=$week&to=$now&width=400&height=150";
- $monthly_graph = "graph.php?id=" . $volt['volt_id'] . "&type=voltage&from=$month&to=$now&width=211&height=100";
- $monthly_url = "graph.php?id=" . $volt['volt_id'] . "&type=voltage&from=$month&to=$now&width=400&height=150";
+ $monthly_graph = "graph.php?id=" . $volt['sensor_id'] . "&type=voltage&from=$month&to=$now&width=211&height=100";
+ $monthly_url = "graph.php?id=" . $volt['sensor_id'] . "&type=voltage&from=$month&to=$now&width=400&height=150";
- $yearly_graph = "graph.php?id=" . $volt['volt_id'] . "&type=voltage&from=$year&to=$now&width=211&height=100";
- $yearly_url = "graph.php?id=" . $volt['volt_id'] . "&type=voltage&from=$year&to=$now&width=400&height=150";
+ $yearly_graph = "graph.php?id=" . $volt['sensor_id'] . "&type=voltage&from=$year&to=$now&width=211&height=100";
+ $yearly_url = "graph.php?id=" . $volt['sensor_id'] . "&type=voltage&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 ab06be2c9..56674639d 100644
--- a/includes/discovery/functions.inc.php
+++ b/includes/discovery/functions.inc.php
@@ -195,7 +195,7 @@ function discover_fan(&$valid, $device, $oid, $index, $type, $descr, $precision
}
else
{
- mysql_query("UPDATE fanspeed SET `sensor_descr` = '$descr', `sensor_oid` = '$oid', `sensor_precision` = '$precision' WHERE `sensor_class` = 'fanspeed' AND `device_id` = '".$device['device_id']."' AND sensor_type = '$type' AND `sensor_index` = '$index' ");
+ mysql_query("UPDATE sensors SET `sensor_descr` = '$descr', `sensor_oid` = '$oid', `sensor_precision` = '$precision' WHERE `sensor_class` = 'fanspeed' AND `device_id` = '".$device['device_id']."' AND sensor_type = '$type' AND `sensor_index` = '$index' ");
echo("U");
}
}
@@ -213,14 +213,14 @@ function discover_volt(&$valid, $device, $oid, $index, $type, $descr, $precision
$low_limit = $config['limit']['volt'];
}
- if (mysql_result(mysql_query("SELECT count(volt_id) FROM `voltage` WHERE device_id = '".$device['device_id']."' AND volt_type = '$type' AND `volt_index` = '$index'"),0) == '0')
+ if (mysql_result(mysql_query("SELECT count(sensor_id) FROM `sensors` WHERE sensor_class='voltage' AND device_id = '".$device['device_id']."' AND sensor_type = '$type' AND `sensor_index` = '$index'"),0) == '0')
{
if(!$high_limit && isset($current)) { $high_limit = round($current * 1.05, 2); }
if(!$low_limit && isset($current)) { $low_limit = round($current * 0.95, 2); }
- $query = "INSERT INTO voltage (`device_id`, `volt_oid`, `volt_index`, `volt_type`, `volt_descr`, `volt_precision`, `volt_limit`, `volt_limit_low`, `volt_current`) ";
- $query .= " VALUES ('".$device['device_id']."', '$oid', '$index', '$type', '$descr', '$precision', '$high_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_low`, `sensor_current`) ";
+ $query .= " VALUES ('voltage','".$device['device_id']."', '$oid', '$index', '$type', '$descr', '$precision', '$high_limit', '$low_limit', '$current')";
mysql_query($query);
if($debug) { echo("$query ". mysql_affected_rows() . " inserted"); }
echo("+");
@@ -228,21 +228,21 @@ function discover_volt(&$valid, $device, $oid, $index, $type, $descr, $precision
else
{
- $volt_entry = mysql_fetch_array(mysql_query("SELECT * FROM `voltage` WHERE device_id = '".$device['device_id']."' AND volt_type = '$type' AND `volt_index` = '$index'"));
+ $volt_entry = mysql_fetch_array(mysql_query("SELECT * FROM `sensors` WHERE sensor_class='voltage' AND device_id = '".$device['device_id']."' AND sensor_type = '$type' AND `sensor_index` = '$index'"));
if(!isset($current) && isset($volt_entry['current'])) { $current = $volt_entry['current']; }
- if(!$high_limit && !$volt_entry['volt_limit'] && $current) { $high_limit = round($current * 1.05, 2); } elseif (!$high_limit && $volt_entry['volt_limit']) { $high_limit = $volt_entry['volt_limit']; }
- if(!$low_limit && !$volt_entry['volt_limit_low'] && $current) { $low_limit = round($current * 0.95, 2); } elseif (!$low_limit && $volt_entry['volt_limit_low']) { $low_limit = $volt_entry['volt_limit_low']; }
+ if(!$high_limit && !$volt_entry['sensor_limit'] && $current) { $high_limit = round($current * 1.05, 2); } elseif (!$high_limit && $volt_entry['sensor_limit']) { $high_limit = $volt_entry['sensor_limit']; }
+ if(!$low_limit && !$volt_entry['sensor_limit_low'] && $current) { $low_limit = round($current * 0.95, 2); } elseif (!$low_limit && $volt_entry['sensor_limit_low']) { $low_limit = $volt_entry['sensor_limit_low']; }
- if($oid == $volt_entry['volt_oid'] && $descr == $volt_entry['volt_descr'] && $precision == $volt_entry['volt_precision'] && $volt_entry['volt_limit'] == $high_limit && $volt_entry['volt_limit_low'] == $low_limit)
+ if($oid == $volt_entry['sensor_oid'] && $descr == $volt_entry['sensor_descr'] && $precision == $volt_entry['sensor_precision'] && $volt_entry['sensor_limit'] == $high_limit && $volt_entry['sensor_limit_low'] == $low_limit)
{
echo(".");
}
else
{
- $sql = "UPDATE voltage SET `volt_descr` = '$descr', `volt_oid` = '$oid', `volt_precision` = '$precision', `volt_limit_low` = '$low_limit', `volt_limit` = '$high_limit' WHERE `device_id` = '" . $device['device_id'] . "' AND volt_type = '$type' AND `volt_index` = '$index'";
+ $sql = "UPDATE sensors SET `sensor_descr` = '$descr', `sensor_oid` = '$oid', `sensor_precision` = '$precision', `sensor_limit_low` = '$low_limit', `sensor_limit` = '$high_limit' WHERE `sensor_class` = 'voltage' AND `device_id` = '" . $device['device_id'] . "' AND sensor_type = '$type' AND `sensor_index` = '$index'";
$query = mysql_query($sql);
echo("U");
if($debug) { echo("$sql ". mysql_affected_rows() . " updated"); }
diff --git a/includes/functions.php b/includes/functions.php
index 6531fb921..eeb9c9177 100755
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -161,20 +161,6 @@ function format_bi($size, $round = '2')
return round($size, $round).$ext;
}
-function arguments($argv)
-{
- $_ARG = array();
- foreach ($argv as $arg) {
- if (ereg('--([^=]+)=(.*)',$arg,$reg)) {
- $_ARG[$reg[1]] = $reg[2];
- } elseif (ereg('-([a-zA-Z0-9])',$arg,$reg)) {
- $_ARG[$reg[1]] = 'true';
- }
-
- }
- return $_ARG;
-}
-
function percent_colour($perc)
{
$r = min(255, 5 * ($perc - 25));
@@ -182,16 +168,6 @@ function percent_colour($perc)
return sprintf('#%02x%02x%02x', $r, $b, $b);
}
-function print_error($text)
-{
- echo(' '.$text.' | ');
-}
-
-function print_message($text)
-{
- echo(' '.$text.' | ');
-}
-
function interface_errors ($rrd_file, $period = '-1d') // Returns the last in/out errors value in RRD
{
global $config;
@@ -207,17 +183,7 @@ function interface_errors ($rrd_file, $period = '-1d') // Returns the last in/ou
return $errors;
}
-function geteventicon ($message)
-{
- if ($message == "Device status changed to Down") { $icon = "server_connect.png"; }
- if ($message == "Device status changed to Up") { $icon = "server_go.png"; }
- if ($message == "Interface went down" || $message == "Interface changed state to Down" ) { $icon = "if-disconnect.png"; }
- if ($message == "Interface went up" || $message == "Interface changed state to Up" ) { $icon = "if-connect.png"; }
- if ($message == "Interface disabled") { $icon = "if-disable.png"; }
- if ($message == "Interface enabled") { $icon = "if-enable.png"; }
- if (isset($icon)) { return $icon; } else { return false; }
-}
-
+# FIXME: below function is unused, only commented out in html/pages/device/overview/ports.inc.php - do we still need it?
function device_traffic_image($device, $width, $height, $from, $to)
{
return " ";
@@ -233,7 +199,6 @@ function devclass($device)
return $class;
}
-
function getImage($host)
{
global $config;
@@ -300,8 +265,6 @@ function delete_device($id)
mysql_query("DELETE FROM `ports` WHERE `device_id` = '$id'");
mysql_query("DELETE FROM `services` WHERE `device_id` = '$id'");
mysql_query("DELETE FROM `alerts` WHERE `device_id` = '$id'");
- mysql_query("DELETE FROM `voltage` WHERE `device_id` = '$id'");
- mysql_query("DELETE FROM `fanspeed` WHERE `device_id` = '$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'");
@@ -310,33 +273,6 @@ function delete_device($id)
return $ret . "Removed device $host\n";
}
-function retireHost($id)
-{
- global $config;
- $host = mysql_result(mysql_query("SELECT hostname FROM devices WHERE device_id = '$id'"), 0);
- mysql_query("DELETE FROM `devices` WHERE `device_id` = '$id'");
- $int_query = mysql_query("SELECT * FROM `ports` WHERE `device_id` = '$id'");
- while($int_data = mysql_fetch_array($int_query)) {
- $int_if = $int_data['ifDescr'];
- $int_id = $int_data['interface_id'];
- mysql_query("DELETE from `adjacencies` WHERE `interface_id` = '$int_id'");
- mysql_query("DELETE from `links` WHERE `local_interface_id` = '$int_id'");
- mysql_query("DELETE from `links` WHERE `remote_interface_id` = '$int_id'");
- mysql_query("DELETE from `ipaddr` WHERE `interface_id` = '$int_id'");
- mysql_query("DELETE from `ip6adjacencies` WHERE `interface_id` = '$int_id'");
- mysql_query("DELETE from `ip6addr` WHERE `interface_id` = '$int_id'");
- mysql_query("DELETE from `pseudowires` WHERE `interface_id` = '$int_id'");
- echo("Removed interface $int_id ($int_if) ");
- }
- mysql_query("DELETE FROM `entPhysical` WHERE `device_id` = '$id'");
- mysql_query("DELETE FROM `temperature` WHERE `device_id` = '$id'");
- mysql_query("DELETE FROM `storage` WHERE `device_id` = '$id'");
- mysql_query("DELETE FROM `alerts` WHERE `device_id` = '$id'");
- mysql_query("DELETE FROM `services` WHERE `device_id` = '$id'");
- shell_exec("rm -rf ".$config['rrd_dir']."/$host");
- echo("Removed device $host ");
-}
-
function addHost($host, $community, $snmpver, $port = 161)
{
global $config;
@@ -353,10 +289,6 @@ function addHost($host, $community, $snmpver, $port = 161)
} else { echo("Could not resolve $host\n"); }
}
-function overlibprint($text) {
- return "onmouseover=\"return overlib('" . $text . "');\" onmouseout=\"return nd();\"";
-}
-
function scanUDP ($host, $port, $timeout)
{
$handle = fsockopen($host, $port, &$errno, &$errstr, 2);
@@ -374,19 +306,6 @@ function scanUDP ($host, $port, $timeout)
} else { fclose($handle); return 0; }
}
-function humanmedia($media)
-{
- array_preg_replace($rewrite_iftype, $media);
- return $media;
-}
-
-function humanspeed($speed)
-{
- $speed = formatRates($speed);
- if ($speed == "") { $speed = "-"; }
- return $speed;
-}
-
function netmask2cidr($netmask)
{
list ($network, $cidr) = explode("/", trim(`ipcalc $address/$mask | grep Network | cut -d" " -f 4`));
@@ -684,6 +603,7 @@ function get_astext($asn)
}
}
+# DEPRECATED
function eventlog($eventtext,$device_id = "", $interface_id = "")
{
$event_query = "INSERT INTO eventlog (host, interface, datetime, message) VALUES (" . ($device_id ? $device_id : "NULL");
@@ -691,6 +611,7 @@ function eventlog($eventtext,$device_id = "", $interface_id = "")
mysql_query($event_query);
}
+# Use this function to write to the eventlog table
function log_event($text, $device = NULL, $type = NULL, $reference = NULL)
{
global $debug;
@@ -748,14 +669,16 @@ function hex2str($hex)
return $string;
}
+# Convert an SNMP hex string to regular string
function snmp_hexstring($hex)
{
return hex2str(str_replace(' ','',str_replace(' 00','',$hex)));
}
+# Check if the supplied string is an SNMP hex string
function isHexString($str)
{
- return preg_match("/^[a-f0-9][a-f0-9]( [a-f0-9][a-f0-9])*$/is",$str);
+ return preg_match("/^[a-f0-9][a-f0-9]( [a-f0-9][a-f0-9])*$/is",trim($str));
}
?>
diff --git a/includes/polling/voltages.inc.php b/includes/polling/voltages.inc.php
index 5dbdb0310..f80ab6e14 100755
--- a/includes/polling/voltages.inc.php
+++ b/includes/polling/voltages.inc.php
@@ -1,22 +1,19 @@
$voltage['volt_limit_low'] && $volt <= $voltage['volt_limit_low'])
+ if($voltage['sensor_current'] > $voltage['sensor_limit_low'] && $volt <= $voltage['sensor_limit_low'])
{
if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
- $msg = "Voltage Alarm: " . $device['hostname'] . " " . $voltage['volt_descr'] . " is " . $volt . "V (Limit " . $voltage['volt_limit'];
+ $msg = "Voltage Alarm: " . $device['hostname'] . " " . $voltage['sensor_descr'] . " is " . $volt . "V (Limit " . $voltage['sensor_limit'];
$msg .= "V) at " . date($config['timestamp_format']);
- mail($email, "Voltage Alarm: " . $device['hostname'] . " " . $voltage['volt_descr'], $msg, $config['email_headers']);
- echo("Alerting for " . $device['hostname'] . " " . $voltage['volt_descr'] . "\n");
- log_event('Voltage ' . $voltage['volt_descr'] . " under threshold: " . $volt . " V (< " . $voltage['volt_limit_low'] . " V)", $device['device_id'], 'voltage', $voltage['volt_id']);
+ mail($email, "Voltage Alarm: " . $device['hostname'] . " " . $voltage['sensor_descr'], $msg, $config['email_headers']);
+ echo("Alerting for " . $device['hostname'] . " " . $voltage['sensor_descr'] . "\n");
+ log_event('Voltage ' . $voltage['sensor_descr'] . " under threshold: " . $volt . " V (< " . $voltage['sensor_limit_low'] . " V)", $device['device_id'], 'voltage', $voltage['sensor_id']);
}
- else if($voltage['volt_current'] < $voltage['volt_limit'] && $volt >= $voltage['volt_limit'])
+ else if($voltage['sensor_current'] < $voltage['sensor_limit'] && $volt >= $voltage['sensor_limit'])
{
if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
- $msg = "Voltage Alarm: " . $device['hostname'] . " " . $voltage['volt_descr'] . " is " . $volt . "V (Limit " . $voltage['volt_limit'];
+ $msg = "Voltage Alarm: " . $device['hostname'] . " " . $voltage['sensor_descr'] . " is " . $volt . "V (Limit " . $voltage['sensor_limit'];
$msg .= "V) at " . date($config['timestamp_format']);
- mail($email, "Voltage Alarm: " . $device['hostname'] . " " . $voltage['volt_descr'], $msg, $config['email_headers']);
- echo("Alerting for " . $device['hostname'] . " " . $voltage['volt_descr'] . "\n");
- log_event('Voltage ' . $voltage['volt_descr'] . " above threshold: " . $volt . " V (> " . $voltage['volt_limit'] . " V)", $device['device_id'], 'voltage', $voltage['volt_id']);
+ mail($email, "Voltage Alarm: " . $device['hostname'] . " " . $voltage['sensor_descr'], $msg, $config['email_headers']);
+ echo("Alerting for " . $device['hostname'] . " " . $voltage['sensor_descr'] . "\n");
+ log_event('Voltage ' . $voltage['sensor_descr'] . " above threshold: " . $volt . " V (> " . $voltage['sensor_limit'] . " V)", $device['device_id'], 'voltage', $voltage['sensor_id']);
}
- mysql_query("UPDATE voltage SET volt_current = '$volt' WHERE volt_id = '" . $voltage['volt_id'] . "'");
+ mysql_query("UPDATE sensor SET volt_current = '$volt' WHERE sensor_class='voltage' AND volt_id = '" . $voltage['sensor_id'] . "'");
}
?>
| |