Hello,
I'm using the zabbix python api to retreive some information from the database.
How can I get the hostid converted to the hostname?
items=zapi.item.get(output=['hostid', 'lastvalue', 'name', 'key_'],search={'key_':'vfs.fs.size'},groupids='4')
my output:
{u'itemid': u'24084', u'lastvalue': u'8149250048', u'hostid': u'10084', u'key_': u'vfs.fs.size[/,free]', u'name': u'Free disk space on $1'}
{u'itemid': u'24085', u'lastvalue': u'20.9099', u'hostid': u'10084', u'key_': u'vfs.fs.size[/,pfree]', u'name': u'Free disk space on $1 (percentage)'}
{u'itemid': u'24086', u'lastvalue': u'41083600896', u'hostid': u'10084', u'key_': u'vfs.fs.size[/,total]', u'name': u'Total disk space on $1'}
{u'itemid': u'24087', u'lastvalue': u'30823829504', u'hostid': u'10084', u'key_': u'vfs.fs.size[/,used]', u'name': u'Used disk space on $1'}
{u'itemid': u'42084', u'lastvalue': u'8149250048', u'hostid': u'10515', u'key_': u'vfs.fs.size[/,free]', u'name': u'Free disk space on $1'}
{u'itemid': u'42085', u'lastvalue': u'20.9099', u'hostid': u'10515', u'key_': u'vfs.fs.size[/,pfree]', u'name': u'Free disk space on $1 (percentage)'}
{u'itemid': u'42080', u'lastvalue': u'0', u'hostid': u'10515', u'key_': u'vfs.fs.size[/,pused]', u'name': u'Used disk space on $1 in %'}
{u'itemid': u'42086', u'lastvalue': u'41083600896', u'hostid': u'10515', u'key_': u'vfs.fs.size[/,total]', u'name': u'Total disk space on $1'}
{u'itemid': u'42087', u'lastvalue': u'30823833600', u'hostid': u'10515', u'key_': u'vfs.fs.size[/,used]', u'name': u'Used disk space on $1'}
I have multiple hosts in my groups.
Can anyone help me with this.
Rgds,
John
I'm using the zabbix python api to retreive some information from the database.
How can I get the hostid converted to the hostname?
items=zapi.item.get(output=['hostid', 'lastvalue', 'name', 'key_'],search={'key_':'vfs.fs.size'},groupids='4')
my output:
{u'itemid': u'24084', u'lastvalue': u'8149250048', u'hostid': u'10084', u'key_': u'vfs.fs.size[/,free]', u'name': u'Free disk space on $1'}
{u'itemid': u'24085', u'lastvalue': u'20.9099', u'hostid': u'10084', u'key_': u'vfs.fs.size[/,pfree]', u'name': u'Free disk space on $1 (percentage)'}
{u'itemid': u'24086', u'lastvalue': u'41083600896', u'hostid': u'10084', u'key_': u'vfs.fs.size[/,total]', u'name': u'Total disk space on $1'}
{u'itemid': u'24087', u'lastvalue': u'30823829504', u'hostid': u'10084', u'key_': u'vfs.fs.size[/,used]', u'name': u'Used disk space on $1'}
{u'itemid': u'42084', u'lastvalue': u'8149250048', u'hostid': u'10515', u'key_': u'vfs.fs.size[/,free]', u'name': u'Free disk space on $1'}
{u'itemid': u'42085', u'lastvalue': u'20.9099', u'hostid': u'10515', u'key_': u'vfs.fs.size[/,pfree]', u'name': u'Free disk space on $1 (percentage)'}
{u'itemid': u'42080', u'lastvalue': u'0', u'hostid': u'10515', u'key_': u'vfs.fs.size[/,pused]', u'name': u'Used disk space on $1 in %'}
{u'itemid': u'42086', u'lastvalue': u'41083600896', u'hostid': u'10515', u'key_': u'vfs.fs.size[/,total]', u'name': u'Total disk space on $1'}
{u'itemid': u'42087', u'lastvalue': u'30823833600', u'hostid': u'10515', u'key_': u'vfs.fs.size[/,used]', u'name': u'Used disk space on $1'}
I have multiple hosts in my groups.
Can anyone help me with this.
Rgds,
John