• 文档
  • 控制台
  • 登录
  • 立即注册
    目前不支持用户自主注册,如需注册账号,请联系400-080-1100
基础设施监控 API参考手册
最近更新时间:2023-04-16 17:00:00

1 基础设施监控

1.1 GetDeviceList

 设备列表。

1.1.1 使用说明

 POST https://{endpoint}/manage/infra/v1.0/infra/cmdb/device

1.1.2 请求参数

 Query 参数

image.png

 表1-1 ConditionItem 字段说明

image.png

 表1-2 Page 字段说明

image.png

1.1.3 返回数据

image.png

image.png

 表1-3 DeviceInfo 字段说明

image.png

image.png

1.1.4 示例

 1. 请求示例
 POST https://{endpoint}/manage/infra/v1.0/infra/cmdb/device
 {
     "Condition": [
     {
         "Field": "manufacturer",
         "Operator": "$regex",
         "Value": "迈普"
     },
     {
         "Field": "category_name",
         "Operator": "$regex",
         "Value": "服务器"
     }
     ],
     "Page": {
         "Start": 0,
         "Limit": 10,
         "Sort": ""
     }
 }
 2. 正常返回示例
 HTTP/1.1 200 OK
 Content-Type:application/json
 {
     "RequestId": "",
     "DeviceList": [
     {
         "DeviceId": 5239737508004677,
         "DeviceName": "10.253.70.70",
         "AssetNo": "",
         "Ip": "10.253.70.70",
         "CategoryId": 239406572200005,
         "CategoryName": "服务器",
         "ManufacturerId": 5117828377700037,
         "Manufacturer": "迈普",
         "RegionId": 0,
         "Region": "",
         "IdcId": 0,
         "Idc": "",
         "ColoId": 0,
         "Colo": "",
         "CabinetId": 0,
         "Cabinet": "",
         "SlotId": "",
         "Slot": "",
         "CpuCoreCount": "",
         "MemCapacity": "",
         "DiskCapacity": "",
         "NetworkCard": "",
         "RunStatus": 2
     }
     ],
     "Count": 1
 }

1.2 GetDeviceDetail

 服务器详细信息

1.2.1 使用说明

 GET https://{endpoint}/manage/infra/v1.0/infra/cmdb/device/${deviceId}

1.2.2 请求参数

 表1-4 URL 参数

image.png

1.2.3 返回数据

image.png

 表1-5 DeviceInfo 字段说明

image.png

image.png

1.2.4 示例

 1. 请求示例
 GET https://{endpoint}/manage/infra/v1.0/infra/cmdb/device/5132491074157957
 2. 正常返回示例
 HTTP/1.1 200 OK
 Content-Type:application/json
 {
     "RequestId": "123456789",
     "Device": {
         "DeviceId": 5133198856863109,
         "DeviceName": "cbc1-18-22-node2",
         "AssetNo": "",
         "Ip": "10.253.18.22",
         "CategoryId": 239406572200005,
         "CategoryName": "服务器",
         "ManufacturerId": 5071684799166085,
         "Manufacturer": "VMware, Inc.",
         "RegionId": 0,
         "Region": "",
         "IdcId": 0,
         "Idc": "",
         "ColoId": 0,
         "Colo": "",
         "CabinetId": 0,
         "Cabinet": "",
         "SlotId": "",
         "Slot": "",
         "CpuCoreCount": "",
         "MemCapacity": "",
         "DiskCapacity": "",
         "NetworkCard": "",
         "RunStatus": 1
     }
 }

1.3 GetServerDeviceBaseInformationMonitor

 服务器基础监控。

1.3.1 使用说明

 GET https://{endpoint}/manage/infra/v1.0/infra/device/${deviceId}

1.3.2 请求参数

 表1-6 URL 参数

image.png

1.3.3 返回数据

image.png

 表1-7 DeviceMonitorInfo 字段说明

image.png

 表1-8 CpuInfo 字段说明

image.png

 表1-9 DiskInfo 字段说明

image.png

image.png

 表1-10 MemInfo 字段说明

image.png

 表1-11 SystemInfo 字段说明

image.png

