Nagios监控postfix队列

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

安装:

[root@localhost ~]# cd /usr/local/src/tarbag/
[root@localhost tarbag]# tar zxvf postfix-queuemonitor-1.0.tar
[root@localhost tarbag]# tar zxvf postfix-queuemonitor-1.0.tar.gz -C /usr/local/nagios/libexec/
[root@localhost tarbag]# cd /usr/local/nagios/libexec/
[root@localhost libexec]# mv postfix_quemonitor/* ../

将postfix加入PATH中.

[root@localhost libexec]# vi /etc/profile
POSTFIX_HOME=/usr/local/postfix/sbin
PATH=:$POSTFIX_HOME:$PATH
[root@localhost libexec]# source /etc/profile

将监控程序加入开机自启动,并运行:

[root@localhost libexec]# echo "/usr/local/nagios/libexec/queuemon &" >> /etc/rc.local
[root@localhost libexec]# /usr/local/nagios/libexec/queuemon &

配置nrpe.cfg

[root@localhost etc]# vi nrpe.cfg 
command[check_postfix]=/usr/local/nagios/libexec/check_queue /tmp/que  

配置nagios服务端 Mail主机的配置文件:

[root@localhost objects]# 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

[root@localhost objects]# vi commands.cfg 
define command {
        command_name check_postfix
        command_line /usr/local/nagios/libexec/check_queue /tmp/que
        }

编辑本机cfg文件

[root@localhost objects]# 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 完成 

你可能感兴趣的:(command,service,Path,nagios,notifications)