[ https://issues.apache.org/jira/browse/AMBARI-8623?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14242156#comment-14242156 ]
Jonathan Hurley commented on AMBARI-8623: ----------------------------------------- The final format was {noformat} { "href" : "http://localhost:8080/api/v1/clusters/c1?fields=alerts_summary_hosts", "Clusters" : { "cluster_name" : "c1", "version" : "HDP-2.2" }, "alerts_summary_hosts" : { "CRITICAL" : 2, "OK" : 1, "UNKNOWN" : 0, "WARNING" : 1 } } {noformat} Where the sum of all of the values will always be the total number of hosts. In the above example, there are 2 hosts whose most severe alert is CRITICAL, there is a single host whose most severe alert is WARNING, and there is a single host with all alerts OK. > Alert Host Count Summary Exposed Via Cluster Endpoint > ----------------------------------------------------- > > Key: AMBARI-8623 > URL: https://issues.apache.org/jira/browse/AMBARI-8623 > Project: Ambari > Issue Type: Task > Components: alerts, ambari-server > Affects Versions: 2.0.0 > Reporter: Jonathan Hurley > Assignee: Jonathan Hurley > Fix For: 2.0.0 > > Attachments: AMBARI-8623.patch > > > In Ambari-1.7.0 the cluster endpoint used to have a summary of host-counts by > severity. We need such a field in Ambari-2.0.0. > {code} > alerts: { > summary: { > CRITICAL: 1, > OK: 4, > PASSIVE: 0, > WARNING: 0 > } > } > {code} > The alerts_summary structure currently returned by the 2.0.0 API are the > summary counts of alerts in the system, not those of the hosts. There are > alerts that don't have a host (such as aggregate alerts). > In order to expose the host alert count, there are two ways to do this: > 1) Add a new field to the cluster endpoint; something like > {{alerts_host_summary}} > {noformat} > http://localhost:8080/api/v1/clusters/c1?fields=alerts_host_summary > { > "href" : > "http://localhost:8080/api/v1/clusters/c1?fields=alerts_host_summary", > "Clusters" : { > "cluster_name" : "c1", > "version" : "HDP-2.2" > }, > "alerts_host_summary" : { > "CRITICAL" : 1, > "OK" : 41, > "UNKNOWN" : 0, > "WARNING" : 0 > } > } > {noformat} > 2) Provide a new formatter to display the alerts formatted by host: > {noformat} > http://localhost:8080/api/v1/clusters/c1/alerts?format=hostSummary > { > "href" : > "http://localhost:8080/api/v1/clusters/c1/alerts?format=hostSummary", > "alerts_summary" : { > "CRITICAL" : { > "count" : 1, > "original_timestamp" : 1418150735812 > }, > "OK" : { > "count" : 41, > "original_timestamp" : 1418151145325 > }, > "UNKNOWN" : { > "count" : 0, > "original_timestamp" : 0 > }, > "WARNING" : { > "count" : 0, > "original_timestamp" : 0 > } > } > } > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)