## 그래프 생성
curl -s -X POST -H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "graph.create",
"params": {
"name": "'${ID}_${HOST}_${i}'",
"width": 900,
"height": 200,
"gitems": [
{
"itemid": '${1}',
"color": "00AA00"
}
]
},
"auth": '$token',
"id": 1
}' \
http://$zabbixserver/zabbix/api_jsonrpc.php
## 그래프 정보 가져오기
curl -s -X POST -H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "graph.get",
"params": {
"output": "extend",
"hostids": 14431,
"sortfield": "name"
},
"auth": '${token}',
"id": 1
}' http://$zabbixserver/zabbix/api_jsonrpc.php
## 어플리케이션 리스트
CHECK=`curl -s -X POST -H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "application.get",
"params": {
"output": "extend",
"hostids": "14431",
"sortfield": "name"
},
"auth": '$token',
"id": 1 }' \
http://$zabbixserver/zabbix/api_jsonrpc.php
## 어플리케이션 생성
curl -s -X POST -H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "application.create",
"params": {
"name": "'$1'",
"hostid": "14431"
},
"auth": '$token',
"id": 1 }' \
http://$zabbixserver/zabbix/api_jsonrpc.php
## 아이템 정보 가져오기
curl -s -X POST -H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "item.get",
"params": {
"output": "extend",
"hostids": "14431",
"search": {
"key_": "'${HOST}'.'${i}'.'${ID}'"
},
"sortfield": "name"
},
"auth": '$token',
"id": 1
}' \
http://$zabbixserver/zabbix/api_jsonrpc.php
## 아이템 생성
curl -s -X POST -H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "item.create",
"params": {
"name": "'${HOST}./${CUT_SRC}.${1}'",
"key_": "'${HOST}.${1}.${ID}'",
"hostid": "14431",
"type": 2,
"value_type": 3,
"interfaceid": "0",
'${UNITS}'
"applications": [
'${CHECK}' ],
"delay": 0
},
"auth": '$token',
"id": 1 }' \
http://$zabbixserver/zabbix/api_jsonrpc.php
## 트리거 생성
curl -s -X POST -H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "trigger.create",
"params": {
"description": "'${HOST}', '${SRC}' backup size zero",
"expression": "{backup_report:'${HOST}'.size.'${ID}'.last()}=0 or {backup_report:'${HOST}'.size.'${ID}'.nodata(2d)}=1"
},
"auth": '$token',
"id": 1 }' \
http://$zabbixserver/zabbix/api_jsonrpc.php
## 토큰 가져오기
curl -s -X POST -H 'Content-Type: application/json' \
-d '{ "jsonrpc": "2.0", "method": "user.login", "params": { "user": "'$zabbixid'", "password": "'$zabbixpass'" }, "auth": null, "id": "0" }' \
http://$zabbixserver/zabbix/api_jsonrpc.php