forked from AlekSi/zabbix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhistory.go
33 lines (27 loc) · 1008 Bytes
/
history.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package zabbix
import "github.com/AlekSi/reflector"
// https://www.zabbix.com/documentation/2.4/manual/api/reference/history/object
type History struct {
Clock uint `json:"clock"`
ItemId string `json:"itemid"`
Ns int `json:"ns"`
Value string `json:"value"` // Currently always returns strings
Id string `json:"id,omitempty"`
LogEventId int `json:"logeventid,omitempty"`
Severity int `json:"severity,omitempty"`
Source string `json:"source,omitempty"`
Timestamp uint `json:"timestamp,omitempty"`
}
type Histories []History
// Wrapper for item.get https://www.zabbix.com/documentation/2.0/manual/appendix/api/item/get
func (api *API) HistoriesGet(params Params) (res Histories, err error) {
if _, present := params["output"]; !present {
params["output"] = "extend"
}
response, err := api.CallWithError("history.get", params)
if err != nil {
return
}
reflector.MapsToStructs2(response.Result.([]interface{}), &res, reflector.Strconv, "json")
return
}