Skip to content

Commit

Permalink
Add two hooks for Issue #240
Browse files Browse the repository at this point in the history
This will allow a plugin to be created to control what happens as a part of a device down/recovering event in addition to the existing 'thold_action' hook for threshold breach, trigger, and restoral events.
  • Loading branch information
TheWitness committed Feb 27, 2019
1 parent 52d5089 commit 0f56891
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions includes/polling.php
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,15 @@ function thold_update_host_status() {
break;
}

api_plugin_hook_function(
'thold_device_recovering',
array(
'device' => $host,
'subject' => $subject,
'message' => $msg
)
);

if ($alert_email == '' && $host['thold_send_email'] > 0) {
cacti_log('Host[' . $host['id'] . '] Hostname[' . $host['hostname'] . '] WARNING: Can not send a Device recovering email for \'' . $host['description'] . '\' since the \'Alert Email\' setting is not set for Device!', true, 'THOLD');
} elseif ($host['thold_send_email'] == '0') {
Expand Down Expand Up @@ -758,6 +767,15 @@ function thold_update_host_status() {
break;
}

api_plugin_hook_function(
'thold_device_down',
array(
'device' => $host,
'subject' => $subject,
'message' => $msg
)
);

if ($alert_email == '' && $host['thold_send_email'] > 0) {
cacti_log('Host[' . $host['id'] . '] Hostname[' . $host['hostname'] . '] WARNING: Can not send a Device down email for \'' . $host['description'] . '\' since the \'Alert Email\' setting is not set for Device!', true, 'THOLD');
} elseif ($host['thold_send_email'] == '0') {
Expand Down

0 comments on commit 0f56891

Please sign in to comment.