diff --git a/database-update.sql b/database-update.sql index 5f9b048949..8424e9b63d 100644 --- a/database-update.sql +++ b/database-update.sql @@ -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; diff --git a/discovery.php b/discovery.php index 223593d03c..cf526a9371 100755 --- a/discovery.php +++ b/discovery.php @@ -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"); diff --git a/html/pages/device.php b/html/pages/device.php index 093100f7b3..3dc67316f3 100644 --- a/html/pages/device.php +++ b/html/pages/device.php @@ -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('
  • diff --git a/html/pages/device/graphs/os-mgeups.inc.php b/html/pages/device/graphs/os-mgeups.inc.php index c07e7943b8..deafeb7481 100644 --- a/html/pages/device/graphs/os-mgeups.inc.php +++ b/html/pages/device/graphs/os-mgeups.inc.php @@ -1,4 +1,4 @@ diff --git a/html/pages/device/graphs/os-papouch-tme.inc.php b/html/pages/device/graphs/os-papouch-tme.inc.php index c07e7943b8..deafeb7481 100644 --- a/html/pages/device/graphs/os-papouch-tme.inc.php +++ b/html/pages/device/graphs/os-papouch-tme.inc.php @@ -1,4 +1,4 @@ diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index 3e4f428f54..90919b0827 100644 --- a/includes/discovery/functions.inc.php +++ b/includes/discovery/functions.inc.php @@ -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; diff --git a/includes/discovery/voltages.inc.php b/includes/discovery/voltages.inc.php index 5ce7f51450..56fc882f82 100755 --- a/includes/discovery/voltages.inc.php +++ b/includes/discovery/voltages.inc.php @@ -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"; diff --git a/poll-device.php b/poll-device.php index 49253c754d..bb2c001a3c 100755 --- a/poll-device.php +++ b/poll-device.php @@ -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");