<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: How to view Alert History via Ambari ? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-to-view-Alert-History-via-Ambari/m-p/95045#M58415</link>
    <description>&lt;P&gt;Another method is to use the API.&lt;/P&gt;&lt;P&gt;&lt;A href="http://server:8080/api/v1/clusters/&amp;lt;cluster_name&amp;gt;/alert_history" target="_blank"&gt;http://server:8080/api/v1/clusters/&amp;lt;cluster_name&amp;gt;/alert_history&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You can also filter for individual fields, or use query predicates like =, !=, in().&lt;/P&gt;&lt;P&gt;api/v1/clusters/c1/alert_history?fields/AlertHistory/&lt;/P&gt;&lt;P&gt;api/v1/clusters/c1/alerts?Alert/state=CRITICAL&lt;/P&gt;</description>
    <pubDate>Thu, 22 Oct 2015 04:29:25 GMT</pubDate>
    <dc:creator>afernandez</dc:creator>
    <dc:date>2015-10-22T04:29:25Z</dc:date>
    <item>
      <title>How to view Alert History via Ambari ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-view-Alert-History-via-Ambari/m-p/95042#M58412</link>
      <description>&lt;P&gt;I want to view how many times Kafka died in the last 10 days . Is there any ways to view it from Ambari ?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2015 20:12:10 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-view-Alert-History-via-Ambari/m-p/95042#M58412</guid>
      <dc:creator>Jagatheeshr</dc:creator>
      <dc:date>2015-10-07T20:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to view Alert History via Ambari ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-view-Alert-History-via-Ambari/m-p/95043#M58413</link>
      <description>&lt;P&gt;I am not aware of a historical view into this information via the Ambari UI but you can certainly grab this information via the backing Ambari database. Using the default installation you can access it as follows from the Ambari server node:&lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;psql ambari ambari [default pw is bigdata]&lt;/LI&gt;&lt;LI&gt;select service_name, component_name, alert_state from alert_history where service_name='KAFKA' limit 5;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The results will look something like this: &lt;/P&gt;&lt;PRE&gt;service_name | component_name | alert_state
--------------+----------------+-------------
 KAFKA        | KAFKA_BROKER   | CRITICAL
 KAFKA        | KAFKA_BROKER   | OK
 KAFKA        | KAFKA_BROKER   | CRITICAL&lt;/PRE&gt;&lt;P&gt;You can get more details from that table and derive the information that you are looking for.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2015 23:47:55 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-view-Alert-History-via-Ambari/m-p/95043#M58413</guid>
      <dc:creator>bwilson</dc:creator>
      <dc:date>2015-10-07T23:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to view Alert History via Ambari ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-view-Alert-History-via-Ambari/m-p/95044#M58414</link>
      <description>&lt;P&gt;Check out the &lt;STRONG&gt;/var/log/ambari-server/ambari-alerts.log&lt;/STRONG&gt; file, it writes an alert stream to the file. There is also another way, potentially, I'll flag it with right team to comment on this thread next.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2015 22:10:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-view-Alert-History-via-Ambari/m-p/95044#M58414</guid>
      <dc:creator>andrewg</dc:creator>
      <dc:date>2015-10-08T22:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to view Alert History via Ambari ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-view-Alert-History-via-Ambari/m-p/95045#M58415</link>
      <description>&lt;P&gt;Another method is to use the API.&lt;/P&gt;&lt;P&gt;&lt;A href="http://server:8080/api/v1/clusters/&amp;lt;cluster_name&amp;gt;/alert_history" target="_blank"&gt;http://server:8080/api/v1/clusters/&amp;lt;cluster_name&amp;gt;/alert_history&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You can also filter for individual fields, or use query predicates like =, !=, in().&lt;/P&gt;&lt;P&gt;api/v1/clusters/c1/alert_history?fields/AlertHistory/&lt;/P&gt;&lt;P&gt;api/v1/clusters/c1/alerts?Alert/state=CRITICAL&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2015 04:29:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-view-Alert-History-via-Ambari/m-p/95045#M58415</guid>
      <dc:creator>afernandez</dc:creator>
      <dc:date>2015-10-22T04:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to view Alert History via Ambari ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-view-Alert-History-via-Ambari/m-p/95046#M58416</link>
      <description>&lt;P&gt;Based on &lt;A rel="user" href="https://community.cloudera.com/users/326/afernandez.html" nodeid="326"&gt;@afernandez@hortonworks.com&lt;/A&gt; suggestion, reference docs for Alerts and Alerts History are available at &lt;A href="https://github.com/apache/ambari/blob/branch-2.1/ambari-server/docs/api/v1/alerts.md"&gt;https://github.c&lt;/A&gt;&lt;A href="https://github.com/apache/ambari/blob/branch-2.1/ambari-server/docs/api/v1/alerts.md"&gt;om/apache/ambari/blob/branch-2.1/ambari-server/docs/api/v1/alerts.md&lt;/A&gt;&lt;/P&gt;&lt;P&gt;E.g., to get critical Kafka service alerts (I am using a brilliant cli JSON processor, jq &lt;A href="https://stedolan.github.io/jq/"&gt;https://stedolan.github.io/jq/&lt;/A&gt; &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;curl -s -u admin:admin -H 'X-Requested-BY: ambari' \