1.3.4 示例

 1. 请求示例
 GET https://{endpoint}/manage/infra/v1.0/infra/device/5132491074157957
 2. 正常返回示例
 HTTP/1.1 200 OK
 Content-Type:application/json
 {
     "RequestId": "123456789",
     "Device": {
         "Cpu": {
             "CpuNum": "16 个",
             "CpuUseRate": "8.70",
             "Id": "91.3",
             "Load1": "2.77",
             "Load15": "2.46",
             "Load5": "2.86",
             "Ni": "0.0",
             "Running": "2",
             "Sy": "2.7",
             "Total": "583",
             "Us": "4.3",
             "Wa": "0.3",
             "Zombie": "0"
         },
         "Disk": {
             "DiskTotal": "0.29 TB",
             "IoByte": "717.00 KB/s",
             "PartitionAvail": "16384.02 TB",
             "PartitionNum": "182 个",
             "PartitionTotal": "16384.03 TB",
             "ReadOpRate": "0KB/s",
             "ReadRate": "0r/s",
             "Tps": "118.50 次/秒",
             "WriteOpRate": "15.75KB/s",
             "WriteRate": "1w/s"
         },
         "Mem": {
             "MemInRate": "0",
             "MemOutRate": "0",
             "MemRate": "20.87",
             "MemTotal": "31.21 GB",
             "SwapTotal": "0.000000",
             "SwapUseRate": "0",
             "SwapUseTotal": "0.000000"
         },
         "System": {
             "HostInfo": "Linux cbc1-18-22-node2 4.18.0-30503.10.2.el8.x86_64",
             "HostName": "cbc1-18-22-node2",
             "Ip": "10.253.18.22,21.100.203.192,\r\n",
             "Mac": "6a:3c:a9:c6:32:ac",
             "NetNum": "37",
             "Nowtime": "2022-09-08 17:18:27",
             "Ping": "0.124ms",
             "Runtime": "114 天 17 小时 06 分",
             "Users": "2",
             "Version": "CCLinux release 8.4.2108"
         }
     }
 }

1.4 GetServerCPUMonitor

 CPU。

1.4.1 使用说明

 GET https://{endpoint}/manage/infra/v1.0/infra/cpu/${deviceId}

1.4.2 请求参数

 表1-12 URL 参数

image.png

1.4.3 返回数据

image.png

 表1-13 CpuData

image.png

1.4.4 示例

 1. 请求示例
 GET https://{endpoint}/manage/infra/v1.0/infra/cpu/5132491074157957
 2. 正常返回示例
 HTTP/1.1 200 OK
 Content-Type:application/json
 {
     "RequestId": "123456789",
     "Total": 4,
     "Data": [
     {
         "CpuMHz": " 2099.999",
         "CpuRate": "15.51%",
         "ModelName": " Montage Jintide(R) C5218R",
         "Processor": "CPU 0"
     },
     {
         "CpuMHz": " 2099.999",
         "CpuRate": "11.25%",
         "ModelName": " Montage Jintide(R) C5218R",
         "Processor": "CPU 1"
     },
     {
         "CpuMHz": " 2099.999",
         "CpuRate": "18.15%",
         "ModelName": " Montage Jintide(R) C5218R",
         "Processor": "CPU 2"
     },
     {
         "CpuMHz": " 2099.999",
         "CpuRate": "20.06%",
         "ModelName": " Montage Jintide(R) C5218R",
         "Processor": "CPU 3"
     },
     {
         "CpuMHz": " 2099.999",
         "CpuRate": "7.19%",
         "ModelName": " Montage Jintide(R) C5218R",
         "Processor": "CPU 4"
     }
     ]
 }

1.5 GetServerPartitionMonitor

 分区。

1.5.1 使用说明

 GET https://{endpoint}/manage/infra/v1.0/infra/partition/${deviceId}

1.5.2 请求参数

 表1-14 URL 参数

image.png

1.5.3 返回数据

image.png

 表1-15 PartitionData

image.png

