Monitoring Postfix with Nagios 3
When you set up Postfix it is a critical service for your organization. It is important that you set up a way to verify that the mail server is up and running. Nagios 3 provides an easy set up to allow you to monitor your mail server. This tutorial will help you understand how to add mail service checks for your Postfix Mail Server. If you need help in setting up Nagios 3 please check THIS ARTICLE.
Step #1: Add a Host
An easy way to start setting up hosts is to choose a web server to monitor.
You will need to edit /etc/nagios3/Define your host, give it a host name and an alias, be sure to have the correct IP Address. Use the check_http command which will monitor your web server on port 80 tcp. This is a much easier way to monitor a web server using icmp because you have to modify so many firewalls to allow icmp.
define host{
use generic-host
host_name mail
alias mail
address 192.168.5.12
check_command check_smtp
max_check_attempts 10
notification_interval 120
notification_period 24×7
notification_options d,u,r
contact_groups admins
}
Step #2: Add Host to a Service
Edit the /etc/nagios3/conf.d/generic-service_nagios2.cfg. If you are using the same service you can just add the second host to the host_name line. This will make it very easy to add a number of hosts to modify. Note two host names listed.
define service{
use generic-service
host_name mail
service_description SMTP
check_command check_smtp
}
Step #3: Check Configuration and Restart
You will want to run this command to check your pre-flight check to verify you do not have typos or other errors.
nagios -v /etc/nagios3/nagios.cfg
This should result in no errors and no warnings before you proceed.
Now restart nagios and the web server for nagios.
/etc/init.d/nagios3 restart
/etc/init.d/apache2 restart
Now access the web interface of Nagios at:
http://your_ip_address/nagios3
You should see that the service is being monitored.
Posted by mike 


You must be logged in to post a comment.