Commit aa694e43 authored by Jonathan Michalon's avatar Jonathan Michalon

Merge branch 'master' into 'master'

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

See merge request !10
parents acf7b96d c45ad1d0
......@@ -87,7 +87,7 @@ Test it!
You have several solutions :
* Install with `distutils`, for example: `setup.py install --user` then run it from your local bin/ directory;
* Install with `distutils`, for example: `python3 setup.py install --user` then run it from your local bin/ directory;
* Run directly with something like `python3 -m picomon`
* Set python module path by hand: `PYTHONPATH=. bin/picomon`
......
......@@ -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