From 8a92c4978a383b5c9e3858bcf6ab669aaa89c2d4 Mon Sep 17 00:00:00 2001 From: Akihiko Horiuchi <12ff5b8@gmail.com> Date: Tue, 1 Sep 2015 15:39:49 +0900 Subject: [PATCH] add latest command to aggregates [check] --- ohgi/aggregates.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ohgi/aggregates.go b/ohgi/aggregates.go index 25dd6d6..1b91ccf 100644 --- a/ohgi/aggregates.go +++ b/ohgi/aggregates.go @@ -55,6 +55,16 @@ func DeleteAggregatesCheck(api *sensu.API, check string) string { func GetAggregatesCheckIssued(api *sensu.API, check string, issued string, results bool) string { var print []byte + if issued == "latest" { + issues, err := api.GetAggregatesCheck(check, -1) + checkError(err) + + if len(issues) == 0 { + return "No aggregates\n" + } + issued = strconv.FormatInt(issues[0], 10) + } + i, err := strconv.ParseInt(issued, 10, 64) checkError(err)