func GetHostSnmpInterface(api *zabbix.API, hostid string) ([]zabbix.HostInterface, error) { params := make(map[string]interface{}, 0) params["hostids"] = hostid filter := make(map[string]string, 0) filter["type"] = "2" params["filter"] = filter ret, err := api.Interface("get", params) return ret, err }
func CreateHostSnmpInterface(api *zabbix.API, hostid, ip string) { params := make(map[string]interface{}, 0) params["hostid"] = hostid params["dns"] = "" params["ip"] = ip params["main"] = "1" params["port"] = "161" params["type"] = "2" params["useip"] = "1" _, err := api.Interface("create", params) if err != nil { fmt.Println(err) return } fmt.Println("Create the interface successful") }