Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing issue #1066 #1098

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading