From 3e85f1d0d48f0fb65a83af6ce3fb4b6a08f0bb1a Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 28 Dec 2016 13:59:43 -0600 Subject: Create an option that lets you require two failures before alerting. --- jobs/TLSCertExpiration.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'jobs/TLSCertExpiration.py') diff --git a/jobs/TLSCertExpiration.py b/jobs/TLSCertExpiration.py index 873a53e..d5cfa48 100755 --- a/jobs/TLSCertExpiration.py +++ b/jobs/TLSCertExpiration.py @@ -16,12 +16,13 @@ class TLSCertExpiration(JobSpawner.JobSpawner): ] class CertChecker(JobBase.JobBase): - def __init__(self, config, url, frequency, failureNotificationFrequency): + def __init__(self, config, url, frequency, failureNotificationFrequency, failuresBeforeNotification): self.config = config self.url = url self.frequency = frequency self.failureNotificationFrequency = failureNotificationFrequency - super(TLSCertExpiration.CertChecker, self).__init__(config, url, frequency, failureNotificationFrequency) + self.failuresBeforeNotification = failuresBeforeNotification + super(TLSCertExpiration.CertChecker, self).__init__(config, url, frequency, failureNotificationFrequency, failuresBeforeNotification) def getName(self): return str(self.__class__) + " for " + self.url @@ -29,6 +30,8 @@ class TLSCertExpiration(JobSpawner.JobSpawner): return self.frequency def notifyOnFailureEvery(self): return self.failureNotificationFrequency + def numberFailuresBeforeNotification(self): + return self.failuresBeforeNotification def execute(self): try: context = ssl._create_unverified_context() @@ -54,5 +57,5 @@ class TLSCertExpiration(JobSpawner.JobSpawner): def get_sub_jobs(self, config): for s in self.servers: - yield self.CertChecker(config, s[0], s[1], s[2]) + yield self.CertChecker(config, s[0], s[1], s[2], s[3]) -- cgit v1.2.3