Monitoring SMTP with Nagios

In this quick how to we will look at monitoring Publicly available SMTP servers with Nagios. We will be doing basic monitoring just to see weather server resopnds on port 25 within 10 seconds. We will be using plugin called check_smtp.

We already have Nagios up and running and will be monitoring two SMTP servers called MAIL1.local and MAIL2.local

Monitoring SMTP:

Make sure that commands.cfg file contains a command definition for using the check_smtp plugin

define command{
	command_name	check_smtp
	command_line	$USER1$/check_smtp -H $HOSTADDRESS$ $ARG1$

Create service definition that looks like this

define service{
	use		generic-service		
	host_name		MAIL1.local, MAIL2.local
	service_description	SMTP
	check_command	check_smtp

Now test Nagios configuration files

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Restart Nagios

service nagios restart