1.5.4 示例

 1. 请求示例
 GET https://{endpoint}/manage/infra/v1.0/infra/partition/5132491074157957
 2. 正常返回示例
 HTTP/1.1 200 OK
 Content-Type:application/json
 {
     "RequestId": "123456789",
     "Data": [
     {
         "Available": "126GB",
         "Date": "2022-09-08 14:04:13",
         "Filesystem": "devtmpfs",
         "Ifree": "32977718",
         "Iused": "569",
         "Iuserate": "1%",
         "Mounted": "/dev",
         "Total": "126GB",
         "Type": "devtmpfs",
         "Use": "0B",
         "Userate": "0%"
     },
     {
         "Available": "126GB",
         "Date": "2022-09-08 14:04:13",
         "Filesystem": "tmpfs",
         "Ifree": "32982959",
         "Iused": "51",
         "Iuserate": "1%",
         "Mounted": "/dev/shm",
         "Total": "126GB",
         "Type": "tmpfs",
         "Use": "200KB",
         "Userate": "1%"
     }
     ],
     "Total": 2
 }

1.6 GetServerHarddiskMonitor

 硬盘。

1.6.1 使用说明

 GET https://{endpoint}/manage/infra/v1.0/infra/harddisk/${deviceId}

1.6.2 请求参数

 表1-16 URL 参数

image.png

1.6.3 返回数据

image.png

image.png

 表1-17 HardDiskData

image.png

1.6.4 示例

 1. 请求示例
 GET https://{endpoint}/manage/infra/v1.0/infra/harddisk/5132491074157957
 2. 正常返回示例
 HTTP/1.1 200 OK
 Content-Type:application/json
 {
     "RequestId": "123456789",
     "Total": 3,
     "Data": [
     {
         "Date": "2022-09-08 14:09:43",
         "Hardname": "sda",
         "IoCount": "70.00",
         "Read": "0.00",
         "Total": "500G\rB",
         "Write": "414.50\r"
     },
     {
         "Date": "2022-09-08 14:09:43",
         "Hardname": "sdb",
         "IoCount": "116.00",
         "Read": "0.00",
         "Total": "1.5T\rB",
         "Write": "2005.00\r"
     },
     {
         "Date": "2022-09-08 14:09:43",
         "Hardname": "sr0",
         "IoCount": "",
         "Read": "",
         "Total": "9.8G\rB",
         "Write": ""
     }
     ]
 }

1.7 GetServerPortMonitor

 接口监控。

1.7.1 使用说明

 GET https://{endpoint}/manage/infra/v1.0/infra/netcard/${deviceId}

1.7.2 请求参数

 表1-18 URL 参数

image.png

1.7.3 返回数据

image.png

 表1-19 NetcardData

image.png

1.7.4 示例

 1. 请求示例
 GET https://{endpoint}/manage/infra/v1.0/infra/netcard/5132491074157957
 2. 正常返回示例
 HTTP/1.1 200 OK
 Content-Type:application/json
 {
     "RequestId": "123456789",
     "Total": 1,
     "Data": [
     {
         "RXDropped": "0",
         "RXErrors": "0",
         "TXDropped": "0",
         "TXErrors": "0",
         "Broadcast": "ff:ff:ff:ff:ff:ff",
         "Ether": "00:0c:29:a0:16:f4",
         "Inet4": "",
         "Mtu": "1600",
         "Name": "ens192",
         "NetType": "ether",
         "Netmask": "",
         "Status": 1
     }
     ]
 }

1.8 GetServerProcessMonitor

 进程。

1.8.1 使用说明

 GET https://{endpoint}/manage/infra/v1.0/infra/process/${deviceId}

1.8.2 请求参数

 表1-20 URL 参数

image.png

1.8.3 返回数据

image.png

 表1-21 ProcessData

image.png

image.png

1.8.4 示例

 1. 请求示例
 GET https://{endpoint}/manage/infra/v1.0/infra/process/5132491074157957
 2. 正常返回示例
 HTTP/1.1 200 OK
 Content-Type:application/json
 {
     "RequestId": "123456789",
     "Data": [
     {
         "COMMAND": "ccos-inspection",
         "PID": "1568496",
         "RES": "70.47",
         "USER": "root",
         "VIRT": "738.84",
         "CpuRate": "95.2",
         "MemRate": "0.0"
     },
     {
         "COMMAND": "des-core",
         "PID": "1555140",
         "RES": "947.01",
         "USER": "root",
         "VIRT": "5288.79",
         "CpuRate": "47.6",
         "MemRate": "0.4"
     },
     {
         "COMMAND": "containerd",
         "PID": "1461626",
         "RES": "373.30",
         "USER": "root",
         "VIRT": "26009.60",
         "CpuRate": "42.9",
         "MemRate": "0.1"
     }
     ],
     "Total": 3
 }

