Ad Widget

Collapse

API not returning all hostgroups

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • norrisemoe
    Junior Member
    • Dec 2016
    • 10

    #1

    API not returning all hostgroups

    Hi All,

    Strange issue I am having a problem with my Zabbix API, the following code I believe should return all hostgroups:

    ZabbixAPI.hostgroup.get()

    This is part of the pyzabbix API from here: https://github.com/lukecyca/pyzabbix

    I am finding that it is not returning any hostgroups I am adding above groupid 161.

    ZabbixAPI.login(apiadmin,**********)
    Call user.login method
    urllib2.Request(https://zabbix.wifinity.com/api_jsonrpc.php, {"params": {"password": "**********", "user": "apiadmin"}, "jsonrpc": "2.0", "method": "user.login", "id": "1"})
    Response Body: {
    "jsonrpc": "2.0",
    "result": "xxxxxxxxxxxxxxxxxxxxxx",
    "id": "1"
    }

    JSON-PRC Server: https://zabbix.wifinity.com/api_jsonrpc.php

    Call hostgroup.get method
    urllib2.Request(https://zabbix.wifinity.com/api_jsonrpc.php, {"params": {}, "jsonrpc": "2.0", "method": "hostgroup.get", "auth": "xxxxxxxxxxxxxxxxxxxxxx", "id": "1"})
    Response Body: {
    "jsonrpc": "2.0",
    "result": [
    {
    "internal": "0",
    "flags": "0",
    "groupid": "4",
    "name": "Zabbix servers"
    },

    etc.. but never reaches any groupids beyond 160.

    Is this a known error?
  • norrisemoe
    Junior Member
    • Dec 2016
    • 10

    #2
    Losing Hope

    Hi all,

    To work around this problem I have changed my query, it is actually far more efficient but it does worry me that the API is not working as expected in this case.

    Any answers would be appreciated.

    Comment

    • norrisemoe
      Junior Member
      • Dec 2016
      • 10

      #3
      Answered by a kind reddit user

      A kind reddit user gave an obvious answer:

      Perhaps you don't have permissions to the missing host groups?

      Thanks Alexvl and to everyone out there having this problem, go check your permissions.

      Comment

      • safpsr
        Member
        • Aug 2007
        • 70

        #4
        All groups access

        Is there a way to define an API user who can acces to "All groups" in read access without manual action when a new group is defined ?

        Thanks

        Comment

        Working...