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:
Tom Laermans
2010-06-03 10:23:11 +00:00
parent 94cfe9d618
commit 647bf59d1c
8 changed files with 49 additions and 9 deletions

View File

@@ -6,4 +6,4 @@ DROP TABLE `cpmCPU`;
DROP TABLE `cmpMemPool`;
ALTER TABLE `mempools` CHANGE `mempool_used` `mempool_used` BIGINT( 16 ) NOT NULL ,CHANGE `mempool_free` `mempool_free` BIGINT( 16 ) NOT NULL ,CHANGE `mempool_total` `mempool_total` BIGINT( 16 ) NOT NULL ,CHANGE `mempool_largestfree` `mempool_largestfree` BIGINT( 16 ) NULL DEFAULT NULL ,CHANGE `mempool_lowestfree` `mempool_lowestfree` BIGINT( 16 ) NULL DEFAULT NULL ;
ALTER TABLE `ports` ADD `port_descr_type` VARCHAR( 32 ) NULL DEFAULT NULL AFTER `device_id` ,ADD `port_descr_descr` VARCHAR( 64 ) NULL DEFAULT NULL AFTER `port_descr_type` ,ADD `port_descr_circuit` VARCHAR( 64 ) NULL DEFAULT NULL AFTER `port_descr_descr` ,ADD `port_descr_speed` VARCHAR( 32 ) NULL DEFAULT NULL AFTER `port_descr_circuit` ,ADD `port_descr_notes` VARCHAR( 128 ) NULL DEFAULT NULL AFTER `port_descr_speed`;
CREATE TABLE `frequency` ( `freq_id` int(11) NOT NULL auto_increment, `device_id` int(11) NOT NULL default '0', `freq_oid` varchar(64) NOT NULL, `freq_index` varchar(8) NOT NULL, `freq_type` varchar(32) NOT NULL, `freq_descr` varchar(32) NOT NULL default '', `freq_precision` int(11) NOT NULL default '1', `freq_current` float default NULL, `freq_limit` float default NULL, `freq_limit_low` float default NULL, PRIMARY KEY (`freq_id`), KEY `freq_host` (`device_id`)) ENGINE=MyISAM AUTO_INCREMENT=189 DEFAULT CHARSET=latin1;

View File

@@ -99,6 +99,7 @@ while ($device = mysql_fetch_array($device_query))
include("includes/discovery/ipv6-addresses.inc.php");
include("includes/discovery/temperatures.inc.php");
include("includes/discovery/voltages.inc.php");
include("includes/discovery/frequencies.inc.php");
include("includes/discovery/fanspeeds.inc.php");
include("includes/discovery/storage.inc.php");
include("includes/discovery/hr-device.inc.php");

View File

@@ -43,7 +43,9 @@ $health = mysql_result(mysql_query("select count(*) from storage WHERE device_i
mysql_result(mysql_query("select count(temp_id) from temperature WHERE device_id = '" . $device['device_id'] . "'"), 0) +
mysql_result(mysql_query("select count(*) from cempMemPool WHERE device_id = '" . $device['device_id'] . "'"), 0) +
mysql_result(mysql_query("select count(*) from cpmCPU WHERE device_id = '" . $device['device_id'] . "'"), 0) +
mysql_result(mysql_query("select count(*) from processors WHERE device_id = '" . $device['device_id'] . "'"), 0);
mysql_result(mysql_query("select count(*) from processors WHERE device_id = '" . $device['device_id'] . "'"), 0) +
mysql_result(mysql_query("select count(volt_id) from voltage WHERE device_id = '" . $device['device_id'] . "'"), 0) +
mysql_result(mysql_query("select count(fan_id) from fanspeed WHERE device_id = '" . $device['device_id'] . "'"), 0);
if($health) {
echo('<li class="' . $select['health'] . '">

View File

@@ -1,4 +1,4 @@
<?php
$graph_title = "Device Uptime";
$graph_type = "device_uptime"; include ("includes/print-device-graph.php"); break;
include("uptime.inc.php");
?>

View File

@@ -1,4 +1,4 @@
<?php
$graph_title = "Device Uptime";
$graph_type = "device_uptime"; include ("includes/print-device-graph.php"); break;
include("uptime.inc.php");
?>

View File

@@ -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;

View File

@@ -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";

View File

@@ -45,7 +45,7 @@ while ($device = mysql_fetch_array($device_query)) {
$status = 0; unset($array);
$device_start = utime(); // Start counting device poll time
echo($device['hostname'] . " ".$device['device_id']." ".$device['os']." ");
if ($os_groups[$device[os]]) {$device['os_group'] = $os_groups[$device[os]]; echo "(".$device['os_group'].")";}
if ($os_groups[$device['os']]) {$device['os_group'] = $os_groups[$device['os']]; echo "(".$device['os_group'].")";}
echo("\n");
unset($poll_update); unset($poll_update_query); unset($poll_separator); unset($version); unset($uptime); unset($features);
@@ -160,6 +160,7 @@ while ($device = mysql_fetch_array($device_query)) {
include("includes/polling/temperatures.inc.php");
include("includes/polling/fanspeeds.inc.php");
include("includes/polling/voltages.inc.php");
include("includes/polling/frequencies.inc.php");
include("includes/polling/processors.inc.php");
include("includes/polling/mempools.inc.php");
include("includes/polling/storage.inc.php");