使用Nagios监控esx、esxi、vcenter 之 使用外部smtp服务器发送邮件告警

使用sendEmail实现

sendEmail的主页[url]http://caspian.dotconf.net/menu/Software/SendEmail/[/url]

下载地址[url]http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.55.tar.gz[/url]

tar �Czxvf sendEmail-v1.55.tar.gz

cd sendEmail-v1.55

cp sendEmail /usr/local/bin

简单测试是否可以使用

/usr/local/bin/sendEmail  �Cf  [email protected]  �Ct  test@test.com �Cs smtp.game.com �Cu “from test” �Cxu nagios �Cxp nagios �Cm nagios

修改command文件

# 'notify-by-email' command definition

define command{

command_name notify-by-email

command_line /usr/bin/printf "%b" "***** Nagios 2.9 *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/local/bin/sendEmail -f [email protected] -t $CONTACTEMAIL$ �Cs smtp.game.com -u "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" 

}

本文出自 “王11” 博客,谢绝转载!

你可能感兴趣的:(nagios监控,smtp服务)