開源監控解決方案:ICINGA(Nagios)Email Notification

來源:互聯網
上載者:User

標籤:pass   tpm   tar   define   efi   nagios   郵件   exit   from   

[[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 msmtprcdefaultslogfile /usr/local/msmtp/log/msmtp.logaccount 263host smtp.263.netfrom [email protected]auth loginuser [email protected]password abcd.1234account default:263[[email protected] ~]# yum install -y mutt[[email protected] ~]# vi /etc/Muttrcset sendmail="/usr/local/msmtp/bin/msmtp"set from="[email protected]"set realname="nagios"set use_from=yesset 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" "\nHost: $HOSTNAME$\n\nState: $HOSTSTATE$\n\nAddress: $HOSTADDRESS$\n\nInfo: $HOSTOUTPUT$\n" | mutt -s "Host Alert: $HOSTNAME$ is $HOSTSTATE$" $CONTACTEMAIL$               }define command{        command_name    notify-service-by-email        command_line    /usr/bin/printf "%b" "\nService: $SERVICEDESC$\n\nHost: $HOSTNAME$\n\nState: $SERVICESTATE$\n\nAddress: $HOSTADDRESS$\n\nInfo: $SERVICEOUTPUT$\n"  | 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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.