产品:飞企边缘盒子

飞企边缘盒子指承载编排引擎的服务器或边缘盒子,边缘盒子属于网关设备,
可以通过引擎组件对各种终端设备进行对接(边缘盒子对接的设备为网关子设备)。
边缘盒子流文件可以监控边缘盒子运行情况以及边缘盒子对接的设备数量。

编解码协议

选择官方标准协议

基础信息

物模型

物模型定义

  • 物模型TSL
{
  "events": [],
  "properties": [
    {
      "id": "hostname",
      "name": "设备名称",
      "valueType": {
        "type": "string",
        "expands": {}
      },
      "expands": {
        "readOnly": "true",
        "source": "device"
      }
    },
    {
      "id": "os",
      "name": "系统",
      "valueType": {
        "type": "string",
        "expands": {}
      },
      "expands": {
        "readOnly": "true",
        "source": "device"
      }
    },
    {
      "id": "ip",
      "name": "IP地址",
      "valueType": {
        "type": "string",
        "expands": {}
      },
      "expands": {
        "readOnly": "false",
        "source": "manual",
        "storageType": "direct"
      }
    },
    {
      "id": "cpu_usage",
      "name": "CPU使用率",
      "valueType": {
        "type": "float",
        "scale": 2,
        "unit": "percent"
      },
      "expands": {
        "readOnly": "true",
        "source": "device"
      }
    },
    {
      "id": "memory_usage",
      "name": "内存使用率",
      "valueType": {
        "type": "float",
        "scale": 2,
        "unit": "percent"
      },
      "expands": {
        "readOnly": "true",
        "source": "device"
      }
    },
    {
      "id": "disk_usage",
      "name": "磁盘使用率",
      "valueType": {
        "type": "float",
        "scale": 2,
        "unit": "percent"
      },
      "expands": {
        "readOnly": "true",
        "source": "device"
      }
    },
    {
      "id": "devices",
      "name": "设备数量",
      "valueType": {
        "type": "int"
      },
      "expands": {
        "readOnly": "true",
        "source": "device"
      }
    },
    {
      "id": "onlines",
      "name": "在线设备数",
      "valueType": {
        "type": "int"
      },
      "expands": {
        "readOnly": "true",
        "source": "device"
      }
    }
  ],
  "functions": [],
  "tags": [
    {
      "id": "geoPoint",
      "name": "地理位置",
      "valueType": {
        "type": "geoPoint"
      },
      "expands": {
        "readOnly": "false",
        "storageType": "direct"
      }
    }
  ]
}

物模型-参数

属性标识 属性名称 数据类型 属性值来源 是否只读 说明
hostname 设备名称 string 设备
os 系统 string 设备
ip IP地址 string 手动
cpu_usage CPU使用率 float 设备
memory_usage 内存使用率 float 设备
disk_usage 磁盘使用率 float 设备
devices 设备数量 int 设备

物模型-功能

物模型-事件

物模型-标签

网关协议

不使用网关协议进行终端对接

流文件

  • 适用厂商

所有边缘盒子厂商、服务器厂商

  • 适用厂商产品

适用所有支持docker容器部署的设备产品,包括边缘盒子、虚拟机、实体服务器等

  • 流文件
