Hi there,
I'm doing below api call to Zabbix 2.0.1 using zbxapi.rb lib. And it works perfectly
I get all items with name matching my pattern.
However, I was trying to narrow down this, to query only for hosts matching some pattern. API doc says that "search" is an array.
So I've changed the "search" to be an array:
And that didn't work. Well it didn't produce any errors, but just stopped doing ANY filtering at all. Basically just returned all items that are there for all servers.
Looks like am bumped into a wall with this one. Can't find a solution in the documentation/google.
If anyone can point me in the right direction, I would really appreciate it.
Thanks!
Stan
I'm doing below api call to Zabbix 2.0.1 using zbxapi.rb lib. And it works perfectly

I get all items with name matching my pattern.
#!/bin/env ruby
require 'zbxapi'
zbx_url="http://localhost/zabbix"
server = ZabbixAPI.new(zbx_url)
server.login('admin','zabbix')
params = {
"output"=> "extend",
"search"=> {"name"=> "myItemPatternToSearch"}
}
result = server.raw_api("item.get",params)
puts result
require 'zbxapi'
zbx_url="http://localhost/zabbix"
server = ZabbixAPI.new(zbx_url)
server.login('admin','zabbix')
params = {
"output"=> "extend",
"search"=> {"name"=> "myItemPatternToSearch"}
}
result = server.raw_api("item.get",params)
puts result
However, I was trying to narrow down this, to query only for hosts matching some pattern. API doc says that "search" is an array.
So I've changed the "search" to be an array:
params = {
"output"=> "extend",
"search"=> [{"name"=> "myItemPatternToSearch"}, {"host"=> "myHOSTPatternToSearch"}]
}
"output"=> "extend",
"search"=> [{"name"=> "myItemPatternToSearch"}, {"host"=> "myHOSTPatternToSearch"}]
}
Looks like am bumped into a wall with this one. Can't find a solution in the documentation/google.
If anyone can point me in the right direction, I would really appreciate it.
Thanks!
Stan
Comment