Support Questions
Find answers, ask questions, and share your expertise

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

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

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

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.

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

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

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],
    ...
  }
}

New Contributor

Hi

 

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

 

Regads

Amjad

New Contributor

Thanks Jonathan, I appreciate it.

; ;