Ad Widget

Collapse

Zabbix API 1.3-> host.get method result

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

    #1

    Zabbix API 1.3-> host.get method result

    Hi,
    I downloaded the lastest version of Zabbix 1.9.1 and it has version 1.3 api.
    When I execute the method that shown in like;
    Code:
    {
    "jsonrpc":"2.0",
    "method":"host.get",
    "params":{
    	"output":"extend",
    	"filter":{
    		"ip":["192.18.12.130","192.18.12.128"]
            }
        },
    "auth":"c74d89dd173f0be3bacd7f15ecf6d743",
    "id":1
    }
    I got the result like this;
    Code:
    {"jsonrpc":"2.0","result":[{"maintenances":[],"hostid":"10049","proxy_hostid":0,"host":"host1","status":"0","disable_until":"0",
    "error":"","available":"0","errors_from":"0","lastaccess":"0","ipmi_authtype":"-1","ipmi_privilege":"2","ipmi_username":"","ipmi_password":"",
    "ipmi_disable_until":"0","ipmi_available":"0","snmp_disable_until":"0","snmp_available":"0","maintenanceid":0,"maintenance_status":"0",
    "maintenance_type":"0","maintenance_from":"0","ipmi_errors_from":"0","snmp_errors_from":"0","ipmi_error":"","snmp_error":""},
    {"maintenances":[],"hostid":"10050","proxy_hostid":0,"host":"host2","status":"0","disable_until":"0","error":"",
    "available":"0","errors_from":"0","lastaccess":"0","ipmi_authtype":"-1","ipmi_privilege":"2","ipmi_username":"","ipmi_password":"",
    "ipmi_disable_until":"0","ipmi_available":"0","snmp_disable_until":"0","snmp_available":"0","maintenanceid":0,"maintenance_status":"0",
    "maintenance_type":"0","maintenance_from":"0","ipmi_errors_from":"0","snmp_errors_from":"0","ipmi_error":"","snmp_error":""}],"id":1}
    As you see in above there is no ip information in result list.
    How can I know which result element is about which searched ip?
    In Zabbix 1.8.1 we had problem about filter option and we installed the version 1.9.1.
    Filter option is worked in this version but result is not good.
    Zabbix API really makes me crazy. It is not working correcly and its documentation is different from the implemented source. Is it a joke?
    http://www.zabbix.com/documentation/...x/api/host/get
    In documentation it is written ip in result but it is not in there...

    And finally I write some question before and noone answered, what for this forum?
  • nelsonab
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2006
    • 1233

    #2
    The API by default only shows a small subset, if you want the full output you need to use output:extend. However this gives you every field, there is no easy way to select only individual fiends to be sent back at this moment.

    I can appreciate your frustration with the API. If you have not been already I suggest you make comments when you spot things missing. Myself or someone else will come back later and add it to the documentation when we have time.

    As for the filter issues, I'm glad to hear it's working in 1.9, I was wondering if it was a bug but didn't have the time to track it down. As for asking questions, well there are only a few people who make use of the API and often times our first though is to reference the docs, so if the docs are missing, I encourage you to do as suggested above, make some helpful comments about it on the documentation pages.
    RHCE, author of zbxapi
    Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
    Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

    Comment

    • s12k34
      Junior Member
      • Jan 2011
      • 13

      #3
      Thank you for reply.
      As you see in my post, output: extend is used in query.
      In early version of API 1.1 host.get returns ip of the host but in version 1.3 api does not returns ip of host.
      So ip field is major field for api user because the third person has no idea about host name or host id. But ip is general information for everybody.
      If we want to query a list of ip, the result list has no meaning because we cannot match the query host and result.
      As I said that when we want to build someting we lose other things and this is really bad thing for user. we installed new version to get rid of filter problem we met new problem about result.

      Comment

      • nelsonab
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2006
        • 1233

        #4
        You might want to comment on this ticket.



        My guess is that a change log would have been useful to you. :-)
        RHCE, author of zbxapi
        Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
        Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

        Comment

        • Aly
          ZABBIX developer
          • May 2007
          • 1126

          #5
          Originally posted by s12k34
          Thank you for reply.
          As you see in my post, output: extend is used in query.
          In early version of API 1.1 host.get returns ip of the host but in version 1.3 api does not returns ip of host.
          So ip field is major field for api user because the third person has no idea about host name or host id. But ip is general information for everybody.
          If we want to query a list of ip, the result list has no meaning because we cannot match the query host and result.
          As I said that when we want to build someting we lose other things and this is really bad thing for user. we installed new version to get rid of filter problem we met new problem about result.
          I agree that API documentation is currently weak, we are working on that.
          Some tips to easier your work with API:
          1. Many improvements were made in 1.8.3, and unsupported in previous versions.
          2. Get API from ZABBIX 1.8.4 (most close to the docs)
          3. Trunk supports multiple interfaces, so ip field moved from host object to object interface. Docs update is on the way.
          Zabbix | ex GUI developer

          Comment

          Working...