1.9 GetServerFileMonitor

 文件。

1.9.1 使用说明

 GET https://{endpoint}/manage/infra/v1.0/infra/files/${deviceId}

1.9.2 请求参数

 表1-22 URL 参数

image.png

1.9.3 返回数据

image.png

 表1-23 FileData

image.png

1.9.4 示例

 1. 请求示例
 GET https://{endpoint}/manage/infra/v1.0/infra/files/5132491074157957
 2. 正常返回示例
 HTTP/1.1 200 OK
 Content-Type:application/json
 {
     "RequestId": "123456789",
     "Total": 1,
     "Data": [
     {
         "Filename": ".",
         "Size": "18T",
         "Uptime": ""
     }
     ]
 }

1.10 GetServerHardwareMonitor

 硬件监控。

1.10.1 使用说明

 GET https://{endpoint}/manage/infra/v1.0/infra/hardware/${deviceId}

1.10.2 请求参数

 表1-24 URL 参数

image.png

1.10.3 返回数据

image.png

image.png

 表1-25 HardwareData

image.png

1.10.4 示例

 1. 请求示例
 GET https://{endpoint}/manage/infra/v1.0/infra/hardware/5132491074157957
 2. 正常返回示例
 HTTP/1.1 200 OK
 Content-Type:application/json
 {
     "RequestId": "123456789",
     "Total": 1,
     "Data": [
     {
         "Basic": {
             "Key1":"value1",
             "Key2":"value2"
         },
         "Fun": {
             "Key1":"value1",
             "Key2":"value2"
         },
         "Cpu": {
             "Key1":"value1",
             "Key2":"value2"
         },
         "Other": {
             "Key1":"value1",
             "Key2":"value2"
         },
         "Power": {
             "Key1":"value1",
             "Key2":"value2"
         },
     }
     ]
 }

1.11 GetSwitchBaseMonitor

 交换机基础监控。

1.11.1 使用说明

 GET https://{endpoint}/manage/infra/v1.0/infra/snmp/monitor/base/${deviceId}

1.11.2 请求参数

 表1-26 URL 参数

image.png

1.11.3 返回数据

image.png

 表1-27 SNMPBaseMonitorData

image.png

image.png

1.11.4 示例

 1. 请求示例
 GET https://{endpoint}/manage/infra/v1.0/infra/snmp/monitor/base/5117838090528453
 2. 正常返回示例
 HTTP/1.1 200 OK
 Content-Type:application/json
 {
     "RequestId": "123456789",
     "Data": {
         "AllIP": "10.255.255.134",
         "Name": "MGASW-AG1-P1-2.fsp.cn-beijing",
         "CpuUseRate": "65",
         "MemUseRate": "41"
     }
 }

1.12 GetSwitchPortMonitor

 交换机接口监控。

1.12.1 使用说明

 GET https://{endpoint}/manage/infra/v1.0/infra/snmp/monitor/interface/${DeviceId}

1.12.2 请求参数

 表1-28 URL 参数

image.png

 表1-29 Param 参数

image.png

image.png

1.12.3 返回数据

image.png

 表1-30 MonitorInterfaceData

image.png

