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

GetHost inventory_mode type error #57

Open
zhaojinxin409 opened this issue Jun 26, 2024 · 1 comment
Open

GetHost inventory_mode type error #57

zhaojinxin409 opened this issue Jun 26, 2024 · 1 comment

Comments

@zhaojinxin409
Copy link

Calling GetHost always error: Error decoding JSON response body: json: cannot unmarshal string into Go struct field Host.inventory_mode of type int

MyCode

hosts, err := session.GetHosts(zabbix.HostGetParams{
		GetParameters: zabbix.GetParameters{
			ResultLimit: 10,
		},
	})
	fmt.Println(hosts, err)

Output:

[] Error decoding JSON response body: json: cannot unmarshal string into Go struct field Host.inventory_mode of type int

Reason

I found that even though the Host Object's inventory_mode is int, but the response of zabbix convert it into string of integer, like :

  {
      "jsonrpc": "2.0",
      "result": [
            {
                 "inventory_mode": "-1"
             }
  }
@zhaojinxin409
Copy link
Author

May be the inventory field should be string?

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

1 participant