Hi! I'm new to Zabbix and am trying to get it to play nice with my existing python infrastructure. Using the pyzabbix module written by luckecyca, I am attempting to get host information from my zabbix server.
However, in the simplest case, I cannot get the api to give me details about the hosts, only hostid. Same for hostgroup, only groupid. What I do is this:
Output is as follows:
These are very small json snippets. I cannot access any of the other parameters of the host or hostgroup objects.
Am I missing something fundamental here? Do I need to be using a different API tool in python to access Zabbix 2.2?
Thank you in advance.
However, in the simplest case, I cannot get the api to give me details about the hosts, only hostid. Same for hostgroup, only groupid. What I do is this:
Code:
#!/usr/bin/python -u
from pyzabbix import ZabbixAPI
zapi = ZabbixAPI("http://1.2.3.4/zabbix")
zapi.login("user", "passwd")
print "Connected to Zabbix API Version %s" % zapi.api_version()
for h in zapi.host.get(extendoutput=True):
print h
for hg in zapi.hostgroup.get(extendoutput=True):
print hg
Code:
u'hostid': u'10105'}
{u'hostid': u'10106'}
{u'hostid': u'10107'}
{u'hostid': u'10084'}
{u'groupid': u'9'}
{u'groupid': u'8'}
{u'groupid': u'5'}
{u'groupid': u'7'}
{u'groupid': u'2'}
{u'groupid': u'1'}
{u'groupid': u'6'}
{u'groupid': u'4'}
Am I missing something fundamental here? Do I need to be using a different API tool in python to access Zabbix 2.2?
Thank you in advance.
Comment