API

一、安装json解析工具

npm install -g json

二、返回数据统一格式

名称 类型 描述
code Integer 0:正常;1:异常
message String 状态信息
data String 业务数据

三、获取token

地址:http://work.bigops.com/api/bigops/v1/auth

方法:POST

请求参数:

名称 类型 必须 描述
account String 用户账号
password String 用户密码

例子:

执行命令:

curl -s -X POST -H "Content-Type: application/json" -d '{"account":"xxxxxx","password":"xxxxxx"}' http://work.bigops.com/api/bigops/v1/auth | json

成功返回值:

{"code":0,"message":"ok","data":"b0a2e800dd524f9c9a9cef87ef479d74"}

错误返回值:

{"code": 1,"message": "token错误,令牌无效,请重新登录"}

四、服务树信息

说明:显示登录用户有权限的服务树节点信息

地址:http://work.bigops.com/api/bigops/v1/servicepath?token=xxxxxx

方法:POST

请求参数:

名称 类型 必须 描述
token String 用户token

例子

curl -X POST "http://work.bigops.com/api/bigops/v1/servicepath?token=b0a2e800dd524f9c9a9cef87ef479d74" -H "accept: */*" | json

返回数据:

{
  "code": 0,
  "message": "ok",
  "data": [
    {
      "path": "业务服务",
      "id": 1
    },
    {
      "path": "业务服务/研发部/测试环境/test/aa",
      "id": 209
    }
  ]
}

五、主机信息

说明:根据服务树id,查找主机

地址:http://work1.bigops.com/api/bigops/v1/hostlistbyservice?token=xxxxxx

方法:POST

请求参数:

名称 类型 必须 描述
token String 用户token
serviceId String 服务树id

例子:

curl -X POST "http://work.bigops.com/api/bigops/v1/hostlistbyservice?token=b0a2e800dd524f9c9a9cef87ef479d74" -H "accept: */*" -H "Content-Type: application/json" -d '{ "serviceId": 24}' | json

{
  "code": 0,
  "message": "ok",
  "data": [
    {
      "ipmiIp": null,
      "wanVip": null,
      "ipmiTestStatus": 2,
      "deliveryOrderNumber": null,
      "megacliSupport": false,
      "productName": "Alibaba Cloud ECS",
      "lanVip": null,
      "hostname": "172.31.173.22",
      "price": null,
      "supplier": null,
      "ctime": "2020-07-30 17:26:12",
      "zbxAgentVersion": "4.4.10",
      "id": 35,
      "cpuCount": 1,
      "height": 35,
      "bwBillingDetail": null,
      "imageId": null,
      "instanceSpecsFamily": null,
      "ak": "",
      "ipmiAllowTest": false,
      "adpStatus": "异常",
      "agentMtime": "2021-06-23 11:37:02",
      "aiChipType": null,
      "pdiskStatus": "正常",
      "status": "启用",
      "template": "3",
      "aiChipCount": null,
      "virtType": "kvm",
      "diskTotal": 1058070,
      "assetTag": null,
      "distribution": "CentOS",
      "eip": null,
      "current": 5,
      "wanVipv6": null,
      "instanceId": null,
      "hwModel": null,
      "hwStatus": "正常",
      "ipmiSupport": false,
      "wanIpv6": null,
      "cspZone": null,
      "instanceNetworkType": null,
      "power": 15,
      "specsBilling": null,
      "architecture": "x86_64",
      "bwLineType": null,
      "ipmiTestTime": null,
      "kernel": "3.10.0-1160.15.2.el7.x86_64",
      "bwBillingType": null,
      "predictiveFailureThr": 10,
      "updateTime": "2021-06-22 23:15:02",
      "systemCat": "Linux",
      "ipmiUser": null,
      "megacliRaidModel": null,
      "instanceSpecs": null,
      "productVendor": "alibaba",
      "nodename": "bigops001",
      "distributionMajorVersion": "7",
      "hwlogVendorTool": "无",
      "debugMtime": null,
      "maintenanceEtime": null,
      "exporterConfigScript": "",
      "ldiskStatus": "正常",
      "mtime": "2021-06-23 11:37:01",
      "wanIp": null,
      "instanceBillingType": null,
      "racModel": null,
      "distributionVersion": "7.9",
      "lanVipv6": null,
      "productSerial": "0dac1d18-0255-4a1a-80b2-302e1d19ed89",
      "bwBillingModel": null,
      "hwStatusDetail": null,
      "renewalStatus": null,
      "contractNumber": null,
      "bigproxy": 9,
      "cpuCores": 2,
      "racUrl": null,
      "ipmiPass": null,
      "name": "gitlab",
      "position": 3,
      "projectName": null,
      "lanIp": "172.31.173.22",
      "megacliMtime": "2021-06-16 23:41:52",
      "creationTime": null,
      "instanceName": null,
      "remark": null,
      "exporterInstallJob": "[11]",
      "predictiveFailureCount": 10,
      "zbxHostid": null,
      "zbxAgentMtime": "2021-02-25 13:20:02",
      "aiChipModel": null,
      "debug": false,
      "specsBillingModel": null,
      "memTotal": 32012,
      "resCatId": 5,
      "hwMtime": null,
      "buyTime": null,
      "vcpus": 4,
      "bwBilling": null,
      "expiredTime": null,
      "maxBw": null,
      "monAppLldEnable": true,
      "purchaseOrderNumber": null,
      "lanIpv6": null,
      "agentVersion": "5.0.2.1"
    }
  ]
}

