mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-29 08:01:24 -07:00
Merge pull request #9527 from UnderGreen/devel
Delete import json. Several syntax changes.
This commit is contained in:
commit
7812c70d3b
1 changed files with 3 additions and 4 deletions
|
@ -20,7 +20,7 @@
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Zabbix Server external inventory script.
|
Zabbix Server external inventory script.
|
||||||
========================================
|
========================================
|
||||||
|
|
||||||
Returns hosts and hostgroups from Zabbix Server.
|
Returns hosts and hostgroups from Zabbix Server.
|
||||||
|
@ -31,7 +31,6 @@ Tested with Zabbix Server 2.0.6.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os, sys
|
import os, sys
|
||||||
import json
|
|
||||||
import argparse
|
import argparse
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
|
|
||||||
|
@ -55,7 +54,7 @@ class ZabbixInventory(object):
|
||||||
if config.has_option('zabbix', 'server'):
|
if config.has_option('zabbix', 'server'):
|
||||||
self.zabbix_server = config.get('zabbix', 'server')
|
self.zabbix_server = config.get('zabbix', 'server')
|
||||||
|
|
||||||
# login
|
# login
|
||||||
if config.has_option('zabbix', 'username'):
|
if config.has_option('zabbix', 'username'):
|
||||||
self.zabbix_username = config.get('zabbix', 'username')
|
self.zabbix_username = config.get('zabbix', 'username')
|
||||||
if config.has_option('zabbix', 'password'):
|
if config.has_option('zabbix', 'password'):
|
||||||
|
@ -84,7 +83,7 @@ class ZabbixInventory(object):
|
||||||
|
|
||||||
for host in hostsData:
|
for host in hostsData:
|
||||||
hostname = host['name']
|
hostname = host['name']
|
||||||
data[self.defaultgroup]['hosts'].append(hostname)
|
data[self.defaultgroup]['hosts'].append(hostname)
|
||||||
|
|
||||||
for group in host['groups']:
|
for group in host['groups']:
|
||||||
groupname = group['name']
|
groupname = group['name']
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue