Take per section maximum_backup_age in account
This commit is contained in:
		
							parent
							
								
									076c07ff24
								
							
						
					
					
						commit
						1190eb4d9d
					
				@ -716,7 +716,7 @@ class backup_generic:
 | 
			
		||||
            raise
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    def checknagios(self,maxage_hours=30):
 | 
			
		||||
    def checknagios(self):
 | 
			
		||||
        """
 | 
			
		||||
        Returns a tuple (nagiosstatus,message) for the current backup_name
 | 
			
		||||
        Read status from dbstat database
 | 
			
		||||
@ -731,7 +731,7 @@ class backup_generic:
 | 
			
		||||
                self.logger.debug('[%s] checknagios : no result from query',self.backup_name)
 | 
			
		||||
                return (nagiosStateCritical,'CRITICAL : No backup found for %s in database' % self.backup_name)
 | 
			
		||||
            else:
 | 
			
		||||
                mindate = datetime2isodate((datetime.datetime.now() - datetime.timedelta(hours=maxage_hours)))
 | 
			
		||||
                mindate = datetime2isodate((datetime.datetime.now() - datetime.timedelta(hours=self.maximum_backup_age)))
 | 
			
		||||
                self.logger.debug('[%s] checknagios : looking for most recent OK not older than %s',self.backup_name,mindate)
 | 
			
		||||
                for b in q:
 | 
			
		||||
                    if b['backup_end'] >= mindate and b['status'] == 'OK':
 | 
			
		||||
 | 
			
		||||
@ -115,7 +115,7 @@ class tis_backup:
 | 
			
		||||
        # TODO limit backup to one backup on the command line
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    def checknagios(self,sections=[],maxage_hours=None):
 | 
			
		||||
    def checknagios(self,sections=[]):
 | 
			
		||||
        try:
 | 
			
		||||
            if not sections:
 | 
			
		||||
                sections = [backup_item.backup_name for backup_item in self.backup_list]
 | 
			
		||||
@ -133,7 +133,7 @@ class tis_backup:
 | 
			
		||||
                        assert(isinstance(backup_item,backup_generic))
 | 
			
		||||
                        if not maxage_hours:
 | 
			
		||||
                            maxage_hours = backup_item.maximum_backup_age
 | 
			
		||||
                        (nagiosstatus,log) = backup_item.checknagios(maxage_hours=maxage_hours)
 | 
			
		||||
                        (nagiosstatus,log) = backup_item.checknagios()
 | 
			
		||||
                        if nagiosstatus == nagiosStateCritical:
 | 
			
		||||
                            critical.append((backup_item.backup_name,log))
 | 
			
		||||
                        elif nagiosstatus == nagiosStateWarning :
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user