Commit f7c75c70 authored by Jonathan Michalon's avatar Jonathan Michalon

Support basic SMTP command/response check

parent ce623b03
......@@ -202,3 +202,28 @@ class CheckHTTPS4(CheckHTTPS, Check4):
class CheckHTTPS6(CheckHTTPS, Check6):
class CheckSMTP(Check):
def build_command(self):
command = ['/usr/lib/nagios/plugins/check_smtp',
'-H', self.addr,
'-f', self._options.get('from', 'nonexisting@localhost'),
'-t', '2']
if 'command' in self._options:
command += ['-C', str(self._options['command'])]
if 'response' in self._options:
command += ['-R', str(self._options['response'])]
return command
def check(self):
command = self.build_command()
return self.exec_with_timeout(command, timeout=3)
class CheckSMTP4(CheckSMTP, Check4):
class CheckSMTP6(CheckSMTP, Check6):
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