Skip to content

Tencent Cloud MongoDB

Use the "TrueWatch Cloud Sync" script package in the script market to sync cloud monitoring and cloud asset data to TrueWatch

Configuration

Install Func

It is recommended to enable TrueWatch Integration - Extensions - DataFlux Func (Automata): All prerequisites are automatically installed, please proceed with the script installation.

If you are deploying Func yourself, refer to Self-deploying Func

Install Script

Note: Please prepare the Tencent Cloud AK with the required permissions in advance (for simplicity, you can grant the global read-only permission ReadOnlyAccess)

To sync MongoDB cloud resource monitoring data, we install the corresponding collection script: "TrueWatch Integration (Tencent Cloud-MongoDB Collection)" (ID: integration_tencentcloud_mongodb)

Click [Install], then enter the corresponding parameters: Tencent Cloud AK, Tencent Cloud account name.

Click [Deploy Startup Script], the system will automatically create the Startup script set and configure the corresponding startup script.

After enabling, you can see the corresponding automatic trigger configuration in "Manage / Automatic Trigger Configuration". Click [Execute] to immediately execute once without waiting for the scheduled time. After a while, you can check the execution task records and corresponding logs.

We have collected some configurations by default, see the Metrics section for details Configure Custom Cloud Object Metrics

Verification

  1. In "Manage / Automatic Trigger Configuration", confirm whether the corresponding task has the corresponding automatic trigger configuration, and check the corresponding task records and logs for any exceptions.
  2. In TrueWatch, check if asset information exists in "Infrastructure / Custom".
  3. In TrueWatch, check if there is corresponding monitoring data in "Metrics".

Metrics

After configuring Tencent Cloud Cloud Monitoring, the default Measurement is as follows. More Metrics can be collected through configuration Tencent Cloud Cloud Monitoring Metrics Details

Request Class

Metric Name Metric Description Meaning Unit Dimensions
Inserts_sum Write Requests Number of write requests within a unit time Count target (Instance ID)
Reads_sum Read Requests Number of read requests within a unit time Count target (Instance ID)
Updates_sum Update Requests Number of update requests within a unit time Count target (Instance ID)
Deletes_sum Delete Requests Number of delete requests within a unit time Count target (Instance ID)
Counts_sum Count Requests Number of count requests within a unit time Count target (Instance ID)
Success_sum Successful Requests Number of successful requests within a unit time Count target (Instance ID)
Commands_sum Command Requests Number of command requests within a unit time Count target (Instance ID)
Qps_sum Requests Per Second Operations per second, including CRUD operations Count/second target (Instance ID)
CountPerSecond_sum Count Requests Per Second Count requests per second Count/second target (Instance ID)
DeletePerSecond_sum Delete Requests Per Second Delete requests per second Count/second target (Instance ID)
InsertPerSecond_sum Insert Requests Per Second Insert requests per second Count/second target (Instance ID)
ReadPerSecond_sum Read Requests Per Second Read requests per second Count/second target (Instance ID)
UpdatePerSecond_sum Update Requests Per Second Update requests per second Count/second target (Instance ID)

Latency Request Class

Metric Name Metric Description Meaning Unit Dimensions
Delay10_sum Requests with Latency between 10 - 50ms Number of successful requests with latency between 10ms - 50ms within a unit time Count target (Instance ID)
Delay50_sum Requests with Latency between 50 - 100ms Number of successful requests with latency between 50ms - 100ms within a unit time Count target (Instance ID)
Delay100_sum Requests with Latency above 100ms Number of successful requests with latency above 100ms within a unit time Count target (Instance ID)
AvgAllRequestDelay_sum Average Latency of All Requests Average latency of all requests ms target (Instance ID)

Connection Class

Metric Name Metric Description Meaning Unit Dimensions
ClusterConn_max Cluster Connections Total cluster connections, referring to the connections received by the current cluster proxy Count target (Instance ID)
Connper_max Connection Usage Rate Ratio of current cluster connections to total cluster connection configuration % target (Instance ID)

System Class

Metric Name Metric Description Meaning Unit Dimensions
ClusterDiskusage Disk Usage Rate Ratio of current actual storage space usage to total capacity configuration % target (Instance ID)

Inbound/Outbound Traffic Class

Metric Name Metric Description Meaning Unit Dimensions
ClusterNetin Inbound Traffic Cluster network inbound traffic Bytes target (Instance ID)
ClusterNetout Outbound Traffic Cluster network outbound traffic Bytes target (Instance ID)

MongoDB Replica Set

1. System Class

Metric Name Metric Description Meaning Unit Dimensions
ReplicaDiskusage Disk Usage Rate Replica set capacity usage rate % target (Replica Set ID)

2. Master-Slave Class

Metric Name Metric Description Meaning Unit Dimensions
SlaveDelay Master-Slave Latency Average latency between master and slave within a unit time Seconds target (Replica Set ID)
Oplogreservedtime Oplog Retention Time Time difference between the last and first operations in the oplog records Hours target (Replica Set ID)

3. Cache Class

Metric Name Metric Description Meaning Unit Dimensions
CacheDirty Cache Dirty Data Percentage Percentage of dirty data in current memory Cache % target (Replica Set ID)
CacheUsed Cache Usage Percentage Current Cache usage percentage % target (Replica Set ID)
HitRatio Cache Hit Rate Current Cache hit rate % target (Replica Set ID)

Mongo Node

1. System Class

