zabbix批量更新主机关联模板

it2024-04-16  47

zabbix api 模块方法 template.update

import requests import json url="http://10.0.18.245/api_jsonrpc.php" headers={"Content-Type":"application/json-rpc"} n="" for i in range(10381,10389): n=i + 1 a=int(n) print(a) data = { "jsonrpc" : "2.0", "method" : "host.update", "params" : { "hostid" : a, "templates" : [ { "templateid" : "10001" }, { "templateid" : "10319" } ] }, "auth" : "a7ed4f4b0d01e4813eb4d8bc27c4ba2f", "id" : a } r = requests.post(url,data = json.dumps(data),headers=headers) print(r.json())
最新回复(0)