Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Not able to receive emails via Ambari Alerts

Highlighted

Not able to receive emails via Ambari Alerts

Contributor

Dear Experts,

I have been trying to configure emails alerts in Ambari, but it seems like that I am not able to get emails from Ambari due to some issue. I have tried following.

  • To make sure that credentials are really working.I tried to generate emails via CLI using "swaks" and I can successfully get the emails.
  • I configured the same credentials and parameters inside Ambari alerts (notification manager) but still I do not get the emails.
  • In the ambari-server logs I can see the following.

10 Oct 2016 17:11:00,278 INFO [alert-dispatch-5] EmailDispatcher:88 - Sending email: org.apache.ambari.server.state.alert.AlertNotification@10cfcecf 10 Oct 2016 17:11:00,436 DEBUG [alert-dispatch-5] EmailDispatcher:142 - Successfully dispatched email to [@.com], so it seems like Ambari is sending email but it is struck somewhere.

I also ran tcpdump and saw the "payload" and got the following output.

0x0020: 5010 00ed 771d 0000 546f 3a20 6d68 616d P...w...To:

0x0030: 6d61 6461 6c69 3139 3840 676d 6169 6c2e @.com

0x0040: 636f 6d0d 0a4d 6573 7361 6765 2d49 443a com..Message-ID:

0x0050: 203c 3138 3536 3032 3139 3134 2e37 2e31 .<1856021914.7.1

0x0060: 3437 3631 3139 3436 3032 3739 2e4a 6176 476119460279.Jav

0x0070: 614d 6169 6c2e 726f 6f74 4064 6573 7070 aMail.root@<server name>

0x0080: 2d73 6872 6b2d 7574 302e 6e6f 6465 2e65

0x00b0: 3e0d 0a53 7562 6a65 6374 3a20 0d0a 2020 >..Subject:.....

  • Seeing the payload it seems like "FROM" portion is always missing when sending alerts via Ambari, but via CLI it is there.
  • Does anybody of you has any idea how to resolve this issue? Any experiences and ideas will be welcomed.
  • HDP Version: 2.3.4
  • Ambari Version: 2.1.1
  • Mailing Server: Mail jet

Thanks in advance guys.

Regards,

7 REPLIES 7
Highlighted

Re: Not able to receive emails via Ambari Alerts

Super Collaborator

Because you're seeing "Successfully dispatched email to ..." in the Ambari Server logs, then this means that your mail service has accepted the authentication credentials from Ambari and has responded with the correct SMTP codes when we attempted to send the email.

So the problem is going to be located in your mail service somewhere.

With that said, the fact that you see a difference in what is being sent from the command line vs from Ambari could mean that your mail service requires that extra "FROM" field populated. You can set this in the alert target properties. Here's what I would do:

1) Use the APIs to find your alert target

GET api/v1/alert_targets

2) Once you have the specific target, such as api/v1/alert_targets/1, then you can see which properties are defined. These are standard JavaMail properties, so you can add the "mail.smtp.from" property if it's not there. This should translate into the "FROM" field.

3) PUT back to the above api/v1/alert_targets/<id> endpoint. For example:

PUT api/v1/alert_targets/1

{
  "AlertTarget": {
    "name": "Administrators",
    "description": "The Admins",
    "notification_type": "EMAIL",
    "global": true,
    "properties":{
      "ambari.dispatch.credential.username":"ambari",
      "ambari.dispatch.credential.password":"password",
      "ambari.dispatch.recipients":["ambari@smtp.ambari.apache.org"],
      "mail.smtp.host":"smtp.ambari.apache.org",
      "mail.smtp.port":"25",
      "mail.smtp.auth":"true",
      "mail.smtp.starttls.enable":"false",
      "mail.smtp.from":"ambari@smtp.ambari.apache.org"
    }
  }
}


Highlighted

Re: Not able to receive emails via Ambari Alerts

Contributor

@Jonathan Hurley Thanks for your reply, I am setting up alerts via Ambari, if you go to Manage Notification -> Edit -> there is already a parameter available "Email From" available, which is actually "mail.smtp.from" the question here is that why this parameter does not translate on the mail server, do i need to add some additional property? Thanks for your help by the way.

Re: Not able to receive emails via Ambari Alerts

Super Collaborator

I'm wondering if it's not set for some reason; that's why I wanted to see what your alert target looked like.

Highlighted

Re: Not able to receive emails via Ambari Alerts

Contributor

@Jonathan Hurley It looks like this:

"name" : "email notification", "notification_type" : "EMAIL", "properties" : { "ambari.dispatch.credential.username" : "<credentials>", "mail.smtp.port" : "25", "ambari.dispatch.credential.password" : "<password>", "mail.smtp.auth" : "true", "mail.smtp.from" : "email address", "mail.smtp.starttls.enable" : "false", "mail.smtp.host" : "mail server", "ambari.dispatch.recipients" : [ "email address" ] }

Highlighted

Re: Not able to receive emails via Ambari Alerts

Super Guru

You ran swaks from the command line of the machine running ambari as the same user that ambari runs under? and you were able to reach your mail server? If not, try that. Also make sure firewall ports are open for all the mail ports.

http://docs.hortonworks.com/HDPDocuments/Ambari-2.4.1.0/bk_ambari-user-guide/content/configuring_not...

Check /var/log/ambari-server/

Highlighted

Re: Not able to receive emails via Ambari Alerts

Contributor

@Timothy Spann Thanks for your reply, yes I am using the same guide that you sent me, the port is open that is why email via sawks from command line is working, yes I am using the same server where ambari is running, the mail is being sent with root user if I am not wrong and it has access to send an email. Moreover in the logs it says that it has successfully dispatched the email as mentioned in the question.

Highlighted

Re: Not able to receive emails via Ambari Alerts

Super Collaborator

I'm not sure how you captured your TCP dump. I just tried a dump against Apache James email system and I see it setting the FROM correctly. Can you verify your TCP dump again? Also, maybe the address in your FROM is not a properly formed address and it's being rejected by your mail service somehow? Otherwise, I'd check with your mail provider.

220 repo.ambari.apache.org SMTP Server (JAMES SMTP Server 2.3.2) ready Thu, 20 Oct 2016 19:25:20 +0000 (UTC)
EHLO 192.168.64.1
250-repo.ambari.apache.org Hello 192.168.64.1 (192.168.64.1 [192.168.64.1])
250-PIPELINING
250 ENHANCEDSTATUSCODES

MAIL FROM:<ambari@repo.ambari.apache.org>
250 2.1.0 Sender <ambari@repo.ambari.apache.org> OK

RCPT TO:<ambari@repo.ambari.apache.org>
250 2.1.5 Recipient <ambari@repo.ambari.apache.org> OK

DATA
354 Ok Send data ending with <CRLF>.<CRLF>

Date: Thu, 20 Oct 2016 15:25:20 -0400 (EDT)
From: ambari@repo.ambari.apache.org
To: ambari@repo.ambari.apache.org
Message-ID: <1436750641.4.1476991520441.JavaMail.jhurley@ix-hwx.local>

Subject:
Alert Summary: OK[0], Warning[0], Critical[3], Unknown[0]

MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit

<html></html>

250 2.6.0 Message received
QUIT

221 2.0.0 repo.ambari.apache.org Service closing transmission channel
Don't have an account?
Coming from Hortonworks? Activate your account here