1.12.4 示例

 1. 请求示例
 GET https://{endpoint}/manage/infra/v1.0/infra/snmp/monitor/interface/5117838090528453
 2. 正常返回示例
 HTTP/1.1 200 OK
 Content-Type:application/json
 {
     "RequestId": "123456789",
     "Data": [
     {
         "InErrorRate": "0",
         "InOctetRate": "0.00",
         "InterfaceName": "gigabitethernet0/0/1",
         "ManagerStatus": "down",
         "OperationStatus": "up",
         "OutNUcastPktRate": "0",
         "OutOctetRate": "3299.00",
         "OutUcastPktRate": "0",
         "SwitchStatus": "down",
         "Protocol": "unknow"
     },
     {
         "InErrorRate": "0",
         "InOctetRate": "0.00",
         "InterfaceName": "gigabitethernet0/0/2",
         "ManagerStatus": "down",
         "OperationStatus": "up",
         "OutNUcastPktRate": "0",
         "OutOctetRate": "2296.00",
         "OutUcastPktRate": "0",
         "SwitchStatus": "down",
         "Protocol": "unknow"
     },
     {
         "InErrorRate": "0",
         "InOctetRate": "0.00",
         "InterfaceName": "gigabitethernet0/0/3",
         "ManagerStatus": "down",
         "OperationStatus": "up",
         "OutNUcastPktRate": "0",
         "OutOctetRate": "3284.00",
         "OutUcastPktRate": "0",
         "SwitchStatus": "down",
         "Protocol": "unknow"
     },
     {
         "InErrorRate": "0",
         "InOctetRate": "0.00",
         "InterfaceName": "gigabitethernet0/0/4",
         "ManagerStatus": "down",
         "OperationStatus": "up",
         "OutNUcastPktRate": "0",
         "OutOctetRate": "1030.00",
         "OutUcastPktRate": "0",
         "SwitchStatus": "down",
         "Protocol": "unknow"
     },
     {
         "InErrorRate": "0",
         "InOctetRate": "0.00",
         "InterfaceName": "gigabitethernet0/0/5",
         "ManagerStatus": "down",
         "OperationStatus": "up",
         "OutNUcastPktRate": "0",
         "OutOctetRate": "1060.00",
         "OutUcastPktRate": "0",
         "SwitchStatus": "down",
         "Protocol": "unknow"
     }
     ],
     "Total": 5
 }

1.13 CreateDevice

 创建设备。

1.13.1 使用说明

 POST https://{endpoint}/manage/cmdb/v1.0/topo/create/instance/object/device

1.13.2 请求参数

 表1-31 body 参数

image.png

image.png

image.png

1.13.3 返回数据

image.png

 表1-32 ResultData

image.png

 表1-33 Data

image.png

1.13.4 示例

 1. 请求示例
 POST /manage/cmdb/v1.0/topo/create/instance/object/device
 {
     "BkInstName": "1.1.1.1",
     "AssetNo": "",
     "Sn": "",
     "Ip": "1.1.1.1",
     "Slot": "机位 1",
     "Hostname": "",
     "CategoryId": 239406572200005,
     "ManufacturerId": 5117828377700037,
     "DeviceModel": "",
     "RegionId": 4980556136619653,
     "IdcId": 4980556719234693,
     "ColoId": 4980557480173189,
     "CabinetId": 4980558176493189,
     "SlotId": "4980558874975877",
     "CpuCoreCount": "",
     "MemCapacity": "",
     "DiskCapacity": "",
     "NetworkCard": "",
     "GpuCard": "",
     "IpmiIp": "",
     "BmcIp": "",
     "BmcMac": "",
     "Desc": "",
     "AssetStatus": "in_use",
     "Cabinet": "机柜 1",
     "CategoryName": "服务器",
     "Colo": "机房 1",
     "DeviceStatus": "online",
     "EquipmentExpiredDate": "",
     "FilePath": "",
     "FirstDiscovered": "",
     "Idc": "idc1",
     "KenelVersion": "",
     "Label": "",
     "LastDiscovered": "",
     "MaintenanceExpiredDate": "",
     "Manufacturer": "迈普",
     "Region": "北京 1",
     "RunStatus": 4,
     "Source": "2",
     "SystemVersion": "",
     "Uuid": ""
 }
 2. 正常返回示例
 HTTP/1.1 200 OK
 Content-Type:application/json
 {
     "RequestId": "",
     "ResultData": {
         "Result": true,
         "Data": {
             "BkInstId": 5326132133269957
         }
     }
 }

1.14 DeleteDevice

 删除设备。

1.14.1 使用说明

 DELETE https://{endpoint}/manage/cmdb/v1.0/topo/delete/instance/object/device/inst/${id}

1.14.2 请求参数

 表1-34 URL 参数

image.png

1.14.3 返回数据

