Agent Client Collector provides the following policies for MongoDB health monitoring. Policies come with the checks specified in the indicated table. Policies and checks are available for both Windows and Linux.

Table 1. MongoDB Events
Type Check Description Usage Command Output
Event app.mongodb.check-mongodb-alive Monitors whether the MongoDB server is alive and creating alerts for the MongoDB server health status. commonchecks check-mongodb-alive -H db_host -p db_port

Where:

  • db_host = Host where server is running.
  • db_port = Port to connect to the MongoDB server.

Usage example: command: commonchecks check-mongodb-alive -H 10.***.***.*** -p 27017

commonchecks check-mongodb -p {{.labels.params_port}} -H {{.labels.params_host}} Check mongodb Alive OK: Indicates that the server is in good health.
Event app.mongodb.check-mongodb-metrics Creates alerts for any of the MongoDB metrics, based on the threshold limit.

To trigger the alerts for any MongoDB server metric, pass the whole metric name in the parameter.

commonchecks check-mongodb-metrics -H Hostname -p port -w warning -c critical -d database -m MetricName

Where:

  • Hostname = Host where server is running.
  • port = Port to connect to the MongoDB server.
  • warning = Warning threshold value.
  • critical = Critical threshold value.
  • database = Database name.
  • MetricName = Specific metric to monitor.

Usage example: command: commonchecks check-mongodb-alive -H 10.***.***.*** -p 27017

commonchecks check-mongodb-metrics -c {{.labels.params_critical}} -d {{.labels.params_database}} -w {{.labels.params_warning}} -H {{.labels.params_host}} -p {{.labels.params_port}} -m {{.labels.params_metric}} Check mongodb Metrics OK: Indicates that the mongodb.connection.current value is within the acceptable threshold.
Table 2. MongoDB Metrics
Type Check Description Usage Command Output
Metric app.mongodb.metrics-mongodb Returns metrics of the MongoDB server and all databases.

Sample metrics:

  • mongodb.connections.totalCreated: Incoming connections
  • mongodb.locks.Database.acquireCount_IX : Intent Exclusive lock mode
  • mongodb.locks.Database.acquireCount_X : Exclusive lock mode
  • mongodb.locks.Database.acquireCount_IS : Intent shared lock mode
commonchecks check-mongodb

Where:

  • host = Hostname where the MongoDB server is running.
  • port = Port to connect to the MongoDB server.
  • database = Database name.
commonchecks metrics-mongodb -p {{.labels.params_port}} -H {{.labels.params_host}} -d {{.labels.params_database}} <hostname>.mongodb.connections.totalCreated 20632 1639498004