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

获取network out 的item, 可能有多个网卡, 返回值将会有不定个的item

Payload:

{
    "jsonrpc": "2.0",
    "method": "item.get",
    "params": {
        "output": ["itemid","hostid","key_","value_type","status","units"],
        "hostids": "10254",
        "search": {
            "key_": "net.if.out"
        },
        "sortfield": "name"
    },
    "auth": "54ec7f0d103f635ada0a76147d8a93a5",
    "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "result": [ 
    {
      "itemid": "28297", 
      "hostid": "10254",
      "key_": "net.if.out[br-035628d874f9]",
      "value_type": "3",
      "status": "0",
      "units": "bps"
    },
    {
      "itemid": "28298",
      "hostid": "10254",
      "key_": "net.if.out[veth399f0a6]",
      "value_type": "3",
      "status": "0",
      "units": "bps"
    },
    {
      "itemid": "28299",
      "hostid": "10254",
      "key_": "net.if.out[vethc9dcaea]",
      "value_type": "3",
      "status": "0",
      "units": "bps"
    },
    {
      "itemid": "28300",
      "hostid": "10254",
      "key_": "net.if.out[vetha85b25b]",
      "value_type": "3",
      "status": "0",
      "units": "bps"
    },
    {
      "itemid": "28301",
      "hostid": "10254",
      "key_": "net.if.out[ens33]",
      "value_type": "3",
      "status": "0",
      "units": "bps"
    },
    {
      "itemid": "28302",
      "hostid": "10254",
      "key_": "net.if.out[docker0]",
      "value_type": "3",
      "status": "0",
      "units": "bps"
    }
  ],
  "id": 1
}

这里可以获取该主机上所有的网卡(包括虚拟网卡)信息, 单位为bps

获取网卡ens33的出口流量, 通过其itemid 28301:

Payload:

{
    "jsonrpc": "2.0",
    "method": "history.get",
    "params": {
        "output": "extend",
        "history": 3,
        "itemids": "28301",
        "sortfield": "clock",
        "sortorder": "DESC",
        "limit": 10
    },
    "auth": "54ec7f0d103f635ada0a76147d8a93a5",
    "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "result": [
    {
      "itemid": "28301",
      "clock": "1523503841",
      "value": "1208",
      "ns": "263181788"
    },
    {
      "itemid": "28301",
      "clock": "1523503781",
      "value": "1248",
      "ns": "780012903"
    },
    {
      "itemid": "28301",
      "clock": "1523503721",
      "value": "1200",
      "ns": "558891999"
    },
    ...
    ...
    {
      "itemid": "28301",
      "clock": "1523503421",
      "value": "1296",
      "ns": "151869414"
    },
    {
      "itemid": "28301",
      "clock": "1523503361",
      "value": "1200",
      "ns": "174374591"
    },
    {
      "itemid": "28301",
      "clock": "1523503301",
      "value": "1264",
      "ns": "320943333"
    }
  ],
  "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.