image.png

 表1-35 ResultData

image.png

image.png

1.14.4 示例

 1. 请求示例
 DELETE
 https://{endpoint}/manage/cmdb/v1.0/topo/delete/instance/object/device/inst/5131987185876357
 2. 正常返回示例
 HTTP/1.1 200 OK
 Content-Type:application/json
 {
     "RequestId": "123456789",
     "ResultData": {
         "Result": true,
         "Code": 0,
         "Message": "success",
         "Data": null
     }
 }

1.15 DeleteDevices

 批量删除设备。

1.15.1 使用说明

 DELETE https://{endpoint}/manage/cmdb/v1.0/topo/delete/instance/object/device

1.15.2 请求参数

 表1-36 body 参数

image.png

1.15.3 返回数据

image.png

 表1-37 ResultData

image.png

1.15.4 示例

 1. 请求示例
 DELETE https://{endpoint}/manage/cmdb/v1.0/topo/delete/instance/object/device
 Body 参数:[5002155709178949,4980565051350661]
 2. 正常返回示例
 HTTP/1.1 200 OK
 Content-Type:application/json
 {
     "RequestId": "123456789",
     "ResultData": {
         "Result": true,
         "Code": 0,
         "Message": "success",
         "Data": null
     }
 }

1.16 GetDeviceCatalogueMonitor

 设备目录监控。

1.16.1 使用说明

 GET https://{endpoint}/manage/cmdb/v1.0/topo/device/category

1.16.2 请求参数

 无

1.16.3 返回数据

image.png

 表1-38 ResultData

image.png

 表1-39 RegionData

image.png

 表1-40 IdcData

image.png

 表1-41 ColoData

image.png

image.png

 表1-42 CabinetData

image.png

 表1-43 SlotData

image.png

1.16.4 示例

 1. 请求示例
 GET https://{endpoint}/manage/cmdb/v1.0/topo/device/category
 2. 正常返回示例
 HTTP/1.1 200 OK
 Content-Type:application/json
 {
     "RequestId": "123456789",
     "ResultData": {
         "Result": true,
         "Code": 0,
         "Message": "success",
         "Data": [
         {
             "RegionId": 4980556136619653,
             "RegionName": "北京 1",
             "IdcList": [
             {
                 "IdcId": 4980556719234693,
                 "IdcName": "idc1",
                 "ColoList": [
                 {
                     "coloId": 4980557480173189,
                     "ColoName": "机房 1",
                     "CabinetList": [
                     {
                         "CabinetId": 4980558176493189,
                         "CabinetName": "机柜 1",
                         "SlotList": [
                         {
                             "SlotId": 5139245985655557,
                             "SlotName": "数据来源测试"
                         }
                         ]
                     }
                     ]
                 }
                 ]
             }
             ]
         },
         {
             "RegionId": 5002080516286085,
             "RegionName": "test6",
             "IdcList": null
         }
         {
             "RegionId": 5032047035294789,
             "RegionName": "test0727",
             "IdcList": null
         },
         {
             "RegionId": 5032559335503493,
             "RegionName": "resr1111",
             "IdcList": null
         },
         {
             "RegionId": 5139342658271429,
             "RegionName": "ddd",
             "IdcList": [
             {
                 "IdcId": 5195702804074245,
                 "IdcName": "idc-20220825",
                 "ColoList": [
                 {
                     "coloId": 5195714860140485,
                     "ColoName": "jifang-0825",
                     "CabinetList": [
                     {
                         "CabinetId": 5195717722425285,
                         "CabinetName": "jigui-0825",
                         "SlotList": [
                         {
                             "SlotId": 5195719991217925,
                             "SlotName": "jiwei-0825"
                         }
                         ]
                     }
                     ]
                 }
                 ]
             }
             ]
         },
         {
             "RegionId": 5139389466900677,
             "RegionName": "dddxxxx",
             "IdcList": null
         },
         {
             "RegionId": 5139536448944325,
             "RegionName": "xxsssse1",
             "IdcList": null
         }
         ]
     }
 }

意见反馈

文档内容是否对您有帮助?

如您有其他疑问,您也可以通过在线客服来与我们联系探讨 在线客服

联系我们
回到顶部