forked from AlekSi/zabbix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhistory.go
30 lines (26 loc) · 994 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
package zabbix
import "github.com/AlekSi/reflector"
// https://www.zabbix.com/documentation/2.0/manual/appendix/api/history/definitions
type History struct {
ItemId string `json:"itemid,omitempty"`
Clock int `json:"clock"`
Value string `json:"value"`
Nanoseconds int `json:"ns,omitempty"`
Id string `json:"id,omitempty"`
LogEventId int `json:"logeventid,omitempty"`
Severity int `json:"severity,omitempty"`
Source string `json:"source,omitempty"`
TimeStamp int `json:"timestamp,omitempty"`
}
// Wrapper for item.get https://www.zabbix.com/documentation/2.0/manual/appendix/api/item/get
func (api *API) HistoriesGet(params Params) (res []History, 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
}