Nate Cole created AMBARI-4253:
---------------------------------
Summary: API improvements for exposing alert info
Key: AMBARI-4253
URL: https://issues.apache.org/jira/browse/AMBARI-4253
Project: Ambari
Issue Type: Task
Components: controller
Reporter: Nate Cole
Assignee: Nate Cole
Fix For: 1.5.0
Currently, alerts are exposed via the API from the Nagios Server host component.
The component returns the "nagios_alerts" attribute, which contains the alert
info for all the services and hosts.
This "nagios_alerts" object can be potentially huge depending on the number of
hosts, and the client code needs to parse and rollup the info for all alerts.
This is expensive and causes the UI to freeze every time "nagios_alerts" is
updated from the server.
Here's what the UI needs from the API:
1. Provide ability to get alerts by host
2. Provide ability to get alerts by service
3. Expose # of warn/critical alerts for the Service resource (rollup)
4. Expose # of warn/critical alerts for the Host resource (rollup)
Solution will make an alerts structure part of the services and hosts and
points. Samples:
{noformat}
GET /api/v1/clusters/c1/hosts?fields=alerts
GET /api/v1/clusters/c1/hosts?fields=alerts/summary
GET /api/v1/clusters/c1/hosts?fields=alerts/detail
GET /api/v1/clusters/c1/services?fields=alerts
GET /api/v1/clusters/c1/services?fields=alerts/summary
GET /api/v1/clusters/c1/services?fields=alerts/detail
{noformat}
Expanded sample:
{noformat}
GET /api/v1/clusters/c1/hosts?fields=alerts
{
"href" : "...",
"items" : [
{
"href" : "http://localhost:8080/api/v1/clusters/c1/hosts/h1",
"Hosts" : {
"cluster_name" : "c1",
"host_name" : "h1"
},
"alerts" : {
"summary" : {
"CRITICAL" : 2,
"OK" : 19,
"WARNING" : 0
},
"detail" : [
{
"description" : "Ambari Agent process",
"host_name" : "h1",
"last_status" : "OK",
"last_status_time" : 1389125372,
"service_name" : "AMBARI",
"status" : "OK",
"status_time" : 1389300812,
"output" : "TCP OK - 0.000 second response time on port 8670"
}, ...
]
}
},
...
}
{noformat}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)