&lt;A href="http://localhost:8080/api/v1/clusters/Sandbox/services/KAFKA/alert_history?fields=*" target="_blank"&gt;http://localhost:8080/api/v1/clusters/Sandbox/services/KAFKA/alert_history?fields=*&lt;/A&gt; \

| jq '.items[] | select (.AlertHistory.state=="CRITICAL")'&lt;/PRE&gt;&lt;P&gt;This gives me an output like this (pretty-printed):&lt;/P&gt;&lt;PRE&gt;{
  "href": "http://localhost:8080/api/v1/clusters/Sandbox/services/KAFKA/alert_history/16",
  "AlertHistory": {
    "cluster_name": "Sandbox",
    "component_name": "KAFKA_BROKER",
    "definition_id": 1,
    "definition_name": "kafka_broker_process",
    "host_name": "sandbox.hortonworks.com",
    "id": 16,
    "instance": null,
    "label": "Kafka Broker Process",
    "service_name": "KAFKA",
    "state": "CRITICAL",
    "text": "Connection failed: [Errno 111] Connection refused to sandbox.hortonworks.com:6667",
    "timestamp": 1439987016669
  }
}
{
  "href": "http://localhost:8080/api/v1/clusters/Sandbox/services/KAFKA/alert_history/184",
  "AlertHistory": {
    "cluster_name": "Sandbox",
    "component_name": "KAFKA_BROKER",
    "definition_id": 1,
    "definition_name": "kafka_broker_process",
    "host_name": "sandbox.hortonworks.com",
    "id": 184,
    "instance": null,
    "label": "Kafka Broker Process",
    "service_name": "KAFKA",
    "state": "CRITICAL",
    "text": "Connection failed: [Errno 111] Connection refused to sandbox.hortonworks.com:6667",
    "timestamp": 1439989776335
  }
}
{
  "href": "http://localhost:8080/api/v1/clusters/Sandbox/services/KAFKA/alert_history/452",
  "AlertHistory": {
    "cluster_name": "Sandbox",
    "component_name": "KAFKA_BROKER",
    "definition_id": 1,
    "definition_name": "kafka_broker_process",
    "host_name": "sandbox.hortonworks.com",
    "id": 452,
    "instance": null,
    "label": "Kafka Broker Process",
    "service_name": "KAFKA",
    "state": "CRITICAL",
    "text": "Connection failed: [Errno 111] Connection refused to sandbox.hortonworks.com:6667",
    "timestamp": 1443742219799
  }
}&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Oct 2015 21:23:47 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-view-Alert-History-via-Ambari/m-p/95046#M58416</guid>
      <dc:creator>andrewg</dc:creator>
      <dc:date>2015-10-22T21:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to view Alert History via Ambari ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-view-Alert-History-via-Ambari/m-p/95047#M58417</link>
      <description>&lt;P&gt;Thanks Brandon. I used the above approach to retrieve the history of alerts for a specific type. &lt;/P&gt;&lt;P&gt;Adding a small trick for anyone using the above approach. The table "Alert_History" has the Alert Timestamp column in BigInt. For readability, use the PSQL Cast functionality. In my example, I am using the SQL to identify when Ambari triggers the DataNode WebUI alerts across all DataNodes:&lt;/P&gt;&lt;P&gt;Select TO_CHAR(TO_TIMESTAMP(Alert_Timestamp / 1000), 'MM/DD/YYYY HH24:MI:SS') From Alert_History Where Alert_Label Like '%DataNode%UI%' And Alert_State ='CRITICAL' Order By 1 ASC;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2018 15:59:46 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-view-Alert-History-via-Ambari/m-p/95047#M58417</guid>
      <dc:creator>smdas</dc:creator>
      <dc:date>2018-02-23T15:59:46Z</dc:date>
    </item>
  </channel>
</rss>

