Uploaded image for project: 'ZABBIX FEATURE REQUESTS'
  1. ZABBIX FEATURE REQUESTS
  2. ZBXNEXT-10063

Support recursive host group filtering in host.get via groupid

XMLWordPrintable

    • Icon: New Feature Request New Feature Request
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • 6.0.40, 7.0.13
    • None
    • None

      The API should optionally include hosts from subgroups (e.g. "parent/dependent") when querying a top-level group (e.g. parent)

      In frontend displaying hosts from parent group works fine and returns all hosts belonging to parent group (check parent-group.png)

      However retrieving via API doesn't work that way:

      for query:

      {
        "jsonrpc": "2.0",
        "method": "host.get",
        "params": {
          "output": ["hostid", "host", "name"],
          "groupids": "20",
          "selectGroups": ["groupid", "name"]
        },
        "auth": "token",
        "id": 1
      }

      I'm getting just direct member of this group (1 host):

      {
          "jsonrpc": "2.0",
          "result": [
              {
                  "hostid": "10643",
                  "host": "test-top",
                  "name": "test-top",
                  "groups": [
                      {
                          "groupid": "20",
                          "name": "parent"
                      }
                  ]
              }
          ],
          "id": 1
      } 

      While getting nested group:

      {
        "jsonrpc": "2.0",
        "method": "host.get",
        "params": {
          "output": ["hostid", "host", "name"],
          "groupids": "21",
          "selectGroups": ["groupid", "name"]
        },
        "auth": "token",
        "id": 1
      } 

      Im getting the group members:

      {
          "jsonrpc": "2.0",
          "result": [
              {
                  "hostid": "10644",
                  "host": "test1",
                  "name": "test1",
                  "groups": [
                      {
                          "groupid": "21",
                          "name": "parent/dependent"
                      }
                  ]
              },
              {
                  "hostid": "10645",
                  "host": "test2",
                  "name": "test2",
                  "groups": [
                      {
                          "groupid": "21",
                          "name": "parent/dependent"
                      }
                  ]
              },
              {
                  "hostid": "10646",
                  "host": "test3",
                  "name": "test3",
                  "groups": [
                      {
                          "groupid": "21",
                          "name": "parent/dependent"
                      }
                  ]
              }
          ],
          "id": 1
      } 

       

      While expected behaviour would be similar like in frontend:

      • when retrieving the parent group via group id, I'd like to get the group members and sub-group members of it.

      Originally reported in: ZBX-26553

        1. parent-group.png
          parent-group.png
          209 kB
        2. child-group.png
          child-group.png
          198 kB
        3. groups.png
          groups.png
          29 kB

            zabbix.dev Zabbix Development Team
            pzakrzewski Piotr Zakrzewski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: