Skip to content

Commit

Permalink
Last run date for reindex, cleaner, ... (#5478)
Browse files Browse the repository at this point in the history
* add last_run date for reindex, rrdcleaner, ...

* change to timestamp
  • Loading branch information
xmacan committed Sep 6, 2023
1 parent 3bda123 commit 937c129
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions cli/poller_reindex_hosts.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
$i++;
}

set_config_option('reindex_last_run_time', time());
unregister_process('reindex', 'master');

}
Expand Down
1 change: 1 addition & 0 deletions poller_maintenance.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ function rrdfile_purge($force) {

/* record the start time */
$poller_end = microtime(true);
set_config_option('rrdcleaner_last_run_time', time());
$string = sprintf('RRDMAINT STATS: Time:%4.4f Purged:%s Archived:%s', ($poller_end - $poller_start), $purged, $archived);
cacti_log($string, true, 'SYSTEM');
}
Expand Down
5 changes: 3 additions & 2 deletions poller_rrdcheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@

rrdcheck_debug('Polling Ending');

set_config_option('rrdchecker_last_run_time', time());

if (!$forcerun) {
unregister_process('rrdcheck', $type, $thread_id);
}
Expand Down Expand Up @@ -202,12 +204,11 @@ function rrdcheck_master_handler($forcerun) {
// determine if it's time to determine hourly averages
if (empty($last_run)) {
// since the poller has never run before, let's fake it out
set_config_option('rrdcheck_last_run_time', date('Y-m-d G:i:s', $current_time));
set_config_option('rrdcheck_last_run_time', date($current_time));
}

// if it's time to check, do so now
if ((!empty($last_run) && ((strtotime($last_run) + ($run_interval * 60)) < $current_time)) || $forcerun) {
set_config_option('rrdcheck_last_run_time', date('Y-m-d G:i:s', $current_time));

rrdcheck_launch_children($type);

Expand Down

0 comments on commit 937c129

Please sign in to comment.