目次

18 Zabbix API

32桁のトークンを取得する

user: hogehoge
password: hogehgoepass

# curl -XPOST http://hogehoge.net/zabbix/api_jsonrpc.php \
-H "Content-Type: application/json-rpc" \
-d '{
"jsonrpc": "2.0", 
"method": "user.login", 
"params": {"user": "hogehoge","password": "hogehogepass"},
"id": 1
}'
{"jsonrpc":"2.0","result":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","id":1}

最新のアラート3件

curl -XPOST http://hogehoge.net/zabbix/api_jsonrpc.php \
-H "Content-Type: application/json-rpc" \
-d '{
    "jsonrpc": "2.0",
    "method": "alert.get",
    "params": {
        "output": "extend",
        "limit": "3",
        "sortfield": "alertid",
        "sortorder": "DESC"
    },
    "auth": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "id": 1
}'