[ 
https://issues.apache.org/jira/browse/AMBARI-8237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14203927#comment-14203927
 ] 

Jonathan Hurley commented on AMBARI-8237:
-----------------------------------------

The Ambari API already has a model to model in cases like this. We use a 
"renderer" which is a value that instructs the API engine to format the results 
of a query in a particular fashion. With this, we can query the alerts endpoint 
and format it for a summary output. This includes formatting for alerts by 
name, host, and other supported combinations.

{code}
{
  "href" : "http://localhost:8080/api/v1/clusters/c1/alerts?format=summary";,
  "alerts_summary" : {
    "CRITICAL" : {
      "count" : 3,
      "original_timestamp" : 1415372828182
    },
    "OK" : {
      "count" : 37,
      "original_timestamp" : 1415375364937
    },
    "UNKNOWN" : {
      "count" : 1,
      "original_timestamp" : 1415372632261
    },
    "WARN" : {
      "count" : 0,
      "original_timestamp" : 0
    }
  }
}
{code}

or

{code}
{
  "href" : 
"http://localhost:8080/api/v1/clusters/c1/alerts?Alert/name=datanode_process&format=summary";,
  "alerts_summary" : {
    "CRITICAL" : {
      "count" : 0,
      "original_timestamp" : 0
    },
    "OK" : {
      "count" : 1,
      "original_timestamp" : 1415372992337
    },
    "UNKNOWN" : {
      "count" : 0,
      "original_timestamp" : 0
    },
    "WARN" : {
      "count" : 0,
      "original_timestamp" : 0
    }
  }
}
{code}

or

{code}
{
  "href" : 
"http://localhost:8080/api/v1/clusters/c1/alerts?Alert/name=datanode_process&Alert/host_name=c6401.ambari.apache.org&format=summary";,
  "alerts_summary" : {
    "CRITICAL" : {
      "count" : 0,
      "original_timestamp" : 0
    },
    "OK" : {
      "count" : 1,
      "original_timestamp" : 1415372992337
    },
    "UNKNOWN" : {
      "count" : 0,
      "original_timestamp" : 0
    },
    "WARN" : {
      "count" : 0,
      "original_timestamp" : 0
    }
  }
}
{code}


> Alerts: Provide Summary Structure On Alerts Endpoint
> ----------------------------------------------------
>
>                 Key: AMBARI-8237
>                 URL: https://issues.apache.org/jira/browse/AMBARI-8237
>             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
>
>
> In the alert definitions summary page we show all the definitions along with 
> counts of how many are OK, WARN, ERROR, etc. We need the alert instance 
> counts rolled up into the alert definition response on cluster. This will 
> save UI from getting all instances and then determining counts.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to