Allow a user-defined window to add tolerance to delay-values

This is to counter cronjob irregularities as they arent always executed on *:00 dead
This commit is contained in:
f0o
2015-05-17 12:13:52 +00:00
parent 83a3335c6d
commit 6624c17534
3 changed files with 4 additions and 3 deletions

View File

@@ -191,7 +191,7 @@ function RunAlerts() {
$noiss = true; $noiss = true;
} }
if( !empty($rextra['delay']) ) { if( !empty($rextra['delay']) ) {
if( (time()-strtotime($alert['time_logged'])) < $rextra['delay'] || (!empty($alert['details']['delay']) && (time()-$alert['details']['delay']) < $rextra['delay']) ) { if( (time()-strtotime($alert['time_logged'])+$config['alert']['tolerance-window']) < $rextra['delay'] || (!empty($alert['details']['delay']) && (time()-$alert['details']['delay']+$config['alert']['tolerance-window']) < $rextra['delay']) ) {
continue; continue;
} else { } else {
$alert['details']['delay'] = time(); $alert['details']['delay'] = time();

View File

@@ -152,8 +152,8 @@ $config['email_smtp_auth'] = FALSE; // Whether or
$config['email_smtp_username'] = NULL; // SMTP username. $config['email_smtp_username'] = NULL; // SMTP username.
$config['email_smtp_password'] = NULL; // Password for SMTP authentication. $config['email_smtp_password'] = NULL; // Password for SMTP authentication.
$config['alerts']['email']['default_only'] = FALSE; // Only send alerts to default-contact $config['alert']['default_only'] = false; //Only issue to default_mail
$config['alerts']['email']['default'] = NULL; // Default-Contact $config['alert']['default_mail'] = ''; //Default email
``` ```
## <a name="transports-api">API</a> ## <a name="transports-api">API</a>

View File

@@ -237,6 +237,7 @@ $config['alert'] = array(
'admins' => false, //Issue to administrators 'admins' => false, //Issue to administrators
'default_only' => false, //Only issue to default 'default_only' => false, //Only issue to default
'default_mail' => '', //Default email 'default_mail' => '', //Default email
'tolerance-window' => 10, //Allow +/-10s tolerance to delay values to counter cron-irregularities
); );
//Legacy options //Legacy options