Example #1
0
// Wrapper for host.get: https://www.zabbix.com/documentation/2.0/manual/appendix/api/host/get
func (api *API) HostsGet(params Params) (res Hosts, err error) {
	if _, present := params["output"]; !present {
		params["output"] = "extend"
	}
	response, err := api.CallWithError("host.get", params)
	if err != nil {
		return
	}

	reflector.MapsToStructs2(response.Result.([]interface{}), &res, reflector.Strconv, "json")
	return
}
Example #2
0
func (api *API) HistoryGet(params Params) (res HistoryItems, err error) {
	if _, present := params["output"]; !present {
		params["output"] = "extend"
	}
	if _, presentl := params["limit"]; !presentl {
		params["limit"] = "100"
	}
	if _, presenth := params["history"]; !presenth {
		params["history"] = "0"
	}
	response, err := api.CallWithError("history.get", params)
	if err != nil {
		return
	}
	//fmt.Println(response.Result)

	reflector.MapsToStructs2(response.Result.([]interface{}), &res, reflector.Strconv, "json")
	return
}