Ad Widget

Collapse

Zabbix API 1.8 -> get method filter does not make any sense

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • s12k34
    Junior Member
    • Jan 2011
    • 13

    #1

    Zabbix API 1.8 -> get method filter does not make any sense

    filter and search parameter does not make any sense in all get methods in Zabbix server 1.8.1, Zabbix API 1.1.(host.get, template.get, hostgroup.get, item.get ...etc)
    I think this is a bug and maybe solved in upper version.
    Have you any idea about solution? (For example do I need upgrade version of API or anything else...)
    Thanks...

    Code:
    {
    "jsonrpc":"2.0",
    "method":"host.get",
    "params":{
        "output":"extend",
    	"filter":{
            		"ip":"192.171.44.145"
            }
        },
    "auth":"6cbe0ddab3e9095877d11507d3fdb4af",
    "id":1
    }
    Result list contains all the hosts. I want only one host that has ip "192.171.44.145".

    Code:
    {"jsonrpc":"2.0","result":[
    {"hostid":"10761","proxy_hostid":"0","host":"192.171.44.145","dns":"","useip":"1","ip":"192.171.44.145",...},
    {"hostid":"10760","proxy_hostid":"0","host":"192.171.44.144","dns":"","useip":"1","ip":"192.171.44.144",...},
    {"hostid":"10759","proxy_hostid":"0","host":"192.171.44.143","dns":"","useip":"1","ip":"192.171.44.143",...},
    {"hostid":"10758","proxy_hostid":"0","host":"192.171.44.142","dns":"","useip":"1","ip":"192.171.44.142",...},
    ........
    ........
    ........
    ],"id":1}
    Last edited by s12k34; 01-02-2011, 13:19. Reason: mistake in text
  • s12k34
    Junior Member
    • Jan 2011
    • 13

    #2
    Ok, I recognized that Zabbix API version 1.1 is not supported filter for ip.
    In zabbix/api/classes/class.chost.php option array does not contains filter option for version 1.1.(Zabbix API 1.4 is suport this feature)
    So using fiter or search has no meaning for thi version...
    In class.chost.php line 110 filter option is like this. This means you can only use pattern or extend_pattern for filter
    Code:
    .......
    // filter
                            'pattern'                                       => '',
                            'extend_pattern'                        => null,
    .......

    Comment

    Working...