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
返回值
e0d717af31c72fd9c68c3266b6710705
创建主机
curl -s -X POST -H 'Content-Type:application/json' -d '
{
"jsonrpc": "2.0",
"method": "host.create",
"params": {
"host": "slaver.test.com",
"interfaces": [
{
"type": 1,
"main": 1,
"useip": 1,
"ip": "10.0.0.8",
"dns": "",
"port": "10050"
}
],
"groups": [
{
"groupid": "2"
}
],
"templates": [
{
"templateid": "10001"
}
]
},
"auth": "e0d717af31c72fd9c68c3266b6710705",
"id": 1
}' http://10.0.0.7/zabbix/api_jsonrpc.php | python -mjson.tool