Return-Path: X-Original-To: apmail-ambari-user-archive@www.apache.org Delivered-To: apmail-ambari-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2838F19E67 for ; Wed, 6 Apr 2016 16:52:44 +0000 (UTC) Received: (qmail 68836 invoked by uid 500); 6 Apr 2016 16:52:44 -0000 Delivered-To: apmail-ambari-user-archive@ambari.apache.org Received: (qmail 68808 invoked by uid 500); 6 Apr 2016 16:52:43 -0000 Mailing-List: contact user-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@ambari.apache.org Delivered-To: mailing list user@ambari.apache.org Received: (qmail 68798 invoked by uid 99); 6 Apr 2016 16:52:43 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Apr 2016 16:52:43 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 6B2B1180114 for ; Wed, 6 Apr 2016 16:52:43 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.798 X-Spam-Level: ** X-Spam-Status: No, score=2.798 tagged_above=-999 required=6.31 tests=[FSL_HELO_BARE_IP_2=1.499, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id C5vGWsnJys08 for ; Wed, 6 Apr 2016 16:52:40 +0000 (UTC) Received: from relayvx12c.securemail.intermedia.net (relayvx12c.securemail.intermedia.net [64.78.52.187]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id E451A5F202 for ; Wed, 6 Apr 2016 16:52:38 +0000 (UTC) Received: from securemail.intermedia.net (localhost [127.0.0.1]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by emg-ca-1-2.localdomain (Postfix) with ESMTPS id 0235D53DF7 for ; Wed, 6 Apr 2016 09:52:37 -0700 (PDT) Subject: Re: Changing the Alert Definitions MIME-Version: 1.0 x-echoworx-msg-id: fe7df5d0-0acd-4f0e-922c-0262581cefdc x-echoworx-emg-received: Wed, 6 Apr 2016 09:52:36.936 -0700 x-echoworx-message-code-hashed: 25953bdf7d38f69d6852ec99ea0efdb90e4c164f65adf24392b6473841b247b3 x-echoworx-action: delivered Received: from 10.254.155.17 ([10.254.155.17]) by emg-ca-1-2 (JAMES SMTP Server 2.3.2) with SMTP ID 34 for ; Wed, 6 Apr 2016 09:52:36 -0700 (PDT) Received: from MBX080-W4-CO-1.exch080.serverpod.net (unknown [10.224.117.101]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by emg-ca-1-2.localdomain (Postfix) with ESMTPS id A2C0F53DD2 for ; Wed, 6 Apr 2016 09:52:36 -0700 (PDT) Received: from MBX080-W4-CO-2.exch080.serverpod.net (10.224.117.102) by MBX080-W4-CO-1.exch080.serverpod.net (10.224.117.101) with Microsoft SMTP Server (TLS) id 15.0.1130.7; Wed, 6 Apr 2016 09:52:35 -0700 Received: from MBX080-W4-CO-2.exch080.serverpod.net ([10.224.117.102]) by mbx080-w4-co-2.exch080.serverpod.net ([10.224.117.102]) with mapi id 15.00.1130.005; Wed, 6 Apr 2016 09:52:35 -0700 From: Jonathan Hurley To: "user@ambari.apache.org" Thread-Topic: Changing the Alert Definitions Thread-Index: AQHRj1K4MDTcZ29+hkG5Uk0mZnoLYJ97/4gAgAALTACAAVNTgIAACF4AgAACpwCAABAhgIAAGwEAgAAL0oA= Date: Wed, 6 Apr 2016 16:52:34 +0000 Message-ID: References: <5703DDBB.8090909@microlution.de> <5703EAD4.8010400@microlution.de> <57050779.7010906@microlution.de> <44E55B16-4888-4C83-9A97-93496BE44003@hortonworks.com> <570510B8.9070506@microlution.de> <570534E6.9000503@microlution.de> In-Reply-To: <570534E6.9000503@microlution.de> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [173.61.90.63] x-source-routing-agent: Processed Content-Type: multipart/alternative; boundary="_000_D7530187E4D14FDB9960B824FBA36AB5hortonworkscom_" --_000_D7530187E4D14FDB9960B824FBA36AB5hortonworkscom_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable This is an artifact of how Gson does its conversion. There were several bug= s fixed in Ambari around this. I'm guessing you have an older version and m= ay be hitting AMBARI-11566? In any event, can you provide the POST which cr= eated the definition? On Apr 6, 2016, at 12:10 PM, Henning Kropp > wrote: 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 a= ll fields in a PUT request, while still getting the below error. What I not= iced also is, that "default_port" is returned as a float but defined as an = int AlertUri.class com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: For i= nput string: ".0" at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.j= ava:232) at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.j= ava:222) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.rea= d(ReflectiveTypeAdapterFactory.java:93) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapt= er.read(ReflectiveTypeAdapterFactory.java:172) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.rea= d(ReflectiveTypeAdapterFactory.java:93) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapt= er.read(ReflectiveTypeAdapterFactory.java:172) at com.google.gson.Gson.fromJson(Gson.java:795) at com.google.gson.Gson.fromJson(Gson.java:859) at com.google.gson.Gson$2.deserialize(Gson.java:131) at org.apache.ambari.server.state.alert.AlertDefinitionFactory$Aler= tDefinitionSourceAdapter.deserialize(AlertDefinitionFactory.java:350) at org.apache.ambari.server.state.alert.AlertDefinitionFactory$Aler= tDefinitionSourceAdapter.deserialize(AlertDefinitionFactory.java:294) at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58) at com.google.gson.Gson.fromJson(Gson.java:795) at com.google.gson.Gson.fromJson(Gson.java:761) at com.google.gson.Gson.fromJson(Gson.java:710) at com.google.gson.Gson.fromJson(Gson.java:682) at org.apache.ambari.server.state.alert.AlertDefinitionFactory.coer= ce(AlertDefinitionFactory.java:195) at org.apache.ambari.server.state.alert.AlertDefinitionHash.getAler= tDefinitions(AlertDefinitionHash.java:240) at org.apache.ambari.server.state.alert.AlertDefinitionHash.enqueue= AgentCommands(AlertDefinitionHash.java:490) at org.apache.ambari.server.state.alert.AlertDefinitionHash.enqueue= AgentCommands(AlertDefinitionHash.java:460) at org.apache.ambari.server.events.listeners.alerts.AlertHashInvali= dationListener.onAmbariEvent(AlertHashInvalidationListener.java:94) at sun.reflect.GeneratedMethodAccessor225.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethod= AccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler= .java:74) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.AsyncEventBus.access$001(AsyncEventBu= s.java:34) at com.google.common.eventbus.AsyncEventBus$1.run(AsyncEventBus.jav= a:100) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExec= utor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExe= cutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NumberFormatException: For input string: ".0" at java.lang.NumberFormatException.forInputString(NumberFormatExcep= tion.java:65) at java.lang.Integer.parseInt(Integer.java:569) at java.math.BigInteger.(BigInteger.java:461) at java.math.BigInteger.(BigInteger.java:597) at com.google.gson.internal.LazilyParsedNumber.intValue(LazilyParse= dNumber.java:41) at com.google.gson.JsonPrimitive.getAsInt(JsonPrimitive.java:255) at com.google.gson.internal.bind.JsonTreeReader.nextInt(JsonTreeRea= der.java:197) at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.j= ava:230) ... 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 Name= Node, then Ambari will automatically push this alert definition to any host= that's running NameNode. The host will begin running the alert automatical= ly. There's really nothing that you need to do here; the alert framework ha= ndles everything for you. On Apr 6, 2016, at 9:35 AM, Henning Kropp <hk= ropp@microlution.de> wrote: Actually I added a alert definition (via REST), but it does not have any Se= rvice/Host attached, so I was wondering how are hosts "attached" to an aler= t defintion? It's an alert for HDFS, NAMENODE, so the definition on POST contained the c= omponent and service attributes, which would be enough information to distr= ibute 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. T= hese are alerts which are not scoped by any particular hadoop service. A go= od example of this is the disk usage alert. It's bound only to a host and w= ill be distributed and run regardless of what components are installed on t= hat 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 "AMBAR= I" 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/resource= s/alerts.json#L31 On Apr 6, 2016, at 8:56 AM, Henning Kropp > 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 curren= tly 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 u= se the REST APIs to update existing definitions. You are correct that the agents run the alerts. The definitions.json file o= n each agent shows what alerts it is trying to run. On Apr 5, 2016, at 11:46 AM, Henning Kropp <h= kropp@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 an= d ambari-agent. Still the changes are not reflected in /var/lib/ambari-agen= t/cache/alerts/definition.json and I suspect the alert is not working as ex= pected 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 --_000_D7530187E4D14FDB9960B824FBA36AB5hortonworkscom_ Content-Type: text/html; charset="Windows-1252" Content-ID: <72F6DA73FDBC1541998574DEBCD7B570@exch080.serverpod.net> Content-Transfer-Encoding: quoted-printable

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


On Apr 6, 2016, at 12:10 PM, Henning Kropp <hkropp@microlution.de> wrote= :

Ok, since I was gettin= g back a 200 reply I didn't check the logs. I get the below error for no ap= prent reason. During try and error I removed almost all fields in a PUT req= uest, while still getting the below error. What I noticed also is, that "default_port" is returned as a flo= at but defined as an int AlertUri.class

com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: For i= nput string: ".0"
        at com.google.gson.internal.bind= .TypeAdapters$7.read(TypeAdapters.java:232)
        at com.google.gson.internal.bind= .TypeAdapters$7.read(TypeAdapters.java:222)
        at com.google.gson.internal.bind= .ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93)<= br class=3D"">         at com.google.gson.internal.bind= .ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.jav= a:172)
        at com.google.gson.internal.bind= .ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93)<= br class=3D"">         at com.google.gson.internal.bind= .ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.jav= a:172)
        at com.google.gson.Gson.fromJson= (Gson.java:795)
        at com.google.gson.Gson.fromJson= (Gson.java:859)
        at com.google.gson.Gson$2.deseri= alize(Gson.java:131)
        at org.apache.ambari.server.stat= e.alert.AlertDefinitionFactory$AlertDefinitionSourceAdapter.deserialize(Ale= rtDefinitionFactory.java:350)
        at org.apache.ambari.server.stat= e.alert.AlertDefinitionFactory$AlertDefinitionSourceAdapter.deserialize(Ale= rtDefinitionFactory.java:294)
        at com.google.gson.TreeTypeAdapt= er.read(TreeTypeAdapter.java:58)
        at com.google.gson.Gson.fromJson= (Gson.java:795)
        at com.google.gson.Gson.fromJson= (Gson.java:761)
        at com.google.gson.Gson.fromJson= (Gson.java:710)
        at com.google.gson.Gson.fromJson= (Gson.java:682)
        at org.apache.ambari.server.stat= e.alert.AlertDefinitionFactory.coerce(AlertDefinitionFactory.java:195)
        at org.apache.ambari.server.stat= e.alert.AlertDefinitionHash.getAlertDefinitions(AlertDefinitionHash.java:24= 0)
        at org.apache.ambari.server.stat= e.alert.AlertDefinitionHash.enqueueAgentCommands(AlertDefinitionHash.java:4= 90)
        at org.apache.ambari.server.stat= e.alert.AlertDefinitionHash.enqueueAgentCommands(AlertDefinitionHash.java:4= 60)
        at org.apache.ambari.server.even= ts.listeners.alerts.AlertHashInvalidationListener.onAmbariEvent(AlertHashIn= validationListener.java:94)
        at sun.reflect.GeneratedMethodAc= cessor225.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodA= ccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invo= ke(Method.java:497)
        at com.google.common.eventbus.Ev= entHandler.handleEvent(EventHandler.java:74)
        at com.google.common.eventbus.Ev= entBus.dispatch(EventBus.java:314)
        at com.google.common.eventbus.As= yncEventBus.access$001(AsyncEventBus.java:34)
        at com.google.common.eventbus.As= yncEventBus$1.run(AsyncEventBus.java:100)
        at java.util.concurrent.ThreadPo= olExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPo= olExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.j= ava:745)
