获取总空间item, 会有多个挂载点因此会有多个结果
Payload:
{
"jsonrpc": "2.0",
"method": "item.get",
"params": {
"output": ["itemid","hostid","key_","value_type","status","units"],
"hostids": "10254",
"search": {
"key_": "vfs.fs.size[*,total]"
},
"searchWildcardsEnabled": "true",
"sortfield": "name"
},
"auth": "54ec7f0d103f635ada0a76147d8a93a5",
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": [
{
"itemid": "28307",
"hostid": "10254",
"key_": "vfs.fs.size[/,total]",
"value_type": "3",
"status": "0",
"units": "B"
},
{
"itemid": "28308",
"hostid": "10254",
"key_": "vfs.fs.size[/boot,total]",
"value_type": "3",
"status": "0",
"units": "B"
}
],
"id": 1
}
获取已使用空间item
Payload:
{
"jsonrpc": "2.0",
"method": "item.get",
"params": {
"output": ["itemid","hostid","key_","value_type","status","units"],
"hostids": "10254",
"search": {
"key_": "vfs.fs.size[*,used]"
},
"searchWildcardsEnabled": "true",
"sortfield": "name"
},
"auth": "54ec7f0d103f635ada0a76147d8a93a5",
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": [
{
"itemid": "28309",
"hostid": "10254",
"key_": "vfs.fs.size[/,used]",
"value_type": "3",
"status": "0",
"units": "B"
},
{
"itemid": "28310",
"hostid": "10254",
"key_": "vfs.fs.size[/boot,used]",
"value_type": "3",
"status": "0",
"units": "B"
}
],
"id": 1
}
获取可用空间百分比item
Payload:
{
"jsonrpc": "2.0",
"method": "item.get",
"params": {
"output": ["itemid","hostid","key_","value_type","status","units"],
"hostids": "10254",
"search": {
"key_": "vfs.fs.size[*,pfree]"
},
"searchWildcardsEnabled": "true",
"sortfield": "name"
},
"auth": "54ec7f0d103f635ada0a76147d8a93a5",
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": [
{
"itemid": "28305",
"hostid": "10254",
"key_": "vfs.fs.size[/,pfree]",
"value_type": "0",
"status": "0",
"units": "%"
},
{
"itemid": "28306",
"hostid": "10254",
"key_": "vfs.fs.size[/boot,pfree]",
"value_type": "0",
"status": "0",
"units": "%"
}
],
"id": 1
}
itemid
获取各项history
根据Payload:
{
"jsonrpc": "2.0",
"method": "history.get",
"params": {
"output": "extend",
"history": 0,
"itemids": ["28305", "28306"],
"sortfield": "clock",
"sortorder": "DESC",
"limit": 10
},
"auth": "54ec7f0d103f635ada0a76147d8a93a5",
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": [
{
"itemid": "28306",
"clock": "1523524006",
"value": "85.9602",
"ns": "703399188"
},
{
"itemid": "28305",
"clock": "1523524005",
"value": "56.9664",
"ns": "699158834"
},
{
"itemid": "28306",
"clock": "1523523946",
"value": "85.9602",
"ns": "525373346"
},
{
"itemid": "28305",
"clock": "1523523945",
"value": "56.9661",
"ns": "516591919"
},
{
"itemid": "28306",
"clock": "1523523886",
"value": "85.9602",
"ns": "332224676"
},
{
"itemid": "28305",
"clock": "1523523885",
"value": "56.9661",
"ns": "348414219"
},
{
"itemid": "28306",
"clock": "1523523826",
"value": "85.9602",
"ns": "111641345"
},
{
"itemid": "28305",
"clock": "1523523825",
"value": "56.9661",
"ns": "110805124"
},
{
"itemid": "28306",
"clock": "1523523766",
"value": "85.9602",
"ns": "944428779"
},
{
"itemid": "28305",
"clock": "1523523765",
"value": "56.9661",
"ns": "940386072"
}
],
"id": 1
}
注意: 可以通过itemids
列表中加入多个itemid
批量获取数据