开源监控解决方案:ICINGA(Nagios)Email Notification
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了开源监控解决方案:ICINGA(Nagios)Email Notification相关的知识,希望对你有一定的参考价值。
[[email protected] ~]# tar jxvf msmtp-1.4.30.tar.bz2 [[email protected] ~]# cd msmtp-1.4.30cd msmtp-1.4.30 [[email protected] msmtp-1.4.30]# ./configure --prefix=/usr/local/msmtp [[email protected] msmtp-1.4.30]# make [[email protected] msmtp-1.4.30]# make install [[email protected] ~]# mkdir /usr/local/msmtp/log [[email protected] ~]# mkdir /usr/local/msmtp/etc [[email protected] ~]# cd /usr/local/msmtp/etc [[email protected] etc]# vi msmtprc defaults logfile /usr/local/msmtp/log/msmtp.log account 263 host smtp.263.net from [email protected] auth login user [email protected] password abcd.1234 account default:263 [[email protected] ~]# yum install -y mutt [[email protected] ~]# vi /etc/Muttrc set sendmail="/usr/local/msmtp/bin/msmtp" set from="[email protected]" set realname="nagios" set use_from=yes set charset="utf-8" set send_charset="us-ascii:gb2312:utf-8" set locale="zh_CN" [[email protected] ~]# echo "邮件内容" | mutt -s "邮件标题" [email protected] [[email protected] ~]# cd /usr/local/msmtp/log [[email protected] log]# cat msmtp.log Aug 09 15:57:34 host=smtp.263.net tls=off auth=on [email protected] [email protected] [email protected] mailsize=342 smtpstatus=250 smtpmsg='250 2.0.0 Ok: queued as 7B6D439F' exitcode=EX_OK [[email protected] ~]# cd /usr/local/icinga/etc/objects [[email protected] objects]# vi commands.cfg define command{ command_name notify-host-by-email command_line /usr/bin/printf "%b" " Host: $HOSTNAME$ State: $HOSTSTATE$ Address: $HOSTADDRESS$ Info: $HOSTOUTPUT$ " | mutt -s "Host Alert: $HOSTNAME$ is $HOSTSTATE$" $CONTACTEMAIL$ } define command{ command_name notify-service-by-email command_line /usr/bin/printf "%b" " Service: $SERVICEDESC$ Host: $HOSTNAME$ State: $SERVICESTATE$ Address: $HOSTADD RESS$ Info: $SERVICEOUTPUT$ " | mutt -s "Service Alert: $HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$" $CONTACTEMAIL$ } [[email protected] objects]# vi contacts.cfg define contact{ contact_name icingaadmin ; Short name of user use generic-contact ; Inherit default values from generic-contact template (defined above) alias Icinga Admin ; Full name of user email [email protected] ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ****** }
以上是关于开源监控解决方案:ICINGA(Nagios)Email Notification的主要内容,如果未能解决你的问题,请参考以下文章
开源监控解决方案:ICINGA(Nagios)Email Notification
icinga2通过check_ping.pl插件生成可用性监控