Skip to content

Commit

Permalink
Fixing #5754 and #5759 - Installer Issues
Browse files Browse the repository at this point in the history
-issue#5754: Installer replication loop for. Plugin realms
-issue#5759: Remote poller attempts to sync with other pollers during install
  • Loading branch information
TheWitness committed Jun 30, 2024
1 parent 8111f64 commit 8788d8a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Cacti CHANGELOG

1.2.28
-issue#5754: Installer replication loop for. Plugin realms
-issue#5759: Remote poller attempts to sync with other pollers during install
-issue#5768: Cacti does not properly escape Data Query indexes that include a space
-issue#5772: Login log message unification - add client IP address
-issue#5773: Update rrd.php missing variable $okpos
Expand Down
24 changes: 23 additions & 1 deletion install/background.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,32 @@
global $cli_install;

$cli_install = true;
$now = time();

if (cacti_sizeof($params) == 0) {
log_install_always('','no parameters passed' . PHP_EOL);
exit();
exit(0);
}

if (function_exists('register_process_start')) {
if (!register_process_start('install', 'master', '0', 600)) {
exit(0);
}
} else {
$running = read_config_option('installer_running', true);

if ($running != '' && $now - $running < 600) {
exit(0);
}

set_config_option('installer_running', $now);
}

Installer::beginInstall($params[0]);

if (function_exists('register_process_start')) {
unregister_process('install', 'master', 0);
} else {
set_config_option('installer_running', '');
}

5 changes: 4 additions & 1 deletion install/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ function install_full_sync() {
$skipped = array();
$timeout = array();

$pollers = db_fetch_assoc('SELECT id, status, UNIX_TIMESTAMP() - UNIX_TIMESTAMP(last_update) as gap
$pollers = db_fetch_assoc('SELECT id, status, UNIX_TIMESTAMP() - UNIX_TIMESTAMP(last_update) AS gap
FROM poller
WHERE id > 1
AND disabled = ""');
Expand All @@ -1135,6 +1135,8 @@ function install_full_sync() {
log_install_debug('sync', 'Poller ' . $poller['id'] . ' has a status of ' . $poller['status'] . ' with gap ' . $poller['gap']);
if (($poller['status'] == POLLER_STATUS_NEW) ||
($poller['status'] == POLLER_STATUS_DOWN) ||
($poller['status'] == POLLER_STATUS_HEARTBEAT) ||
($poller['status'] == POLLER_STATUS_RECOVERING) ||
($poller['status'] == POLLER_STATUS_DISABLED)) {
$skipped[] = $poller['id'];
} elseif ($poller['gap'] < $gap_time) {
Expand All @@ -1156,6 +1158,7 @@ function install_full_sync() {
}
}
}

log_install_debug('sync', 'Success: ' . cacti_sizeof($success) . ', Failed: ' . cacti_sizeof($failed) . ', Skipped: ' . cacti_sizeof($skipped) . ', Total: ' . cacti_sizeof($pollers));

return array(
Expand Down
8 changes: 4 additions & 4 deletions lib/installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3616,10 +3616,10 @@ private static function fullSyncDataCollectors() {
if ($status['total'] == 0) {
log_install_always('sync', __('No Remote Data Collectors found for full synchronization'));
} else {
Installer::fullSyncDataCollectorLog($status['timeout'], 'Remote Data Collector with name \'%s\' and id %d previous timed out. Please manually Sync when once online to complete upgrade.');
Installer::fullSyncDataCollectorLog($status['skipped'], 'Remote Data Collector with name \'%s\' and id %d is not available to sync. Please manually Sync when once online to complete upgrade.');
Installer::fullSyncDataCollectorLog($status['failed'], 'Remote Data Collector with name \'%s\' and id %d failed Full Sync. Please manually Sync when once online to complete upgrade.');
Installer::fullSyncDataCollectorLog($status['success'], 'Remote Data Collector with name \'%s\' and id %d completed Full Sync.');
Installer::fullSyncDataCollectorLog($status['timeout'], "Remote Data Collector with name '%s' and id %d previous timed out. Please manually Sync when once online to complete upgrade.");
Installer::fullSyncDataCollectorLog($status['skipped'], "Remote Data Collector with name '%s' and id %d is not available to sync. Please manually Sync when once online to complete upgrade.");
Installer::fullSyncDataCollectorLog($status['failed'], "Remote Data Collector with name '%s' and id %d failed Full Sync. Please manually Sync when once online to complete upgrade.");
Installer::fullSyncDataCollectorLog($status['success'], "Remote Data Collector with name '%s' and id %d completed Full Sync.");
}
}

Expand Down

0 comments on commit 8788d8a

Please sign in to comment.