mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	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:
		| @@ -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(); | ||||||
|   | |||||||
| @@ -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> | ||||||
|   | |||||||
| @@ -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 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user