Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
J
jfzabbix
  • Overview
    • Overview
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • jfmonitor
  • jfzabbix
  • Wiki
  • 获取磁盘使用空间

获取磁盘使用空间

Last edited by zhengtianbao Apr 12, 2018
Page history

获取总空间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 批量获取数据

Clone repository
  • Home
  • Zabbix api ref
  • Zabbix_agent安装配置
  • Zabbix_server安装配置
  • 产品原型图
  • 创建报警规则
  • 创建用户组, 用户
  • 删除报警规则
  • 删除用户, 用户组
  • 测试脚本
  • 登入登出
  • 获取cpu使用率
  • 获取主机信息
  • 获取内存使用率
  • 获取报警信息
More Pages
×

New Wiki Page

Tip: You can specify the full path for the new file. We will automatically create any missing directories.