六、用户信息

说明:根据Account名字,显示用户详细信息

地址:http://work.bigops.com/api/bigops/v1/describeUsers?token=xxxxxx

方法:POST

请求参数:

名称 类型 必须 描述
token String 用户token
userAccounts String 用户账号

例子

curl -X POST "http://work.bigops.com/api/bigops/v1/user/detail?token=b0a2e800dd524f9c9a9cef87ef479d74" -H "accept: */*" -H "Content-Type: application/json" -d '{ "userAccounts": [ "admin" ]}' | json

返回数据:

{
  "code": 0,
  "message": "ok",
  "data": [
    {
      "template": null,
      "leader": null,
      "mtime": "2021-06-19 01:52:06",
      "title": null,
      "dingding": null,
      "bindSales": null,
      "mfaSecretkey": null,
      "resetPassTime": "2021-03-19 14:25:04",
      "nickname": null,
      "ctime": "2019-12-24 17:32:14",
      "id": 1,
      "ssoMfa": "禁用",
      "email": "xxx@qq.com",
      "overBwUnitPrice": null,
      "debug": null,
      "sshPubkey": "ssh-rsa ",
      "resCatId": 2,
      "mobile": null,
      "ak": null,
      "avatar": null,
      "testname": null,
      "weixin": null,
      "debugMtime": null,
      "phone": null,
      "etime": null,
      "rtx": "xxxx",
      "name": "管理员",
      "feishu": null,
      "overPowerUnitPrice": null,
      "account": "admin",
      "status": "启用"
    }
  ]
}

七、网管用户连接信息

说明:根据主机id,显示网管用户连接信息

地址:http://work1.bigops.com/api/bigops/v1/hostuserbyhost?token=xxxxxx

方法:POST

请求参数:

名称 类型 必须 描述
token String 用户token
hostId Number 主机id

例子

curl -X POST "http://work1.bigops.com/api/bigops/v1/hostuserbyhost?token=b0a2e800dd524f9c9a9cef87ef479d74" -H "accept: */*" -H "Content-Type: application/json" -d '{ "hostId": 6}' | json

返回数据:

{
  "code": 0,
  "message": "ok",
  "data": {
    "id": 5137,
    "hostId": 6,
    "ip": "172.31.173.25",
    "port": "22",
    "proto": "ssh",
    "user": "root",
    "userType": 1,
    "allowTest": true,
    "testTime": "2021-06-23 14:10:45",
    "testStatus": 1,
    "testMsg": "正确",
    "defaultMode": 2,
    "keypairId": 1,
    "become": "no",
    "becomeMethod": null,
    "becomeUser": null,
    "changepassTime": "2021-06-10 23:45:18",
    "changekeyTime": "2021-06-10 23:45:18",
    "transport": null,
    "remark": null,
    "createType": 2,
    "connectType": "直连",
    "number": null,
    "hostName": null,
    "systemCat": null,
    "proxyName": null,
    "type": null,
    "prikey": "-----BEGIN RSA PRIVATE KEY-----\PvJNQllTjgCLg6+6HY\nw/LUYjKpYA==\n-----END RSA PRIVATE KEY-----\n",
    "pass": "xxxxxx",
    "becomePass": null
  }
}

results matching ""

    No results matching ""