Skip to content

Commit

Permalink
Fixing #5710 - Heartbeat Notifications
Browse files Browse the repository at this point in the history
Notify the admin periodically when a remote data collector goes into heartbeat status
  • Loading branch information
TheWitness committed Apr 14, 2024
1 parent 29810d3 commit d36c062
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Expand Up @@ -24,6 +24,7 @@ Cacti CHANGELOG
-issue#5726: Poller cache is not updating when changing hostname
-issue#5727: Incorrect values status_fail_date and status_rec_date with cmd poller
-feature#5692: Add a "device enabled/disabled" indicator next to the graphs
-feature#5710: Notify the admin periodically when a remote data collector goes into heartbeat status
-feature#5716: Add Aruba Clearpass template

1.2.26
Expand Down
16 changes: 16 additions & 0 deletions poller.php
Expand Up @@ -901,6 +901,21 @@ function sig_handler($signo) {
}
}

function poller_heartbeat_check() {
$heartbeat_pollers = db_fetch_assoc('SELECT * FROM poller WHERE status=6 AND disabled = ""');

if (cacti_sizeof($heartbeat_pollers)) {
foreach($heartbeat_pollers as $p) {
if (debounce_run_notification('poller_heartbeat_' . $p['id'], 1800)) {
$log_message = sprintf('WARNING: PollerID:%s with Name:%s is in Heartbeat Status', $p['id'], $p['name']);
$email_message = __('WARNING: PollerID:%s with Name:%s is in Heartbeat Status', $p['id'], $p['name']);
cacti_log($log_message, false, 'POLLER');
admin_email(__('Poller in Heartbeat Mode'), $email_message);
}
}
}
}

/* start post data processing */
if ($poller_id == 1) {
multiple_poller_boost_check();
Expand All @@ -917,6 +932,7 @@ function sig_handler($signo) {
api_plugin_hook('poller_bottom');
bad_index_check($mibs);
host_status_cache_check();
poller_heartbeat_check();
} else {
// flush the boost table if in recovery mode
if ($poller_id > 1 && $config['connection'] == 'recovery') {
Expand Down

0 comments on commit d36c062

Please sign in to comment.