zabbix-api 创建主机 删除主机
curl -s -X POST -H 'Content-Type:application/json' -d '{"jsonrpc": "2.0","method": "user.login","params": {"user": "admin","password": "o2o@bsdka4%47d" },
"id": 1
}
' http://192.168.1.77/zabbix/api_jsonrpc.php|python -mjson.tool
c420a53318369184c9a6e00d439342fb
curl -s -X POST -H 'Content-Type:application/json' -d '{
"jsonrpc": "2.0",
"method": "host.get",
"params": {
"output": ["host"]
},
"auth": "c420a53318369184c9a6e00d439342fb",
"id": 1
}' http://192.168.60.217/zabbix/api_jsonrpc.php|python -mjson.tool
curl -s -X POST -H 'Content-Type:application/json' -d '{
"jsonrpc": "2.0",
"method": "host.create",
"params": {
"host": "Linux server",
"interfaces": [
{
"type": 1,
"main": 1,
"useip": 1,
"ip": "192.168.60.13",
"dns": "",
"port": "10050"
}
],
"groups": [
{
"groupid": "2"
}
],
"templates": [
{
"templateid": "10001"
}
],
},
"auth": "c420a53318369184c9a6e00d439342fb",
"id": 1
}' http://192.168.60.217/zabbix/api_jsonrpc.php|python -mjson.tool
curl -s -X POST -H 'Content-Type:application/json' -d '
{
"jsonrpc": "2.0",
"method": "host.create",
"params": {
"host": "Linux server",
"interfaces": [
{
"type": 1,
"main": 1,
"useip": 1,
"ip": "192.168.60.13",
"dns": "",
"port": "10050"
}
],
"groups": [
{
"groupid": "2"
}
],
"templates": [
{
"templateid": "10001"
}
],
},
"auth": "c420a53318369184c9a6e00d439342fb",
"id": 2
}' http://192.168.60.217/zabbix/api_jsonrpc.php|python -mjson.tool
curl -s -X POST -H 'Content-Type:application/json' -d '
{
"jsonrpc": "2.0",
"method": "host.update",
"params": {
"hostid": "10148",
"status": 0
},
"auth": "c420a53318369184c9a6e00d439342fb",
"id": 1
}' http://192.168.60.217/zabbix/api_jsonrpc.php|python -mjson.tool
curl -s -X POST -H 'Content-Type:application/json' -d '
{
"jsonrpc": "2.0",
"method": "host.delete",
"params": [
"10148"
],
"auth": "c420a53318369184c9a6e00d439342fb",
"id": 1
}' http://192.168.60.217/zabbix/api_jsonrpc.php|python -mjson.tool
页:
[1]