nagios发邮件-sendmail
来源:互联网 发布:类似zaker的软件 编辑:程序博客网 时间:2024/05/13 14:22
首先要确保sendmail相关组件的完整安装,我们可以使用如下的命令来完成sendmail的安装:
# yum install -y sendmail*
然后重新启动sendmail服务:
# service sendmail restart
然后发送测试邮件,验证sendmail的可用性:
# echo "Hello World" | mail abc@abc.com(这里qq邮箱不行)
2、配置nagios中报警邮箱
vi /usr/local/nagios/etc/objects/contacts.cfg define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user
email lihuipeng007@163.com ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
在email那里加上自己的邮箱,如果有多个可以用逗号隔开
3、设置报警方式:
vi /usr/local/nagios/etc/objects/templates.cfg define contact{name generic-contact ; The name of this contact template
service_notification_period 24x7 ; service notifications can be sent anytime
host_notification_period 24x7 ; host notifications can be sent anytime
service_notification_options w,u,c,r,f,s ; send notifications for all service states, flapping events, and scheduled downtime events
host_notification_options d,u,r,f,s ; send notifications for all host states, flapping events, and scheduled downtime events
service_notification_commands notify-service-by-email ; send service notifications via email
host_notification_commands notify-host-by-email ; send host notifications via email
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE!
}这两个notify-service-by-email 和 notify-host-by-email 是在command.cfg那里定义的,看看是怎么定义的:
# 'notify-host-by-email' command definition
define 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 definition
define 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$
}
这里已经默认配置好,我们不用修改直接调用就是了
最后重启服务:
service nagios retart- nagios发邮件-sendmail
- 使用sendmail 发邮件
- sendmail发邮件命令
- sendMail 发邮件 tls
- SendMail发邮件
- sendmail-命令行发邮件利器
- linux用sendmail发邮件
- nagios中sendmail邮件报警设置
- Linux sendmail服务发邮件 ~~详解:Myself
- windows下服务器配置sendmail发邮件
- shell 发邮件命令之 sendmail
- sendmail发邮件的故障解决
- 不依赖sendmail和postfix发邮件
- sendmail发邮件报错的解决办法
- CentOS6.x下配置sendmail发邮件
- Linux php 不能调用sendmail发邮件
- shell 发邮件命令之 sendmail
- nagios中告警邮件-sendmail服务的配置
- 【图像处理】利用积分图像法快速计算Haar特征
- 找根的数量
- hdustrstr函数
- CUDA的计时方法
- 线性代数学习点(四):向量数乘的几何表示
- nagios发邮件-sendmail
- http错误码
- AJAX_jQuery框架,三种无刷新方法
- ZOJ2833 Friendship(并查集)
- 阅读英语论文题目列表
- Struts2注解使用说明
- QT中QWS的含义
- jdk与openjdk的区别
- JSON资料整理