首页 > nagios > mail(exim4)发邮件没反应

mail(exim4)发邮件没反应

2010年7月21日 eric 发表评论 阅读评论

从新搭建的 Nagios 服务器,该监控的业务服务都添加了内存,磁盘I/O,nginx 连接的监控,今天测试了一下邮件报警,居然不报警,查看 nagios.log 日志 有这样的错误:

[1279598130] SERVICE NOTIFICATION: eric;fms;int_net;UNKNOWN;notify-service-by-email;ERROR: Description table : The requested table is empty or does not exist.
[1279598130] Warning: Attempting to execute the command “/usr/bin/printf “%b” “***** Nagios *****\n\nNotification Type: PROBLEM\n\nService: int_net\nHost: fms-server\nAddress: 219.232.237.166\nState: UNKNOWN\n\nDate/Time: Tue Jul 20 11:55:30 CST 2010\n\nAdditional Info:\n\nERROR: Description table : The requested table is empty or does not exist.” | /bin/mail -s “** PROBLEM Service Alert: fms-server/int_net is UNKNOWN **” eric@nginxs.com” resulted in a return code of 127.  Make sure the script or binary you are trying to execute actually exists…

“Make sure the script or binary you are trying to execute actually exists…”  提示的 mail 命令不存在

nagios $> whereis mail

mail: /usr/bin/mail /etc/mail.rc /usr/share/man/man1/mail.1.gz

路径果然 不是  /bin/mail

修改 commands.cfg

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” | /usr/bin/mail -s “** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **” $CONTACTEMAIL$
        }

改过之后,还不行·那就直接用系统自带的 命令 mail 发送email

nagios $> mail -s "test" eric@nginxs.com < /root/test

没有返回任何东西。那就加上-v参数打印他的行踪

nagios $> mail -v -s "test" eric@nginxs.com < /root/test
LOG: MAIN
  <= root@fms U=root P=local S=5703
root@fms:/usr/local/nagios/etc/objects# delivering 1ObWQb-0002nV-BI
R: system_aliases for test@fms
LOG: MAIN
  ** test@fms: Unrouteable address
R: nonlocal for eric@nginxs.com
LOG: MAIN
  ** eric@nginxs.com R=nonlocal: Mailing to remote domains not supported
LOG: MAIN
  <= <> R=1ObWQb-0002nV-BI U=Debian-exim P=local S=6505
delivering 1ObWQb-0002nX-EQ
R: system_aliases for root@fms
R: system_aliases for eric@fms
R: userforward for eric@fms
R: procmail for eric@fms
R: maildrop for eric@fms
R: lowuid_aliases for eric@fms (UID 1000)
R: local_user for eric@fms
T: appendfile for eric@fms
LOG: MAIN
  Completed
LOG: MAIN
  => eric <root@fms> R=local_user T=mail_spool
LOG: MAIN
  Completed

没有验证远程 email 服务器,发现他用的 debian-exim 去发的,于是看的它的配置文件:

nagios $> vim /etc/exim4/update-exim4.conf.conf
dc_eximconfig_configtype='local'
dc_other_hostnames='fms'
dc_local_interfaces='127.0.0.1'
dc_readhost=''
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost=''
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname=''
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'

注意红字部分,他指定的是本地,google   查明想往外发就要改为:

dc_eximconfig_configtype='internet'

也顺便伪造一下,发件人的地址与名字

nagios $> vim /etc/email-addresses

在最后添加:

eric:eric@tuokou.com

重启服务:

nagios $> /etc/init.d/exim4 restart

测试发送 email

nagios $>mail -v -s "test" eric@nginxs.com < /root/test
LOG: MAIN
  <= root@fms U=root P=local S=5703
root@fms:/usr/local/nagios/etc/objects# delivering 1ObWX9-0002zu-5r
R: system_aliases for test@fms
LOG: MAIN
  ** test@fms: Unrouteable address
R: dnslookup for eric@nginxs.com
T: remote_smtp for eric@nginxs.com
Connecting to mxdomain.qq.com [119.147.10.120]:25 ... connected
  SMTP<< 220 newmx42.qq.com MX QQ Mail Server
  SMTP>> EHLO fms
  SMTP<< 250-newmx42.qq.com
         250-SIZE 73400320
         250 OK
  SMTP>> MAIL FROM:<root@fms> SIZE=6936
  SMTP<< 250 Ok
  SMTP>> RCPT TO:<eric@nginxs.com>
  SMTP<< 250 Ok
  SMTP>> DATA
  SMTP<< 354 End data with <CR><LF>.<CR><LF>
  SMTP>> writing message and terminating "."
  SMTP<< 250 Ok: queued as
  SMTP>> QUIT
