zabbix api

登陆:

curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":
"2.0","method":"user.login","params":{"user":"Admin","password":"zabbix"},"auth":
null,"id":0}' http://10.10.10.80/api_jsonrpc.php;

取值:

curl -X POST -H 'Content-Type: application/json' -d '{
"jsonrpc": "2.0",
"method": "history.get",
"params": {
"output": "extend",
"history": 0,
"itemids": "69023",
"sortfield": "clock",
"sortorder": "DESC",
"limit": 10
},
"auth": "600ba74e6e0f3e27c208e76d485e1bcc",
"id": 1
}' http://10.10.10.80/api_jsonrpc.php;

其他案例:取一段时间区间:

curl -i -X POST -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0","method":"history.get","params":{"history":0,"itemids":["24526"],"time_from":"1392789600","time_till":"1392790200","output":"extend","filter":{"clock":"1392789766"}},"auth": "a826fca79a0795ccc1224dc76329972f","id": 0}' http://x.x.x.x/api_jsonrpc.php

原文地址:https://www.cnblogs.com/alexhjl/p/15292086.html