midea2 发表于 2015-11-23 10:35:07

Nagios监控postfix队列

  下载地址:http://exchange.nagios.org/directory/Plugins/Email-and-Groupware/Postfix/Postfix-Queue-Monitor/details


  安装:
  

# cd /usr/local/src/tarbag/
# tar zxvf postfix-queuemonitor-1.0.tar
# tar zxvf postfix-queuemonitor-1.0.tar.gz -C /usr/local/nagios/libexec/
# cd /usr/local/nagios/libexec/
# mv postfix_quemonitor/* ../
  将postfix加入PATH中.
  

# vi /etc/profile
POSTFIX_HOME=/usr/local/postfix/sbin
PATH=:$POSTFIX_HOME:$PATH
# source /etc/profile
  将监控程序加入开机自启动,并运行:
  

# echo "/usr/local/nagios/libexec/queuemon &" >> /etc/rc.local
# /usr/local/nagios/libexec/queuemon &
  配置nrpe.cfg
  

# vi nrpe.cfg
command=/usr/local/nagios/libexec/check_queue /tmp/que
  配置nagios服务端 Mail主机的配置文件:
  

# vi mail.cfg
define service{
use                           local-service         ; Name of service template to use
host_name                     mail_host
service_description             Postfix_queuemonitor
check_command                   check_nrpe!check_postfix
notifications_enabled         1
}

  重启nrpe 跟nagios



  如果mail跟Nagios在同一台机器上.
  编辑command.cfg
  

# vi commands.cfg
define command {
command_name check_postfix
command_line /usr/local/nagios/libexec/check_queue /tmp/que
}
  编辑本机cfg文件
  

# vi localhost.cfg
define service{
use                           local-service         ; Name of service template to use
host_name                     localhost
service_description             Postfix_queuemonitor
check_command                   check_postfix
notifications_enabled         1
}
  重启Nagios 完成
页: [1]
查看完整版本: Nagios监控postfix队列