From c2c9898d683ff7983518af94338f81285848ee2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristi=20V=C3=AEjdea?= Date: Thu, 5 Oct 2017 21:02:13 +0000 Subject: [PATCH] fix component status parsing The Cachet API returns component status as a string, but cachet-monitor attempts to parse it as int, resulting in "cannot unmarshal string into Go value of type int". This applies at least as early as cachet 2.3.12 - 29/06/2017. --- incident.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/incident.go b/incident.go index 1949bf5..597e84f 100644 --- a/incident.go +++ b/incident.go @@ -82,7 +82,7 @@ func (incident *Incident) GetComponentStatus(cfg *CachetMonitor) (int, error) { } var data struct { - Status int `json:"status"` + Status int `json:"status,string"` } if err := json.Unmarshal(body.Data, &data); err != nil { return 0, fmt.Errorf("Cannot parse component body: %v. Err = %v", string(body.Data), err)