mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
Rename option to extended_port_metrics
This commit is contained in:
@@ -77,7 +77,7 @@ $config['memcached']['host'] = 'localhost';
|
||||
$config['memcached']['port'] = 11211;
|
||||
$config['memcached']['ttl'] = 240;
|
||||
|
||||
$config['enable_extended_port_metrics'] = false;
|
||||
$config['extended_port_metrics'] = false;
|
||||
$config['slow_statistics'] = true;
|
||||
// THIS WILL CHANGE TO FALSE IN FUTURE
|
||||
// RRD Format Settings
|
||||
|
||||
@@ -216,7 +216,7 @@ d_echo($port_stats);
|
||||
// FIXME -- this stuff is a little messy, looping the array to make an array just seems wrong. :>
|
||||
// -- i can make it a function, so that you don't know what it's doing.
|
||||
// -- $ports = adamasMagicFunction($ports_db); ?
|
||||
if ($config['enable_extended_port_metrics']) {
|
||||
if ($config['extended_port_metrics']) {
|
||||
// select * doesn't do what we want if multiple tables have the same column name -- last one wins :/
|
||||
$ports_db = dbFetchRows('SELECT *, `ports_statistics`.`port_id` AS `ports_statistics_port_id`, `ports`.`port_id` AS `port_id` FROM `ports` LEFT OUTER JOIN `ports_statistics` ON `ports`.`port_id` = `ports_statistics`.`port_id` WHERE `ports`.`device_id` = ?', array($device['device_id']));
|
||||
}
|
||||
@@ -234,7 +234,7 @@ foreach ($port_stats as $ifIndex => $port) {
|
||||
echo 'valid';
|
||||
if (!is_array($ports[$port['ifIndex']])) {
|
||||
$port_id = dbInsert(array('device_id' => $device['device_id'], 'ifIndex' => $ifIndex), 'ports');
|
||||
if ($config['enable_extended_port_metrics']) {
|
||||
if ($config['extended_port_metrics']) {
|
||||
dbInsert(array('port_id' => $port_id), 'ports_statistics');
|
||||
}
|
||||
$ports[$port['ifIndex']] = dbFetchRow('SELECT * FROM `ports` WHERE `port_id` = ?', array($port_id));
|
||||
@@ -245,7 +245,7 @@ foreach ($port_stats as $ifIndex => $port) {
|
||||
dbUpdate(array('deleted' => '0'), 'ports', '`port_id` = ?', array($ports[$ifIndex]['port_id']));
|
||||
$ports[$ifIndex]['deleted'] = '0';
|
||||
}
|
||||
if ($config['enable_extended_port_metrics'] &&
|
||||
if ($config['extended_port_metrics'] &&
|
||||
$ports[$ifIndex]['ports_statistics_port_id'] === null) {
|
||||
// in case someone enabled the option after the port was already created
|
||||
dbInsert(array('port_id' => $ports[$ifIndex]['port_id']), 'ports_statistics');
|
||||
@@ -431,12 +431,12 @@ foreach ($ports as $port) {
|
||||
// End parse ifAlias
|
||||
// Update IF-MIB metrics
|
||||
$_stat_oids = $stat_oids_db;
|
||||
if ($config['enable_extended_port_metrics']) {
|
||||
if ($config['extended_port_metrics']) {
|
||||
$_stat_oids = $_stat_oids + $stat_oids_db_extended;
|
||||
}
|
||||
foreach ($_stat_oids as $oid) {
|
||||
$port_update = 'update';
|
||||
if ($config['enable_extended_port_metrics']) {
|
||||
if ($config['extended_port_metrics']) {
|
||||
$extended_metric = !in_array($oid, $stat_oids_db, true);
|
||||
if ($extended_metric) {
|
||||
$port_update = 'update_extended';
|
||||
@@ -587,7 +587,7 @@ foreach ($ports as $port) {
|
||||
// Update Database
|
||||
if (count($port['update'])) {
|
||||
$updated = dbUpdate($port['update'], 'ports', '`port_id` = ?', array($port['port_id']));
|
||||
if ($config['enable_extended_port_metrics'] and count($port['update_extended'])) {
|
||||
if ($config['extended_port_metrics'] and count($port['update_extended'])) {
|
||||
// do we want to do something else with this?
|
||||
$updated += dbUpdate($port['update_extended'], 'ports_statistics', '`port_id` = ?', array($port['port_id']));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user