Collection API

When calling the API, you need to set the agentId in the request header, and the response content will be in JSON format. All time-related parameters are expected to be in the form of timestamps.

In some cases, you will need to use hostId, agentId, clusterId, and eventId as parameters:

  • hostId is obtained from the "Retrieve Basic Host Information by Hostname" API.
  • agentId is obtained from the "Generate Agent ID" API.
  • eventId is found in the "Get Cluster Log Information" API.
  • clusterId is obtained from the "Retrieve MongoDB Cluster Information" API.

Default Request Header Format

The agentId is obtained from the "Generate Agent ID" API.

KEY VALUE
Accept-Encoding gzip,deflate,br
Connection keep-alive
Content-Type application/json
agentId "agentId"


1 Save Agent's Log Record

1.1 Request Path

POST: http://{Server-Host}:{Port}/api/collection/host/save/log


1.2 Request Parameters

Name Located in Description Required Schema
agentLogEntity Body Log information entity Yes AgentLogEntity

img_2.png


1.3 Response

Description Schema
code Status code: 1000 for success, others for exceptions int
msg Response message String

img_1.png



2 Update Agent's MongoDB File Information

2.1 Request Path

POST: http://{Server-Host}:{Port}/api/collection/host/updateAgentMongoFile/


2.2 Request Parameters

Name Located in Description Required Schema
agentId Path Agent ID Yes String
mongoFileList Body List of MongoDB files Yes List

img_4.png


Ex. Update Agent's MongoDB File Information; where MongoFileList is shown below:

[
    {
        "_id": "62d62a9bbfa6b71dad85b68a",
        "createTime": "1658202779363",
        "hostId": "62b153a344ba1b7771c42df7",
        "md5": "1",
        "name": "mongodb-linux-x86_64-enterprise-rhel70-4.4.14.tgz",
        "path": "/var/ops/agent/mongodb-linux-x86_64-enterprise-rhel70-4.4.14.tgz",
        "server": false,
        "shortName": "mongodb-linux-x86_64-enterprise-rhel70-4.4.14",
        "size": 133646249,
        "updateTime": "1658202779363"
    }
]

2.3 Response

Description Schema
code Status code: 1000 for success, others for exceptions int
msg Response message String

img_30.png



3 Query Pending Commands for an Agent

3.1 Request Path

GET: http://{Server-Host}:{Port}/api/collection/command/getCommand/


3.2 Request Parameters

Name Located in Description Required Schema
hostId Path Host ID Yes String

img.png


3.3 Response

Description Schema
code Status code: 1000 for success, others for exceptions int
data Returned data List
{
    "code": 1000,
    "data": [
        {
            "id": "632bfca83b74be1d9fe7ddb7",
            "createTime": 1663827112988,
            "updateTime": 1663827112988,
            "hostId": "630eddeff3d9e72e3695ea48",
            "commandType": 101,
            "status": 0,
            "eventId": null,
            "commandNote": "updateHostInfo",
            "content": "\"updateHostInfo\"",
            "execResult": null
        }
    ]
}


4 Update Status of Command Entity

4.1 Request Path

PUT: http://{Server-Host}:{Port}/api/collection/command/update


4.2 Request Parameters

Name Located in Description Required Schema
commandEntity Body Command entity Yes
        |   CommandEntity

img_6.png


Ex. Update the status of the command entity; where CommandEntity is shown below:

{
    "id": "62c54a395dc04d3d4c13be75",
    "commandNote": "server100:20190获取集群角色",
    "commandType": 221,
    "content": "{}",
    "createTime": "1657096761802",
    "execResult": "已完成",
    "hostId": "62b153a344ba1b7771c42df7",
    "status": 3,
    "updateTime": "1657096769089"
}

4.3 Response

Description Schema
code Status code: 1000 for success, others for exceptions int
data Response message String

img_5.png



5 Update Agent Heartbeat Information

5.1 Request Path

GET: http://{Server-Host}:{Port}/api/collection/host/updateRunTime//


5.2 Request Parameters

Name Located in Description Required Schema
hostId Path Host ID Yes String
timeStamp Path Timestamp Yes String

img_7.png


5.3 Response

Description Schema
code Status code: 1000 for success, others for exceptions int
msg Response message String

img_7.png



6 Save Host Information

6.1 Request Path

POST: http://{Server-Host}:{Port}/api/collection/hostInfo


6.2 Request Parameters

Name Located in Description Required Schema
hostInfoMongoEntity Body Host information entity Yes HostInfoMongoEntity

img_8.png


Ex. Save host information; where HostInfoMongoEntity is shown below:

