简体   繁体   中英

Python - Pyzabbix Output Format

I'm learning Python as i need to interact with Pyzabbix. So, in the following output i just needed the last field, but i cant find a way to do this:

**EXAMPLE_HOSTNAME

{u'triggerid': u'8119464', u'description': u'Agent Zabbix unreacheable for 1 minutes'}**

And the script is:

!/usr/bin/python -*- coding: iso-8859-1 -*- from pyzabbix import ZabbixAPI import sys,csv from url='http://xxx.xxx.xxx.xxx/zabbix' zh = ZabbixAPI(url) zh.login(user="Admin",password="XXXXXX") hostname = sys.argv[1] triggers = zh.trigger.get(filter={"host": [hostname]}, active="1", output=['description']) print hostname for a in triggers: print a

I appreciate any help. Thank you !

说明字段:

print a['description']

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM