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

发布时间:2020-05-15 02:46:01 作者:火星小刘
来源:网络 阅读:1600

1、安装相关组建

   yum install mailx sendmail*

   chkconfig sendmail on

   service sendmail start

2、测试邮件

   echo "Hello World" | mail abc@abc.com   

3、设置发件人

[root@localhost]#vi /etc/mail.rc


set from=skykws@163.com smtp=smtp.163.com set smtp-auth-user=skykws smtp-auth-password=000000 smtp-auth=login

4、编辑command.cfg

   

# 'notify-host-by-email' command definition

define command{

command_namenotify-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 definition

define command{

command_namenotify-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. RHEL6.5/Centos6.5 搭建bugzilla
  2. centos6.5如何安装jira

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

service sendmail nagios

上一篇:python数据类型 ——bytes 和 bytearray

下一篇:TeamTalk项目iOS端代码总结

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》