如何使用主机名获取主机 ID?扎比克斯
How to get host id with host's name? Zabbix
有房东的名字,想用名字得到他们的ID。有主机名列表。尝试
for host in list_regexed_hosts_names:
ids = z.do_request(method="host.get", params={
"output": ["hostid"],
"filter": {
"host": host
}
})
但是 id 不起作用
根据Python,您的请求方法似乎不正确zabbix api and host is expecting an array. So instead of looping each host you can directly give it as array. You can look at the zabbix documentation了解更多详情
假设 list_regexed_hosts_names 是一个包含主机名的数组或列表。
ids = z.do_request('host.get',
{
'output' : ['hostid'],
'filter' : { 'host': list_regexed_hosts_names}
}
)
有房东的名字,想用名字得到他们的ID。有主机名列表。尝试
for host in list_regexed_hosts_names:
ids = z.do_request(method="host.get", params={
"output": ["hostid"],
"filter": {
"host": host
}
})
但是 id 不起作用
根据Python,您的请求方法似乎不正确zabbix api and host is expecting an array. So instead of looping each host you can directly give it as array. You can look at the zabbix documentation了解更多详情
假设 list_regexed_hosts_names 是一个包含主机名的数组或列表。
ids = z.do_request('host.get',
{
'output' : ['hostid'],
'filter' : { 'host': list_regexed_hosts_names}
}
)