mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 08:02:41 +02:00
more mge fixes, cleanups, and addition of frequency monitoring (no webinterface part yet)
git-svn-id: http://www.observium.org/svn/observer/trunk@1095 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -240,6 +240,42 @@ function discover_volt($device, $oid, $index, $type, $descr, $precision = 1, $lo
|
||||
return $return;
|
||||
}
|
||||
|
||||
function discover_freq($device, $oid, $index, $type, $descr, $precision = 1, $low_limit = NULL, $high_limit = NULL, $current = NULL)
|
||||
{
|
||||
global $config, $debug;
|
||||
|
||||
if($debug) { echo("$oid, $index, $type, $descr, $precision\n"); }
|
||||
if(!$low_limit)
|
||||
{
|
||||
$low_limit = $config['limit']['freq'];
|
||||
}
|
||||
|
||||
if (mysql_result(mysql_query("SELECT count(freq_id) FROM `frequency` WHERE device_id = '".$device['device_id']."' AND freq_type = '$type' AND `freq_index` = '$index'"),0) == '0')
|
||||
{
|
||||
$query = "INSERT INTO frequency (`device_id`, `freq_oid`, `freq_index`, `freq_type`, `freq_descr`, `freq_precision`, `freq_limit`, `freq_limit_low`, `freq_current`) ";
|
||||
$query .= " VALUES ('".$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("+");
|
||||
}
|
||||
else
|
||||
{
|
||||
$freq_entry = mysql_fetch_array(mysql_query("SELECT * FROM `frequency` WHERE device_id = '".$device['device_id']."' AND freq_type = '$type' AND `freq_index` = '$index'"));
|
||||
if($oid == $freq_entry['freq_oid'] && $descr == $freq_entry['freq_descr'] && $precision == $freq_entry['freq_precision'])
|
||||
{
|
||||
echo(".");
|
||||
}
|
||||
else
|
||||
{
|
||||
mysql_query("UPDATE frequency SET `freq_descr` = '$descr', `freq_oid` = '$oid', `freq_precision` = '$precision' WHERE `device_id` = '" . $device['device_id'] . "' AND freq_type = '$type' AND `freq_index` = '$index' ");
|
||||
echo("U");
|
||||
if($debug) { echo("$query ". mysql_affected_rows() . " updated"); }
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
function discover_toner($device, $oid, $index, $type, $descr, $capacity = NULL, $current = NULL)
|
||||
{
|
||||
global $config, $debug;
|
||||
|
||||
@@ -85,7 +85,7 @@ if ($device['os'] == "mgeups")
|
||||
list($unused,$numPhase) = explode(' ',$oids);
|
||||
for($i = 1; $i <= $numPhase;$i++)
|
||||
{
|
||||
$volt_oid = ".1.3.6.1.4.1.705.1.7.2.$i.2.1.0";
|
||||
$volt_oid = ".1.3.6.1.4.1.705.1.7.2.1.2.$i.0";
|
||||
$descr = "Output"; if ($numPhase > 1) $descr .= " Phase $i";
|
||||
$current = snmp_get($device, $volt_oid, "-Oqv") / 10;
|
||||
$type = "mge-ups";
|
||||
@@ -110,7 +110,7 @@ if ($device['os'] == "mgeups")
|
||||
list($unused,$numPhase) = explode(' ',$oids);
|
||||
for($i = 1; $i <= $numPhase;$i++)
|
||||
{
|
||||
$volt_oid = ".1.3.6.1.4.1.705.1.6.2.$i.2.1.0";
|
||||
$volt_oid = ".1.3.6.1.4.1.705.1.6.2.1.2.$i.0";
|
||||
$descr = "Input"; if ($numPhase > 1) $descr .= " Phase $i";
|
||||
$current = snmp_get($device, $volt_oid, "-Oqv") / 10;
|
||||
$type = "mge-ups";
|
||||
|
||||
Reference in New Issue
Block a user