diff options
author | Tom <tom@ritter.vg> | 2016-12-28 13:59:43 -0600 |
---|---|---|
committer | Tom Ritter <tom@ritter.vg> | 2016-12-28 14:37:55 -0600 |
commit | 3e85f1d0d48f0fb65a83af6ce3fb4b6a08f0bb1a (patch) | |
tree | 43367c6c5c98bf31759e576bcf43efabd4772e57 /jobs/TLSCertExpiration.py | |
parent | 50111ca74eaa5b14253814a9aa39e35b40480935 (diff) |
Create an option that lets you require two failures before alerting.
Diffstat (limited to 'jobs/TLSCertExpiration.py')
-rwxr-xr-x | jobs/TLSCertExpiration.py | 9 |
1 files changed, 6 insertions, 3 deletions
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]) |