Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Need the email related fields for JSON object AlertTarget. Trying to automate alert-email creation.

avatar
New Contributor

Alert Target JSON needs to include Email To, SMTP server, port, email from, authentication, username, and password info. I need to know how to format this information with existing object: "AlertTarget": { "name": "sdf", "description": "sdf.", "notification_type": "EMAIL", "global": "true", "alert_states": ["CRITICAL"], "properties": { "ambari.dispatch-property.script": "my.custom.alert.dispatcher.script" } } }

1 ACCEPTED SOLUTION

avatar
Super Collaborator

I agree with Akhil, we'd need some more information about what you are trying to do. However, his links are a great place to start. Also, it seems like you're trying to use the REST APIs directly. In which case, this link might also be of some help since it gives examples for using the alert groups and targets endpoints:

https://github.com/apache/ambari/blob/trunk/ambari-server/docs/api/v1/alert-dispatching.md

View solution in original post

6 REPLIES 6

avatar

Hi @Ashen Parikh,

from your question its not clear what you are trying to do.

if you are trying to get notified for alerts in ambari. you can refer to following doc: https://docs.hortonworks.com/HDPDocuments/Ambari-2.6.2.2/bk_ambari-operations/content/creating_or_ed...

if you want to customize the alert template : https://cwiki.apache.org/confluence/display/AMBARI/Customizing+the+Alert+Template

if these are not helping you revert with your exact query and what you are trying to achieve.

Please accept this answer if you find it helpful.

avatar
Super Collaborator

I agree with Akhil, we'd need some more information about what you are trying to do. However, his links are a great place to start. Also, it seems like you're trying to use the REST APIs directly. In which case, this link might also be of some help since it gives examples for using the alert groups and targets endpoints:

https://github.com/apache/ambari/blob/trunk/ambari-server/docs/api/v1/alert-dispatching.md

avatar
New Contributor

Thank you @Akhil S Naik for the documentation. I was looking to complete a post of an alert target to the /api/v1/alert_targets/ API via Python. I was missing the syntax for some fields that I found thanks to @Jonathan Hurley The documentation didn't appear in my search results initially. Now, I have been able to successfully post the alert target with the exception when I try to specify a particular Alert Group rather than all. The documentation provided includes the syntax for all groups not one group.

The image attached contains the Alert Group Info. Could you let me know where the syntax needs to be modified?

95423-alert-target-json.png

avatar
Super Collaborator

In order to associate an `AlertTarget` with specific groups, you would use the `groups` property along with an array of IDs for the groups you care about:

{
  "AlertTarget": {
    "name": "Administrators",
    "description": "The Admins",
    "notification_type": "EMAIL",
    "groups": [1, 17, 23],
    ...
  }
}

avatar
Explorer

Hi

 

do we have something similar for cloudera (custom alerts)?

 

Regads

Amjad

avatar
New Contributor

Thanks Jonathan, I appreciate it.