网络端口数据上报

功能描述

定时、增量上报当前操作系统的网络端口信息,包含内容如下:

  • 本地IP地址

  • 本地网络端口

  • 外部IP地址

  • 外部网络端口

  • 网络协议

  • 连接状态

  • 建立此连接的进程ID

  • 建立此连接的进程名

上报频率:上报频率可配置,默认为10秒一次

1. 上报消息

1.1 Topic

Topic
/v1/devices/device/events

消息发送方

网关设备

消息接收方

物联网平台

1.2 上报消息payload

参数说明

字段名
必选/可选
类型
参数描述

devices

必选

DeviceS[]

设备数据。

DeviceS结构体说明

字段名
必选/可选
类型
参数描述

deviceSn

必选

String(256)

设备ESN码,用于唯一标识设备。

services

必选

List<Services>

服务列表。

Services结构体说明

字段名
必选/可选
类型
参数描述

service

必选

String(256)

服务名。netstatEvent

mid

必选

String(64)

消息ID,用来匹配请求消息和应答消息,以及消息去重。

datas

必选

List<Data>

数据。

eventTime

必选

String(256)

时间格式:RFC3339标准,例如:1985-04-12T23:20:50.52Z。

Data结构体说明

字段名
必选/可选
类型
参数描述

eventType

必选

string

事件类型.newLink:服务新增事件,delLink: 服务删除事件,updateLink: 服务更新事件

localIp

必选

string

绑定本地的IP地址

localPort

必选

uint16

本地端口

foreignIp

必选

string

外部ip地址

foreignPort

必选

uint16

外部端口

protocol

必选

uint16

网络协议

state

可选

string

连接状态

pid

可选

uint16

打开链接的进程pid

pName

可选

string

打开链接的进程名称

isFull

必选

uint16

是否为全量数据,1代表第一次上报为全量,0代表为增量

请求示例

{
    "devices": [
        {
            "deviceSn": "D3183Tth3w",
            "services": [
                {
                    "service": "netstatEvent",
                    "mid":"mymessageid",
                    "data": [{
                        "eventType": "newLink",
                        "localIp": "0.0.0.0",
                        "localPort": 35520,
                        "foreignIp": "0.0.0.0",
                        "foreignPort": "*",
                        "protocol": "tcp",
                        "state": "LISTEN",
                        "pid": 1940,
                        "pName ": "dropbear",
                        "isFull": 1,
                    }],
                    "eventTime": "2021-02-08T15:20:35Z"
                }
            ]
        }
    ]
}

最后更新于