86756 发表于 2014-10-10 10:49:49

centos6.5 nagios-4.0.8 系统自带sendmail邮件报警设置

1、安装相关组建

   yum install mailx sendmail*
   chkconfig sendmail on
   service sendmail start
2、测试邮件
   echo "Hello World" | mail abc@abc.com   
3、编辑command.cfg


# 'notify-host-by-email' command definitiondefine command{        command_name        notify-host-by-email        command_line        /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$        }
# 'notify-service-by-email' command definitiondefine command{        command_name        notify-service-by-email        command_line        /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$        }4、重启nagios
   service nagios restart
5、后记
   关于报警发送间隔等等设置不做详细介绍

页: [1]
查看完整版本: centos6.5 nagios-4.0.8 系统自带sendmail邮件报警设置