Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use session.GetHosts #18

Open
modogo2000 opened this issue Oct 25, 2018 · 1 comment
Open

Use session.GetHosts #18

modogo2000 opened this issue Oct 25, 2018 · 1 comment

Comments

@modogo2000
Copy link

Hello

Is it possible to have an example on how use GetHostt ?

I have hard time to use it.

Best regards

@fabiang
Copy link
Contributor

fabiang commented Dec 13, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants