配置邮箱和飞信功能
Centos默认是安装sendmail的,我们可以用sendmail发送邮件。Service sendmail start
创新互联是一家集网站建设,吉县企业网站建设,吉县品牌网站建设,网站定制,吉县网站建设报价,网络营销,网络优化,吉县网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。
mail -s "test" shan1987shan@126.com < sendmail.cf //测试邮件发送
Vi /usr/local/nagios/etc/object/contacts.cfg //添加邮箱
Vi /usr/local/nagios/etc/object/commad.cfg //增加邮箱命令
define command{
command_name notify-host-by-sendEmail
command_line /usr/bin/printf "%b" "***** Nagios-BJ *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "host $HOSTSTATE$ alter for $HOSTNAME$!" $CONTACTEMAIL$ -l /var/log/sendEmail.log
}
define command{
command_name notify-service-by-sendEmail
command_line /usr/bin/printf "%b" "***** Nagios-BJ *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTNAME$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$ -l /var/log/sendEmail.log
}
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg //
Service nagios restart
标题名称:网络主机监控-nagios应用漫谈(七)
网站网址:http://lswzjz.com/article/gjihds.html