{
    "_id": "62cbbd7607bebb71b8429e5e",
    "cpuInfo": " Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz",
    "cpuNum": 40,
    "hostId": "62cbbd7607bebb71b8429e5e",
    "hostName": "server200",
    "hostNameLong": "server200",
    "ipInfo": [
        {
            "ip": "172.17.0.1",
            "type": "ipv4"
        }
    ],
    "kernelInfo": "3.10.0-1062.el7.x86_64",
    "osVersion": "CentOS Linux release 7.7.1908 (Core)",
    "run": true,
    "systemPropertyInfo": {
        "fileSeparator": "/",
        "javaClassPath": "agent-collection-1.0.0.jar",
        "javaClassVersion": "55.0",
        "javaHome": "/root/jdk-11.0.9",
        "javaIoTmpdir": "/tmp",
        "javaLibraryPath": "/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib",
        "javaSpecificationName": "Java Platform API Specification",
        "javaSpecificationVendor": "Oracle Corporation",
        "javaVendor": "Oracle Corporation",
        "javaVersion": "11.0.9",
        "javaVmName": "Java HotSpot(TM) 64-Bit Server VM",
        "javaVmSpecificationName": "Java Virtual Machine Specification",
        "javaVmSpecificationVersion": "11",
        "javaVmVendor": "Oracle Corporation",
        "javaVmVersion": "11.0.9+7-LTS",
        "lineSeparator": "\n",
        "oSArch": "amd64",
        "oSName": "Linux",
        "oSVersion": "3.10.0-1062.el7.x86_64",
        "pathSeparator": ":",
        "userDir": "/home/jmops",
        "userHome": "/root",
        "userName": "root"
    }
}

6.3 Response

Description Schema
code Status code: 1000 for success, others for exceptions int
msg Response message String

img_9.png



7 Save Real-Time Host Information

7.1 Request Path

POST: http://{Server-Host}:{Port}/api/collection/host/addHostRealTimeData


7.2 Request Parameters

Name Located in Description Required Schema
hostRealTimeDataMongoEntity Body Real-time host information entity Yes HostRealTimeDataMongoEntity

img_9.png


Ex. Save real-time host information; where hostRealTimeDataMongoEntity is shown below:

{
    "_id": "62c64f99f9872b46f1ce953a",
    "cpuInfo": {
        "hi": 0,
        "id": 98.1,
        "ni": 0,
        "si": 0,
        "st": 0,
        "sy": 0.9,
        "us": 1,
        "wa": 0
    },
    "createTime": "1657163672000",
    "diskInAndOutInfoList": [
        {
            "avgqu_sz": 0.05,
            "avgrq_sz": 18.89,
            "await": 0.34,
            "device": "sda",
            "r_await": 13.32,
            "r_s": 0.17,
            "rkB_s": 10.82,
            "rrqm_s": 0.

06,
            "svctm": 0.05,
            "util": 0.75,
            "w_await": 0.32,
            "w_s": 144.65,
            "wkB_s": 1357.06,
            "wrqm_s": 2.03
        }
    ],
    "diskInfoList": [
        {
            "fileSystem": "devtmpfs",
            "mountedOn": "/dev",
            "size": 64349,
            "type": "devtmpfs",
            "used": 0,
            "utilization": 0
        }
    ],
    "hostId": "62b153a344ba1b7771c42df7",
    "hostName": "server100",
    "memoryInfo": {
        "memAvail": 95150,
        "memBuffCache": 26138,
        "memFree": 69641,
        "memTotal": 128722,
        "memUsed": 32942,
        "swapFree": 1958,
        "swapTotal": 4095,
        "swapUsed": 2137
    },
    "netInAndOutInfoList": [
        {
            "io": 0,
            "networkCardName": "em3:",
            "out": 0
        }
    ],
    "timeGranularity": 1,
    "updateTime": "1657163672000"
}

7.3 Response

Description Schema
code Status code: 1000 for success, others for exceptions int
data Response message String

img_11.png



8 Agent Calls to Get Server Time

8.1 Request Path

GET: http://{Server-Host}:{Port}/api/collection/util/get/server/date


8.2 Request

img_12.png


8.3 Response

Description Schema
code Status code: 1000 for success, others for exceptions int
data Timestamp long

img_13.png



9 Agent Retrieves its IP Address

9.1 Request Path

GET: http://{Server-Host}:{Port}/api/collection/util/get/agent/ip


9.2 Request

img_14.png


9.3 Response

Description Schema
code Status code: 1000 for success, others for exceptions int
data IP address String

img_15.png



