Skip to content

Commit

Permalink
Fixing issue #1066 (#1098)
Browse files Browse the repository at this point in the history
  • Loading branch information
mageo authored Oct 6, 2023
1 parent 52943d1 commit c7e5740
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions plugins/inventory/zabbix_inventory.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#
# Copyright: (c), Ansible Project
#
# (c) 2013, Greg Buehler
# (c) 2023, Alexandre Georges
# (c) 2018, Filippo Ferrazini
# (c) 2013, Greg Buehler
# (c) 2021, Timothy Test
# Modified from ServiceNow Inventory Plugin and Zabbix inventory Script
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
Expand Down Expand Up @@ -445,7 +446,16 @@ def parse(self, inventory, loader, path,

# organize inventory by zabbix groups
if self.get_option('add_zabbix_groups'):
content = self._zapi.host.get({'selectGroups': ['name']})

response = self.api_request(
'host.get',
{
'selectGroups': ['name']
}
)
res = json.load(response)
content = res['result']

for record in content:
host_name = record['host']
if len(record['groups']) >= 1:
Expand Down

0 comments on commit c7e5740

Please sign in to comment.