Metric Name Metric Description Meaning Unit Dimensions
CpuUsage CPU Usage Rate CPU usage rate % target (Node ID)
MemUsage Memory Usage Rate Memory usage rate % target (Node ID)
NetIn Network Inbound Traffic Network inbound traffic MB/s target (Node ID)
NetOut Network Outbound Traffic Network outbound traffic MB/s target (Node ID)
Disk Node Disk Usage Node disk usage MB target (Node ID)
Conn Connections Number of connections Count target (Node ID)
ActiveSession Active Session Count Number of active sessions Count target (Node ID)
NodeOplogReservedTime Oplog Retention Time Node oplog retention time - target (Node ID)
NodeHitRatio Cache Hit Rate Cache hit rate % target (Node ID)
NodeCacheUsed Cache Usage Percentage Cache memory as a percentage of total memory % target (Node ID)
NodeSlavedelay Master-Slave Latency Slave node latency s target (Node ID)
Diskusage Node Disk Usage Rate Node disk usage rate % target (Node ID)
Ioread Disk Read Count Disk read IOPS Count/second target (Node ID)
Iowrite Disk Write Count Disk write IOPS Count/second target (Node ID)
NodeCacheDirty Cache Dirty Data Percentage Percentage of dirty data in Cache % target (Node ID)

2. Read/Write Class

Metric Name Metric Description Meaning Unit Dimensions
Qr Read Request Queue Count Number of read requests in the waiting queue Count target (Node ID)
Qw Write Request Queue Count Number of write requests in the waiting queue Count target (Node ID)
Ar WT Engine ActiveRead Number of active read requests Count target (Node ID)
Aw WT Engine ActiveWrite Number of active write requests Count target (Node ID)

3. Latency & Request Class

Metric Name Metric Description Meaning Unit Dimensions
NodeAvgAllRequestDelay Average Latency of All Requests Average latency of all requests on the node ms target (Node ID)
NodeDelay100 Requests with Latency above 100ms Number of requests with latency above 100ms on the node Count target (Node ID)
NodeDelay10 Requests with Latency between 10-50ms Number of requests with latency between 10-50ms on the node Count target (Node ID)
NodeDelay50 Requests with Latency between 50-100ms Number of requests with latency between 50-100ms on the node Count target (Node ID)
NodeSuccessPerSecond Successful Requests Per Second on the Node Number of successful requests per second on the node Count/second target (Node ID)
NodeCountPerSecond Count Requests Per Second on the Node Number of count requests per second on the node Count/second target (Node ID)
NodeDeletePerSecond Delete Requests Per Second on the Node Number of delete requests per second on the node Count/second target (Node ID)
NodeInsertPerSecond Insert Requests Per Second on the Node Number of insert requests per second on the node Count/second target (Node ID)
NodeReadPerSecond Read Requests Per Second on the Node Number of read requests per second on the node Count/second target (Node ID)
NodeUpdatePerSecond Update Requests Per Second on the Node Number of update requests per second on the node Count/second target (Node ID)
SuccessPerSecond Total Requests Number of successful requests per second on the node Count/second target (Node ID)

4. TTL Index Class

Metric Name Metric Description Meaning Unit Dimensions
TtlDeleted TTL Deleted Data Count Number of data deleted by TTL Count target (Node ID)
TtlPass TTL Pass Count Number of TTL passes Count target (Node ID)

Objects

The data structure of Tencent Cloud MongoDB objects collected can be seen in "Infrastructure - Custom"

{
  "measurement": "tencentcloud_mongodb",
  "tags": {
    "ClusterType" : "0",
    "InstanceId"  : "cmxxxx",
    "InstanceName": "test_01",
    "InstanceType": "1",
    "MongoVersion": "MONxxxx",
    "NetType"     : "1",
    "PayMode"     : "0",
    "ProjectId"   : "0",
    "RegionId"    : "ap-nanjing",
    "Status"      : "2",
    "VpcId"       : "vpc-nf6xxxxx",
    "Zone"        : "ap-nanjing-1",
    "name"        : "cmxxxx"
  },
  "fields": {
    "CloneInstances"   : "[]",
    "CreateTime"       : "2022-08-24 13:54:00",
    "DeadLine"         : "2072-08-24 13:54:00",
    "ReadonlyInstances": "[]",
    "RelatedInstance"  : "{Instance JSON Data}",
    "ReplicaSets"      : "{Instance JSON Data}",
    "StandbyInstances" : "[]",
    "message"          : "{Instance JSON Data}",
  }
}

Logs

Slow Query Statistics

Prerequisites

Note 1: The code execution of this script depends on the MongoDB instance object collection. If the custom object collection for MongoDB is not configured, the slow log script cannot collect slow log data.

Install Script

On top of the previous steps, you need to install another script for MongoDB Slow Query Log Collection

In "Manage / Script Market", click and install the corresponding script package:

  • "TrueWatch Integration (Tencent Cloud-MongoDB Slow Query Log Collection)" (ID: integration_tencentcloud_mongodb_slowlog)

After the data is synced normally, you can view the data in the "Logs" section of TrueWatch.

The reported data example is as follows:

{
  "measurement": "tencentcloud_mongodb_slow_log",
  "tags": {

  },
  "fields": {
      "Slowlog": "Slow Log Details",
      "message": "{Instance JSON Data}"
  }
}

Note: The fields in tags and fields may change with subsequent updates

Note 1: The tags values are supplemented by custom objects.

Note 2: fields.message is a JSON serialized string.

Note 3: fields.Slowlog is every record of all slow query details.