具有以下功能。但是出现错误..有什么想法吗?
def zabbix_discovery(pingdom_data):
discovery = []
for k,v in data["recipes"].items():
discovery.append(
{"{#NAME}": str(v['name'])}
)
cmd_args = [
'zabbix_sender',
'-z', config.get('ZABBIX', 'server'),
'-p', config.get('ZABBIX', 'port'),
'-s', config.get('ZABBIX', 'host'),
'-k', config.get('ZABBIX', 'key1'),
'-o', "'{ \"data\": " + discovery + " }'"
]
zabbix_trapper(cmd_args)
=====
Traceback (most recent call last):
File "txncheck_backup.py", line 52, in <module>
'-o', "'{ \"data\": " + discovery + " }'"
NameError: name 'discovery' is not defined
=====