Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When reindexing hosts from command line, ensure only one process runs at once #5457

Merged
merged 3 commits into from
Aug 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Cacti CHANGELOG
-issue#5452: The default 'bulk_walk_size' is -1 which means a device will never find it's optimal bulk walk size
-issue#5453: Templates without copyright, cleaning SNMP printer package
-issue#5454: Cacti Orphan Graphs Selector missing column 'orphan' in SQL selector
-issue#5457: Enable 'Re-Index All Device Schedule' causes a lot of reindex processes
-feature#5375: Add template for Fortinet firewall and Aruba Instant cluster
-feature#5393: Add template for SNMP printer
-feature#5418: Display device class before package import
Expand Down
14 changes: 14 additions & 0 deletions cli/poller_reindex_hosts.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,17 @@
print 'WARNING: Do not interrupt this script. Reindexing can take quite some time' . PHP_EOL;
debug("There are '" . cacti_sizeof($data_queries) . "' data queries to run");


/* silently end if the registered process is still running */
if (!$force) {
if (!register_process_start('reindex', 'master', 0, 86400)) {
print "FATAL: Detected an already running process. Use --force to override" . PHP_EOL;
exit(0);
}
}



$i = 1;
$total_start = microtime(true);
if (cacti_sizeof($data_queries)) {
Expand Down Expand Up @@ -195,6 +206,9 @@

$i++;
}

unregister_process('reindex', 'master');

}

function display_version() {
Expand Down