feat(alerting): add api route for alert changes

This commit is contained in:
bergquist
2016-04-27 08:59:33 +02:00
parent 2e097f4af1
commit 973db1ac38
7 changed files with 76 additions and 39 deletions
+13
View File
@@ -21,6 +21,19 @@ func ValidateOrgAlert(c *middleware.Context) {
}
}
// GET /api/alert_rule
func GetAlertChanges(c *middleware.Context) Response {
query := models.GetAlertChangesQuery{
OrgId: c.OrgId,
}
if err := bus.Dispatch(&query); err != nil {
return ApiError(500, "List alerts failed", err)
}
return Json(200, query.Result)
}
// GET /api/alert_rule
func GetAlerts(c *middleware.Context) Response {
query := models.GetAlertsQuery{
+1
View File
@@ -237,6 +237,7 @@ func Register(r *macaron.Macaron) {
r.Get("/metrics/test", GetTestMetrics)
r.Group("/alert_rule", func() {
r.Get("/changes", wrap(GetAlertChanges))
r.Get("/", wrap(GetAlerts))
r.Get("/:id", ValidateOrgAlert, wrap(GetAlert))
})