ambari-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Hurley <>
Subject Re: Changing the Alert Definitions
Date Fri, 15 Apr 2016 13:54:04 GMT
Can you provide an example of the POST you're using to create the definition. This might be
a bug that needs to be fixed.

To answer your question, it might get converted to a float in JSON responses because their
default serializers don't know if it's a double or an integer. But when you create your alert,
you can send it as an integer and that should prevent any parsing problems.

On Apr 13, 2016, at 8:49 AM, Henning Kropp <<>>

To follow up. I believe that the default_port is causing the issue. Why is it a float?

The error appeared even with DELETE. So my assumption is, since I had disabled alerts, due
to parsing errors, for HDFS they were parsed again. Could this be?

I submited alert definitions with default_port: 0.0 without issues, but they never registered
with any host. Once I removed the default_port from the source description, it was fine.

All with Ambari 2.2


Am 06/04/16 um 18:52 schrieb Jonathan Hurley:

This is an artifact of how Gson does its conversion. There were several bugs fixed in Ambari
around this. I'm guessing you have an older version and may be hitting AMBARI-11566? In any
event, can you provide the POST which created the definition?

On Apr 6, 2016, at 12:10 PM, Henning Kropp <<><>>

Ok, since I was getting back a 200 reply I didn't check the logs. I get the below error for
no apprent reason. During try and error I removed almost all fields in a PUT request, while
still getting the below error. What I noticed also is, that "default_port" is returned as
a float but defined as an int AlertUri.class java.lang.NumberFormatException: For input string: ".0"
        at org.apache.ambari.server.state.alert.AlertDefinitionFactory$AlertDefinitionSourceAdapter.deserialize(
        at org.apache.ambari.server.state.alert.AlertDefinitionFactory$AlertDefinitionSourceAdapter.deserialize(
        at org.apache.ambari.server.state.alert.AlertDefinitionFactory.coerce(
        at org.apache.ambari.server.state.alert.AlertDefinitionHash.getAlertDefinitions(
        at org.apache.ambari.server.state.alert.AlertDefinitionHash.enqueueAgentCommands(
        at org.apache.ambari.server.state.alert.AlertDefinitionHash.enqueueAgentCommands(
        at sun.reflect.GeneratedMethodAccessor225.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
        at java.lang.reflect.Method.invoke(
        at java.util.concurrent.ThreadPoolExecutor.runWorker(
        at java.util.concurrent.ThreadPoolExecutor$
Caused by: java.lang.NumberFormatException: For input string: ".0"
        at java.lang.NumberFormatException.forInputString(
        at java.lang.Integer.parseInt(
        at java.math.BigInteger.<init>(
        at java.math.BigInteger.<init>(
        ... 30 more

Am 06/04/16 um 16:33 schrieb Jonathan Hurley:
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 <<>>

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

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.


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:

On Apr 6, 2016, at 8:56 AM, Henning Kropp <<><>>

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 <<><>>


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?


View raw message