10 Logging to MongoDB

10.1 Request Path

POST: http://{Server-Host}:{Port}/api/collection/mongodb/insertMongoClusterLog//


10.2 Request Parameters

Name Located in Description Required Schema
clusterId Path Cluster ID Yes String
eventId Path Event ID Yes String
logList Body List of logs Yes List

img_10.png


10.3 Response

Description Schema
code Status code: 1000 for success, others for exceptions int
data Response message String

img_1.png




11 Insert MongoDB Member Log

11.1 Request Path

POST: http://{Server-Host}:{Port}/api/collection/mongodb/insertMongoMemberLog///


11.2 Request Parameters

Name Located in Description Required Schema
clusterId Path Cluster ID Yes String
memberInfo Path Member Info Yes String
eventId Path Event ID Yes String
logList Body Log List Yes List


img_11.png


11.3 Response

Description Schema
code Status Code: 1000 for success, others for exceptions int
data Response Message String


img_3.png



12 Update MongoDB Node Information

12.1 Request Path

POST: http://{Server-Host}:{Port}/api/collection/mongodb/updateMongoMember


12.2 Request Parameters

Name Located in Description Required Schema
mongoMember Body MongoDB Cluster Member Yes MongoMember


img_13.png

Example: Update MongoDB node information; where MongoMember is as follows:
{
  "id": "62f76749e011b442d7c91ec6",
  "createTime": 0,
  "updateTime": 1660466332000,
  ...
  "operateVersion": 5723
}

12.3 Response

Description Schema
code Status Code: 1000 for success, others for exceptions int
data Response Message String


img_5.png



13 Update Replica Set Information

13.1 Request Path

POST: http://{Server-Host}:{Port}/api/collection/mongodb/updateMongoRepl/


13.2 Request Parameters

Name Located in Description Required Schema
isUpdateMemberList Path Update Member List Yes boolean
mongoReplica Body MongoDB Replica Set Yes MongoReplica


img_14.png


13.3 Response

Description Schema
code Status Code: 1000 for success, others for exceptions int
data Response Message String


img_7.png



14 Update Cluster Information

14.1 Request Path

POST: http://{Server-Host}:{Port}/api/collection/mongodb/updateCluster


14.2 Request Parameters

Name Located in Description Required Schema
mongoClusterInformation Body MongoDB Cluster Information Yes MongoClusterInformation


img_15.png


14.3 Response

Description Schema
code Status Code: 1000 for success, others for exceptions int
data Response Message String


img_9.png



15 Save Real-Time Information of MongoDB Members

15.1 Request Path

POST: http://{Server-Host}:{Port}/api/collection/mongodb/realtime


15.2 Request Parameters

Name Located in Description Required Schema
tableName Path Table Name Yes String
mongodbNodeMetrics Body MongoDB Real-Time Data Yes MongodbNodeMetrics


img_16.png

Example: Save real-time information of a MongoDB member; where MongodbNodeMetrics is as follows:
{
    "anAssert": {
        "msg": 0,
        "regular": 0,
        "user": 0,
        "warning": 0
    },
    "cacheFlow": {
        "brin": 8717624,
        "bwfr": 6421369
    }
    "createTime": "1660469450000",
    ...
    "operateVersion": 8168
}

15.3 Response

Description Schema
code Status Code: 1000 for success, others for exceptions int
data File Offset long


img_11.png



Deprecated (No Longer Used)

16 Save Batch of Monitoring Data to Database

16.1 Request Path

POST: http://{Server-Host}:{Port}/api/collection/mongodb/realtime/save/many


16.2 Request Parameters

Name Located in Description Required Schema
mongoDBRealtimeDataEntityList Body List of Real-Time Data Yes List


![img_12.png](../../../images/whalealPlatformImages//realtime_save_many.png

)


16.3 Response

Description Schema
code Status Code: 1000 for success, others for exceptions int
data Response Message String


img_13.png



17 Get MongoDB Node Information on Agent Instance

17.1 Request Path

POST http://{Server-Host}:{Port}/api/collection/mongodb/getAgentMongoMember/


17.2 Request Parameters

Name Located in Description Required Schema
agentId Path Agent ID Yes String


img_17.png


17.3 Response

Description Schema
code Status Code: 1000 for success, others for exceptions int
data Returned Data List


{
    "code": 1000,
    "data": [
        {
            "id": "62d6506ec5b6206027b99052",
            "createTime": 1658212462005,
            "updateTime": 1658302192001,
            ...
            "operateVersion": 8168
        }
    ]
}


18 Save mongo.log Log

18.1 Request Path

