Commit bd156357 authored by glucas's avatar glucas

Adding new check: CheckTLSCert{4,6} for testing x509 certificate's expiration over TLS connection.

parent acf7b96d
......@@ -308,3 +308,29 @@ class CheckJabber4(CheckJabber, Check4):
class CheckJabber6(CheckJabber, Check6):
pass
class CheckTLSCert(Check):
def build_command(self):
command = ['/usr/lib/nagios/plugins/check_http',
'--ssl', '--sni',
'-C', str(self._options.get('warn', 7),
'-t', str(self.timeout)]
if 'port' in self._options:
command += ['-p', str(self._options['port'])]
if 'vhost' in self._options:
command += ['-H', str(self._options['vhost'])]
command += [self.dest]
return command
def check(self):
command = self.build_command()
return self.exec_with_timeout(command, timeout=self.timeout + 1)
class CheckTLSCert4(CheckTLSCert, Check4):
pass
class CheckTLSCert6(CheckTLSCert, Check6):
pass
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment