标签:pass tpm tar define efi nagios 邮件 exit from
[root@nagios ~]# tar jxvf msmtp-1.4.30.tar.bz2 [root@nagios ~]# cd msmtp-1.4.30cd msmtp-1.4.30 [root@nagios msmtp-1.4.30]# ./configure --prefix=/usr/local/msmtp [root@nagios msmtp-1.4.30]# make [root@nagios msmtp-1.4.30]# make install [root@nagios ~]# mkdir /usr/local/msmtp/log [root@nagios ~]# mkdir /usr/local/msmtp/etc [root@nagios ~]# cd /usr/local/msmtp/etc [root@nagios etc]# vi msmtprc defaults logfile /usr/local/msmtp/log/msmtp.log account 263 host smtp.263.net from it@gscaifu.com auth login user it@gscaifu.com password abcd.1234 account default:263 [root@nagios ~]# yum install -y mutt [root@nagios ~]# vi /etc/Muttrc set sendmail="/usr/local/msmtp/bin/msmtp" set from="it@gscaifu.com" set realname="nagios" set use_from=yes set charset="utf-8" set send_charset="us-ascii:gb2312:utf-8" set locale="zh_CN" [root@nagios ~]# echo "邮件内容" | mutt -s "邮件标题" yongqiang.guo@gscaifu.com [root@nagios ~]# cd /usr/local/msmtp/log [root@nagios log]# cat msmtp.log Aug 09 15:57:34 host=smtp.263.net tls=off auth=on user=it@gscaifu.com from=it@gscaifu.com recipients=yongqiang.guo@gscaifu.com mailsize=342 smtpstatus=250 smtpmsg='250 2.0.0 Ok: queued as 7B6D439F' exitcode=EX_OK [root@nagios ~]# cd /usr/local/icinga/etc/objects [root@nagios 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: $HOSTADD RESS$\n\nInfo: $SERVICEOUTPUT$\n" | mutt -s "Service Alert: $HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$" $CONTACTEMAIL$ } [root@nagios 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 yongqiang.guo@gscaifu.com ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ****** }开源监控解决方案:ICINGA(Nagios)Email Notification
标签:pass tpm tar define efi nagios 邮件 exit from
原文地址:http://blog.51cto.com/13598811/2156849