Caused by: java.lang.NumberFormatException: For input string: ".0"= ;
        at java.lang.NumberFormatExcepti= on.forInputString(NumberFormatException.java:65)
        at java.lang.Integer.parseInt(In= teger.java:569)
        at java.math.BigInteger.<init= >(BigInteger.java:461)
        at java.math.BigInteger.<init= >(BigInteger.java:597)
        at com.google.gson.internal.Lazi= lyParsedNumber.intValue(LazilyParsedNumber.java:41)
        at com.google.gson.JsonPrimitive= .getAsInt(JsonPrimitive.java:255)
        at com.google.gson.internal.bind= .JsonTreeReader.nextInt(JsonTreeReader.java:197)
        at com.google.gson.internal.bind= .TypeAdapters$7.read(TypeAdapters.java:230)
        ... 30 more

Am 06/04/16 um 16:33 schrieb Jonathan Hurley= :
Alerts are automatically distributed to all hosts which mat= ch their service and component. So, if you created your alert definition wi= th HDFS and NameNode, then Ambari will automatically push this alert defini= tion to any host that's running NameNode. The host will begin running the alert automatically. There's really nothin= g that you need to do here; the alert framework handles everything for you.=

On Apr 6, 2016, at 9:35 AM, Henning Kropp <hkropp= @microlution.de> wrote:

Actually I added a ale= rt definition (via REST), but it does not have any Service/Host attached, s= o 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 c= omponent and service attributes, which would be enough information to distr= ibute 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 hado= op 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/resour= ces 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 exam= ple: 

On Apr 6, 2016, at 8:56 AM, Henning Kropp <hkropp@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 o= f a way to quickly seed Ambari with a default set of alerts. If the alert h= as 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 o= n each agent shows what alerts it is trying to run.

On Apr 5, 2016, at 11:46 AM, Henning K= ropp <hkropp@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 an= d ambari-agent. Still the changes are not reflected in /var/lib/ambari-agen= t/cache/alerts/definition.json and I suspect the alert is not working as ex= pected 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












--_000_D7530187E4D14FDB9960B824FBA36AB5hortonworkscom_--