POST: http://{Server-Host}:{Port}/api/collection/mongodb/save/mongoLog//


18.2 Request Parameters

Name Located in Description Required Schema
mongoMemberId Path MongoDB member ID Yes String
fileOffset Path File offset Yes long
logList Body Log list Yes List


img_18.png


18.3 Response

Description Schema
code Status code: 1000 for success, others for exceptions int
data File offset long


img_16.png



19 Save Mongo Top and Op

19.1 Request Path

POST: http://{Server-Host}:{Port}/api/collection/mongodb/save/mongoTopAndOp


19.2 Request Parameters

Name Located in Description Required Schema
documentList Body Document list Yes List


img_19.png


19.3 Response

Description Schema
code Status code: 1000 for success, others for exceptions int
data Response message String


img_18.png



20 Update FCV

20.1 Request Path

GET: http://{Server-Host}:{Port}/api/collection/mongodb/updateFCV//


20.2 Request Parameters

Name Located in Description Required Schema
clusterId Path Cluster ID Yes String
fcv Path FCV Yes String


img_19.png


20.3 Response

Description Schema
code Status code: 1000 for success, others for exceptions int
data Response message String


img_20.png



21 Save MongoDB Collections

21.1 Request Path

POST: http://{Server-Host}:{Port}/api/collection/mongodb/saveMongoDBCollections


21.2 Request Parameters

Name Located in Description Required Schema
mongoDBCollections Body MongoDB actual collections Yes MongoDBCollections


Example: Save MongoDB collections; where MongoDBCollections is as follows:
{
    "_id" : "62ea1db298c0825187aee96e",
    "clusterId" : "62ea1db298c0825187aee96e",
    "createTime" : "1659686288006",
    "dbTables" : [
        {
            "name" : "fs.files",
            "type" : "collection",
            "options" : {

            },
            "info" : {
                "readOnly" : false,
                "uuid" : {
                    "type" : 4,
                    "data" : "q/X3q+2aQVC9dGCnS4wKZA=="
                }
            },
            "idIndex" : {
                "v" : 2,
                "key" : {
                    "_id" : 1
                },
                "name" : "_id_",
                "ns" : "record.fs.files"
            },
            "storageSize" : 20,
            "size" : 16,
            "ns" : "record.fs.files"
        }
    ],
    "fromServerExe" : false,
    "updateTime" : 0
}

img_12.png


21.3 Response

Description Schema
code Status code: 1000 for success, others for exceptions int
data Response message String


img_22.png



22 Save MongoDB Cluster User

22.1 Request Path

POST: http://{Server-Host}:{Port}/api/collection/mongodb/saveMongoDBClusterUser/


22.2 Request Parameters

Name Located in Description Required Schema
clusterId Path Cluster ID Yes String
list Body Document list Yes List


img_23.png

Example: Save MongoDB cluster users; where List is as follows:
[{
    "name" : "hostRealTimeDataMongoEntity",
    "type" : "collection",
    "options" : {    
    },
    "storageSize" : 8836,
    "size" : 44721,
    "ns" : "ops.hostRealTimeDataMongoEntity",
    "indexSizes" : {
        "_id_" : 248,
        "createTime_1" : 152,
        "hostId_1" : 84,
        "hostId_1_createTime_1_timeGranularity_1" : 172
    }
}]

22.3 Response

Description Schema

|----------------------|--------------------------- | code | Status code: 1000 for success, others for exceptions | int |
| data | Response message | String |


img_24.png



23 Save MongoDB Cluster Role

23.1 Request Path

POST: http://{Server-Host}:{Port}/api/collection/mongodb/saveMongoDBClusterRole/


23.2 Request Parameters

Name Located in Description Required Schema
clusterId Path Cluster ID Yes String
list Body Document list Yes List


img_25.png


23.3 Response

Description Schema
code Status code: 1000 for success, others for exceptions int
data Response message String


img_26.png


24 Save Diagnostic Data.

24.1 Request Path

POST: http://{Server-Host}:9601/api/collection/mdiag/saveMdiagLog


24.2 Request Parameters

Name Located in Description Required Schema
document Body Diagnostic log Yes Document


img_20.png


24.3 Response

Description Schema
code Status code: 1000 for success, others for exceptions int
data Response message String


img_21.png



24 Get Config Information.

24.1 Request Path

GET http://{Server-Host}:9601/api/collection/config/getConfig


24.2 Request Parameters


img_22.png


24.3 Response

Description Schema
code Status code: 1000 for success, others for exceptions int
data Return data ConfigEntity

img_23.png


---

results matching ""

    No results matching ""