Zabbix/Zabbix API
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
#topicpath
----
#contents
**やってみる [#oe3bc54a]
$ cat auth.json
{
"auth": null,
"method": "user.login",
"id": 1,
"params": {
"user": "Admin",
"password": "xxxx"
},
"jsonrpc":"2.0"
}
などのJSONデータを用意し、下記の通りZabbixサーバにリクエ...
$ curl -s -X GET --data-binary @auth.json \ ← フ...
> -H "Content-Type:application/json-rpc" \ ← Co...
> http://[zabbix Server]/api_jsonrpc.php | \ ←所定の...
> jq -r .result ← JQで整形、 resultプロパティだけ取得...
e5f6ee796acfxxxxxxxxxxxxxx
トークンがとれました。 つぎにこのトークンを用いて、HOST一...
$ cat param.json
{
"auth": "e5f6ee796acfxxxxxxxxxxxxxx", ←先のトークン
"method": "host.get",
"id": 1,
"params": {
"output": "extend",
"selectInterfaces": "extend"
},
"jsonrpc": "2.0"
}
$ curl -s -X GET --data-binary @param.json \
> -H "Content-Type:application/json-rpc" \
> http://[zabbix Server]/api_jsonrpc.php | jq
{
"jsonrpc": "2.0",
"result": [
{
"hostid": "10263",
"proxy_hostid": "0",
"host": "windowsEsxi",
"status": "0",
"disable_until": "0",
"error": "",
"available": "1",
...
"name": "ESXi上のWindows10",
"flags": "0",
"templateid": "0",
"description": "",
"tls_connect": "1",
"tls_accept": "1",
"tls_issuer": "",
"tls_subject": "",
"tls_psk_identity": "",
"tls_psk": "",
"interfaces": [
{
"interfaceid": "12",
"hostid": "10263",
"main": "1",
"type": "1",
"useip": "1",
"ip": "192.168.10.203",
"dns": "",
"port": "10050",
"bulk": "1"
}
]
},.....
],
"id": 1
}
**関連リンク [#kda23aa6]
-[[19. API [Zabbix Documentation 3.4]>https://www.zabbix....
----
この記事は
#vote(おもしろかった,そうでもない)
#comment
#topicpath
SIZE(10){現在のアクセス:&counter;}
終了行:
#topicpath
----
#contents
**やってみる [#oe3bc54a]
$ cat auth.json
{
"auth": null,
"method": "user.login",
"id": 1,
"params": {
"user": "Admin",
"password": "xxxx"
},
"jsonrpc":"2.0"
}
などのJSONデータを用意し、下記の通りZabbixサーバにリクエ...
$ curl -s -X GET --data-binary @auth.json \ ← フ...
> -H "Content-Type:application/json-rpc" \ ← Co...
> http://[zabbix Server]/api_jsonrpc.php | \ ←所定の...
> jq -r .result ← JQで整形、 resultプロパティだけ取得...
e5f6ee796acfxxxxxxxxxxxxxx
トークンがとれました。 つぎにこのトークンを用いて、HOST一...
$ cat param.json
{
"auth": "e5f6ee796acfxxxxxxxxxxxxxx", ←先のトークン
"method": "host.get",
"id": 1,
"params": {
"output": "extend",
"selectInterfaces": "extend"
},
"jsonrpc": "2.0"
}
$ curl -s -X GET --data-binary @param.json \
> -H "Content-Type:application/json-rpc" \
> http://[zabbix Server]/api_jsonrpc.php | jq
{
"jsonrpc": "2.0",
"result": [
{
"hostid": "10263",
"proxy_hostid": "0",
"host": "windowsEsxi",
"status": "0",
"disable_until": "0",
"error": "",
"available": "1",
...
"name": "ESXi上のWindows10",
"flags": "0",
"templateid": "0",
"description": "",
"tls_connect": "1",
"tls_accept": "1",
"tls_issuer": "",
"tls_subject": "",
"tls_psk_identity": "",
"tls_psk": "",
"interfaces": [
{
"interfaceid": "12",
"hostid": "10263",
"main": "1",
"type": "1",
"useip": "1",
"ip": "192.168.10.203",
"dns": "",
"port": "10050",
"bulk": "1"
}
]
},.....
],
"id": 1
}
**関連リンク [#kda23aa6]
-[[19. API [Zabbix Documentation 3.4]>https://www.zabbix....
----
この記事は
#vote(おもしろかった,そうでもない)
#comment
#topicpath
SIZE(10){現在のアクセス:&counter;}
ページ名: