官方网站
https://www.zabbix.com/documentation/3.4/zh/manual/api/reference/host/get
获取seesion
curl -s -X POST -H 'Content-Type:application/json' -d '
{
"jsonrpc": "2.0",
"method": "user.login",
"params": {
"user": "Admin",
"password": "zabbix"
},
"id": 1
}' http://10.0.0.7/zabbix/api_jsonrpc.php | python -mjson.tool

720b4be755d6a4ae5e456ee9792a4b05

获取hostid

curl -s -X POST -H 'Content-Type:application/json' -d '
{
"jsonrpc": "2.0",
"method": "host.get",
"params": {
"output": ["hostid"]
},
"auth": "720b4be755d6a4ae5e456ee9792a4b05",
"id": 2
}' http://10.0.0.7/zabbix/api_jsonrpc.php | python -mjson.tool