Hopefully fix alert logic when status becomes good
No need to send alert for good status, if previous status never actually triggered an alert.
This commit is contained in:
		
							parent
							
								
									de1543018a
								
							
						
					
					
						commit
						e6f3448acc
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -116,13 +116,14 @@ class TempmonServerDaemon(Daemon):
 | 
			
		|||
        }
 | 
			
		||||
 | 
			
		||||
        prev_status = probe.status
 | 
			
		||||
        prev_alert_sent = probe.status_alert_sent
 | 
			
		||||
        if probe.status != status:
 | 
			
		||||
            probe.status = status
 | 
			
		||||
            probe.status_changed = self.now
 | 
			
		||||
            probe.status_alert_sent = None
 | 
			
		||||
 | 
			
		||||
            # send email when things go back to normal, after being bad
 | 
			
		||||
            if status == self.enum.TEMPMON_PROBE_STATUS_GOOD_TEMP:
 | 
			
		||||
            if status == self.enum.TEMPMON_PROBE_STATUS_GOOD_TEMP and prev_alert_sent:
 | 
			
		||||
                send_email(self.config, 'tempmon_good_temp', data)
 | 
			
		||||
                probe.status_alert_sent = self.now
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue