Alerts are automatically distributed to all hosts which match their service and component. So, if you created your alert definition with HDFS and NameNode, then Ambari will automatically push this alert definition to any host that's running NameNode. The host will begin running the alert automatically. There's really nothing that you need to do here; the alert framework handles everything for you.
On Apr 6, 2016, at 9:35 AM, Henning Kropp <hkr...@microlution.de<mailto:hkr...@microlution.de>> wrote: Actually I added a alert definition (via REST), but it does not have any Service/Host attached, so I was wondering how are hosts "attached" to an alert defintion? It's an alert for HDFS, NAMENODE, so the definition on POST contained the component and service attributes, which would be enough information to distribute the alert on the corresponding hosts? Sorry for the confusion. In my search for an answer I came accross the host-only alerts and thought it was related. Thanks again for your help. Regards, Henning Am 06/04/16 um 15:26 schrieb Jonathan Hurley: 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 <<mailto:hkr...@microlution.de>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 <<mailto:hkr...@microlution.de>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