LOG: MAIN
  => eric@nginxs.com R=dnslookup T=remote_smtp H=mxdomain.qq.com [119.147.10.120                                                                                                 ]
LOG: MAIN
  <= <> R=1ObWX9-0002zu-5r U=Debian-exim P=local S=6424
delivering 1ObWXF-000304-Jo
R: system_aliases for root@fms
R: system_aliases for eric@fms
R: userforward for eric@fms
R: procmail for eric@fms
R: maildrop for eric@fms
R: lowuid_aliases for eric@fms (UID 1000)
R: local_user for eric@fms
T: appendfile for eric@fms
LOG: MAIN
  Completed
LOG: MAIN
  => eric <root@fms> R=local_user T=mail_spool
LOG: MAIN
  Completed 

注意红字部分,发送成功了··
登录邮箱,收到了用户 eric 地址为eric@nginxs.com 发来的了。

转载请注明:文章转载自:Eric's linux and nginx! (http://www.nginxs.com)
本文地址:http://www.nginxs.com/linux/201.html

分类: nagios 标签: , ,
  1. 2018年1月25日20:32 | #1

    casino games free online
    casino games real money
    casino games roulette
    casino online usa

  2. 2018年1月27日19:07 | #2

    payday loans
    payday loans no credit check
    payday loans
    payday loans no credit check
    payday loans no credit check

  3. 2018年1月29日09:23 | #3

    casino online application
    casino games free
    casino online free
    casino games for free

  4. 2018年1月31日09:12 | #4

    online gambling sites for real money
    play casinos
    online casino gambling
    online gambling sites for real money
    free real money casino no deposit

  5. 2018年2月3日03:06 | #5

    real money casino
    casino games
    casino games
    casino online
    online casino

  6. 2018年2月4日11:32 | #6

    weight loss pills for women
    weight loss pills for women
    weight loss calculator
    best diet pills for men

  7. 2018年2月4日20:24 | #7

    Cialis Generic Overnight Shipping online pharmacy Cheapest Generic Viagra 100mg

  8. 2018年2月5日17:04 | #8

    vegas casino games
    casino games free online
    online casino real money
    top rated free online casino games

  9. 2018年2月6日05:01 | #9

    loans online only
    online loans for bad credit
    loans online only
    loan cash

  10. 2018年2月6日13:04 | #10

    payday loans las vegas
    online loans direct lenders
    no credit check payday loans instant approval
    payday lender fees

  11. 2018年2月9日08:36 | #11

    best us casinos online
    casino games
    casino games free
    free casino games and poker

  12. 2018年2月9日17:58 | #12

    casino online free
    best online casino games free
    casino games list
    play casino games online

  13. 2018年2月10日04:31 | #13

    A. Substitute Damaged, Useless, or Dying Bushes.

  14. 2018年2月12日04:33 | #14

    aol games free casino
    online casino real money
    online gambling casino
    best online casino games free
    online casino

  15. 2018年2月13日05:25 | #15

    best fast loans online
    payday lender fees
    loans online instant approval
    best fast loans online

  16. 2018年2月14日21:29 | #16

    Beacon Carpet Cleansing, Inc. Xtreme Carpet Cleaning.

  17. 2018年2月15日03:57 | #17

    kasino
    casino games slots free heart of vegas
    biggest no deposit welcome bonus
    online casino games
    new usa online casinos 2017

  18. 2018年2月15日22:51 | #18

    prescription weight loss pills
    prescription weight loss medication
    best diet pills for weight loss
    phentermine 37.5 without doctor’s prescription
    weight loss products

  19. 2018年2月16日17:24 | #19

    One powerful stain to remove from carpet is rust.

  20. 2018年2月17日18:23 | #20

    Call right this moment for a free estimate of our providers.

  21. 2018年2月18日00:01 | #21

    Copyright 2017 Skilled Landscaping Providers, LLC.

  22. 2018年2月18日02:17 | #22

    cheap auto insurance ratings
    car insurance companies
    auto insurance quotes
    cheap car insurance companies

  23. 2018年2月19日09:00 | #23

    Home CLEANING SERVICE and Office CLEANING SERVICE.

  24. 2018年2月19日12:28 | #24

    Providers Provided by Metropolis Tree Management, Inc.

评论分页
1 2 201
订阅评论
1+6= (必填)