[
    {
        "id": "${deviceId}",
        "type": "tab",
        "label": "${tab_name}",
        "disabled": false,
        "info": ""
    },
    {
        "id": "b4f8053135b433d4",
        "type": "inject",
        "z": "${deviceId}",
        "name": "采集任务",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "edgeboxId",
                "v": "${deviceId}",
                "vt": "str"
            }
        ],
        "repeat": "5",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payloadType": "date",
        "x": 150,
        "y": 300,
        "wires": [
            [
                "db91fef09bd6ddd4",
                "9038ef47a7641203",
                "f38c8fe9c69caf05",
                "22df21dc6fbdd686",
                "0e04131a9e370fc4",
                "421c3a5b2158eacd"
            ]
        ]
    },
    {
        "id": "38be84832e9cc840",
        "type": "function",
        "z": "${deviceId}",
        "name": "",
        "func": "var memusage = msg.payload.memusage;\nvar payload = {\n    deviceId:msg.edgeboxId,\n    properties:{\n        memory_usage: memusage.toFixed(2)\n    }\n}\n\n\n// 流程变量设置,用于避免重复上报\nvar flowId = \"edgebox_memory_usage\";\nvar flow_str = JSON.stringify(payload);\nif(flow.get(flowId) == flow_str){\n    return null;\n}\nflow.set(flowId,flow_str);\n\n\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 490,
        "y": 360,
        "wires": [
            [
                "15f5f10acddd152c",
                "70bf2155a8b28991"
            ]
        ]
    },
    {
        "id": "1663291b7b432867",
        "type": "function",
        "z": "${deviceId}",
        "name": "",
        "func": "var uptime = msg.payload.uptime;\nvar day = Math.floor(uptime/(60*60*24));\nvar hour = Math.floor((uptime%(60*60*24))/(60*60));\nvar minute = Math.floor(((uptime%(60*60*24))%(60*60))/60);\nvar second = Math.floor(uptime%60);\nvar payload = {\n    deviceId:msg.edgeboxId,\n    properties:{\n        uptime: day+\"天\"+hour+\"时\"+minute+\"分\"+second+\"秒\"\n    }\n}\n\n// 流程变量设置,用于避免重复上报\nvar flowId = \"edgebox_uptime\";\nvar flow_str = JSON.stringify(payload);\nif(flow.get(flowId) == flow_str){\n    return null;\n}\nflow.set(flowId,flow_str);\n\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 490,
        "y": 240,
        "wires": [
            [
                "1869f7f7f1459d6a",
                "70bf2155a8b28991"
            ]
        ]
    },
    {
        "id": "fbf820d6a1fd104b",
        "type": "function",
        "z": "${deviceId}",
        "name": "",
        "func": "var disks = msg.payload;\nvar usage = 0;\nfor(var i=0;i<disks.length;i++){\n    usage = usage + disks[i].capacity;\n};\n\nvar payload = {\n    deviceId:msg.edgeboxId,\n    properties:{\n        disk_usage: (100*usage/(disks.length)).toFixed(2)\n    }\n};\n\n\n// 流程变量设置,用于避免重复上报\nvar flowId = \"edgebox_disk_usage\";\nvar flow_str = JSON.stringify(payload);\nif(flow.get(flowId) == flow_str){\n    return null;\n}\nflow.set(flowId,flow_str);\n\n\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 490,
        "y": 420,
        "wires": [
            [
                "68baea3156363de1",
                "70bf2155a8b28991"
            ]
        ]
    },
    {
        "id": "0672d6e62ab50352",
        "type": "function",
        "z": "${deviceId}",
        "name": "",
        "func": "var data = msg.payload;\nvar payload = {\n    deviceId:msg.edgeboxId,\n    properties:{\n        hostname: data.hostname,\n        os: data.type\n    }\n};\n\n\n// 流程变量设置,用于避免重复上报\nvar flowId = \"edgebox_hostname\";\nvar flow_str = JSON.stringify(payload);\nif(flow.get(flowId) == flow_str){\n    return null;\n}\nflow.set(flowId,flow_str);\n\n\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 490,
        "y": 180,
        "wires": [
            [
                "efb608be3642c3af",
                "72c43721b7fcbf37",
                "70bf2155a8b28991"
            ]
        ]
    },
    {
        "id": "1e0daaf34b94b1db",
        "type": "function",
        "z": "${deviceId}",
        "name": "",
        "func": "msg.edgeboxId = \"${deviceId}\";\nvar data = msg.payload;\nvar payload = {\n    deviceId:msg.edgeboxId,\n    properties:{\n        cpu_usage: data.toFixed(2)\n    }\n};\n\n\n// 流程变量设置,用于避免重复上报\nvar flowId = \"edgebox_cpu_usage\";\nvar flow_str = JSON.stringify(payload);\nif(flow.get(flowId) == flow_str){\n    return null;\n}\nflow.set(flowId,flow_str);\n\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 490,
        "y": 300,
        "wires": [
            [
                "66f1c8946120fd32",
                "70bf2155a8b28991"
            ]
        ]
    },
    {
        "id": "5bfeab2d3053c6d7",
        "type": "mqtt out",
        "z": "${deviceId}",
        "name": "属性上报",
        "topic": "",
        "qos": "0",
        "retain": "false",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "${edgeboxId}_mqtt",
        "x": 820,
        "y": 480,
        "wires": []
    },
    {
        "id": "72c43721b7fcbf37",
        "type": "ui_text",
        "z": "${deviceId}",
        "group": "2c977df45fd56639",
        "order": 1,
        "width": 0,
        "height": 0,
        "name": "操作系统",
        "label": "操作系统",
        "format": "{{msg.payload.properties.os}}",
        "layout": "row-spread",
        "x": 640,
        "y": 180,
        "wires": []
    },
    {
        "id": "efb608be3642c3af",
        "type": "ui_text",
        "z": "${deviceId}",
        "group": "2c977df45fd56639",
        "order": 2,
        "width": 0,
        "height": 0,
        "name": "设备名称",
        "label": "设备名称",
        "format": "{{msg.payload.properties.hostname}}",
        "layout": "row-spread",
        "x": 640,
        "y": 140,
        "wires": []
    },
    {
        "id": "1869f7f7f1459d6a",
        "type": "ui_text",
        "z": "${deviceId}",
        "group": "2c977df45fd56639",
        "order": 4,
        "width": 0,
        "height": 0,
        "name": "运行时间",
        "label": "运行时间",
        "format": "{{msg.payload.properties.uptime}}",
        "layout": "row-spread",
        "x": 640,
        "y": 240,
        "wires": []
    },
    {
        "id": "66f1c8946120fd32",
        "type": "ui_gauge",
        "z": "${deviceId}",
        "name": "CPU使用率",
        "group": "971b392a9bbf6031",
        "order": 1,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "CPU使用率",
        "label": "",
        "format": "{{msg.payload.properties.cpu_usage}}",
        "min": 0,
        "max": "100",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "60",
        "seg2": "80",
        "x": 650,
        "y": 300,
        "wires": []
    },
    {
        "id": "15f5f10acddd152c",
        "type": "ui_gauge",
        "z": "${deviceId}",
        "name": "内存使用率",
        "group": "20c83284b625ee8a",
        "order": 1,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "内存使用率",
        "label": "",
        "format": "{{msg.payload.properties.memory_usage}}",
        "min": 0,
        "max": "100",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "60",
        "seg2": "80",
        "x": 650,
        "y": 360,
        "wires": []
    },
    {
        "id": "68baea3156363de1",
        "type": "ui_gauge",
        "z": "${deviceId}",
        "name": "",
        "group": "a266ca3c61457872",
        "order": 1,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "磁盘使用率",
        "label": "",
        "format": "{{msg.payload.properties.disk_usage}}",
        "min": 0,
        "max": "100",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "60",
        "seg2": "80",
        "x": 650,
        "y": 420,
        "wires": []
    },
    {
        "id": "db91fef09bd6ddd4",
        "type": "cpu",
        "z": "${deviceId}",
        "name": "CPU",
        "msgCore": false,
        "msgOverall": true,
        "msgArray": false,
        "msgTemp": false,
        "x": 330,
        "y": 300,
        "wires": [
            [
                "1e0daaf34b94b1db"
            ]
        ]
    },
    {
        "id": "22df21dc6fbdd686",
        "type": "OS",
        "z": "${deviceId}",
        "name": "",
        "x": 330,
        "y": 180,
        "wires": [
            [
                "0672d6e62ab50352"
            ]
        ]
    },
    {
        "id": "0e04131a9e370fc4",
        "type": "Drives",
        "z": "${deviceId}",
        "name": "",
        "x": 330,
        "y": 420,
        "wires": [
            [
                "fbf820d6a1fd104b"
            ]
        ]
    },
    {
        "id": "f38c8fe9c69caf05",
        "type": "Uptime",
        "z": "${deviceId}",
        "name": "",
        "x": 340,
        "y": 240,
        "wires": [
            [
                "1663291b7b432867"
            ]
        ]
    },
    {
        "id": "9038ef47a7641203",
        "type": "Memory",
        "z": "${deviceId}",
        "name": "",
        "scale": "Byte",
        "x": 340,
        "y": 360,
        "wires": [
            [
                "38be84832e9cc840"
            ]
        ]
    },
    {
        "id": "70bf2155a8b28991",
        "type": "function",
        "z": "${deviceId}",
        "name": "上报主题组装",
        "func": "msg.topic = \"/edgebox/\"+msg.edgeboxId+\"/properties/report\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 660,
        "y": 480,
        "wires": [
            [
                "5bfeab2d3053c6d7"
            ]
        ]
    },
    {
        "id": "421c3a5b2158eacd",
        "type": "function",
        "z": "${deviceId}",
        "name": "设备数联",
        "func": "var devices = 0;\nvar onlines = 0;\n\nvar datas = global.keys();\nfor(var i=0 ;i< datas.length;i++){\n    var global_value = global.get(datas[i]);\n    if(global_value !=null && global_value.device_state != null){\n        devices++;\n        if(global_value.device_state){\n            onlines++;\n        }\n    }\n}\n\n\nvar payload = {\n    deviceId:msg.edgeboxId,\n    properties:{\n        devices: devices,\n        onlines: onlines\n    }\n};\n\n// 流程变量设置,用于避免重复上报\nvar flowId = \"edgebox_devices\";\nvar flow_str = JSON.stringify(payload);\nif(flow.get(flowId) == flow_str){\n    return null;\n}\nflow.set(flowId,flow_str);\n\n\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 340,
        "y": 480,
        "wires": [
            [
                "70bf2155a8b28991"
            ]
        ]
    },
    {
        "id": "${edgeboxId}_mqtt",
        "type": "mqtt-broker",
        "name": "飞企IOT-MQTT",
        "broker": "${mqtt_broker_host}",
        "port": "${mqtt_broker_port}",
        "clientid": "${mqtt_broker_clientid}",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "/edgebox/${deviceId}/online",
        "birthQos": "0",
        "birthPayload": "{\"deviceId\":\"${deviceId}\" }",
        "birthMsg": {},
        "closeTopic": "/edgebox/${deviceId}/offline",
        "closeQos": "0",
        "closePayload": "{\"deviceId\":\"${deviceId}\" }",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": "",
        "credentials": {
            "user": "${mqtt_broker_username}",
            "password": "${mqtt_broker_password}"
        }
    },
    {
        "id": "2c977df45fd56639",
        "type": "ui_group",
        "name": "基础信息",
        "tab": "aac2e8f72b0aebf6",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "971b392a9bbf6031",
        "type": "ui_group",
        "name": "CPU",
        "tab": "aac2e8f72b0aebf6",
        "order": 3,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "20c83284b625ee8a",
        "type": "ui_group",
        "name": "内存",
        "tab": "aac2e8f72b0aebf6",
        "order": 4,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "a266ca3c61457872",
        "type": "ui_group",
        "name": "磁盘",
        "tab": "aac2e8f72b0aebf6",
        "order": 4,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "aac2e8f72b0aebf6",
        "type": "ui_tab",
        "name": "边缘网关",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]
  • 导入编排引擎

设备上线

文档更新时间: 2023-06-12 11:11   作者:管理员