I think what you're asking about is a concept known as host-level alerts. These 
are alerts which are not scoped by any particular hadoop service. A good 
example of this is the disk usage alert. It's bound only to a host and will be 
distributed and run regardless of what components are installed on that host.

There are two ways to add a host alert:
1) Edit the alerts.json under /var/lib/ambari-server/resources and add your new 
alert to the "AMBARI_AGENT" component.
2) Use the REST APIs to create your new alert. The service should be "AMBARI" 
and the component should be "AMBARI_AGENT".

You can use the current agent alert (disk usage) as an example:
https://github.com/apache/ambari/blob/trunk/ambari-server/src/main/resources/alerts.json#L31

On Apr 6, 2016, at 8:56 AM, Henning Kropp 
<hkr...@microlution.de<mailto:hkr...@microlution.de>> wrote:

How can an alert be added to a host?


Am 05/04/16 um 18:41 schrieb Henning Kropp:
Worked now. Thanks.

Am 05/04/16 um 18:01 schrieb Jonathan Hurley:
The alerts.json file is only to pickup brand new alerts that are not currently 
defined in the system. It's more of a way to quickly seed Ambari with a default 
set of alerts. If the alert has already been created, any updates for that 
alert made in alerts.json will not be brought in. You'll need to use the REST 
APIs to update existing definitions.

You are correct that the agents run the alerts. The definitions.json file on 
each agent shows what alerts it is trying to run.

On Apr 5, 2016, at 11:46 AM, Henning Kropp 
<hkr...@microlution.de<mailto:hkr...@microlution.de>> wrote:

Hi,

I am currently trying to change the alert definitions. I used the REST api to 
put a new definition for example for id /30 . I can see the changes when doing 
a GET.

Additionaly I replaced the alert.json of the service under ambari-server and 
ambari-agent. Still the changes are not reflected in 
/var/lib/ambari-agent/cache/alerts/definition.json and I suspect the alert is 
not working as expected because of this.

As I undestand the defintions are broadcasted with heartbeats by the server? 
And are executed on the host by the agent, where the service is running? Right?

What am I missing?

Thanks,
Henning








Reply via email to