Use session.GetHosts
modogo2000 opened this issue · 1 comments
modogo2000 commented
Hello
Is it possible to have an example on how use GetHostt ?
I have hard time to use it.
Best regards
fabiang commented
Get a list of hosts by their hostname:
// ...
filter := make(map[string]interface{})
filter["host"] = "MyComputerName"
hosts, err := session.GetHosts(zabbix.HostGetParams{
GetParameters: zabbix.GetParameters{
Filter: filter,
}})
if err != nil {
log.Fatalf("%v\n", err)
}
log.Printf("%v\n", hosts)
Of cause hostname should be unique and the list only contain on element.