How to monitor MongoDB replicat set, 3 nodes, with Zabbix

Hi,

I have create a Replicat Set of Mongodb with 3 nodes, one Primary and two Secondary. The priority is the same on the 3 nodes.

I configure the monitoring of each node with using the template "MongoDB node by Zabbix agent2.

My Zabbix configuration and version of MongoDB:
Zabbix server : 6.4.12
Zabbix agent2 : 6.4.12 with MongoDB plugins
MongoDB sever : 7.0.6​

When I switch to a different node of MongoDB (switch from Primary to one of Secondary), the Zabbix monitoring failed on the following Items:

  • MongoDB Number of replicas
  • MongoDB: Number of unhealthy replicas
  • MongoDB: Unhealthyl replicas
    and some other like MongoDB: Preload …

The error on the Zabbix server is :
2020684:20240315:154226.627 error reason for “svx-lab-04m.unifr.ch:mongodb.rs.total_nodes[ReplicaMGDB]” changed: Preprocessing failed for: {“$clusterTime”:{“clusterTime”:{“T”:1710513744,“I” :1},“signature”:{“hash”:{“Subtype”:0,“Data”:"pV…

  1. Failed: cannot extract value from json by path “$.members[?(@.self == “true”)].totalNodes.first()”: no data matches the specified path
    2020684:20240315:154226.627 error reason for “svx-lab-04m.unifr.ch:mongodb.rs.unhealthy_count[ReplicaMGDB]” changed: Preprocessing failed for: {“$clusterTime”:{“clusterTime”:{“T”:1710513744,“I” :1},“signature”:{“hash”:{“Subtype”:0,“Data”:"pV…
  2. Failed: cannot extract value from json by path “$.members[?(@.self == “true”)].unhealthyCount.first()”: no data matches the specified path
    2020684:20240315:154226.639 error reason for “svx-lab-04m.unifr.ch:mongodb.rs.unhealthy[ReplicaMGDB]” changed: Preprocessing failed for: {“$clusterTime”:{“clusterTime”:{“T”:1710513744,“I” :1},“signature”:{“hash”:{“Subtype”:0,“Data”:"pV…
  3. Failed: cannot extract value from json by path “$.members[?(@.self == “true”)].unhealthyNodes.first()”: no data matches the specified path​

What is wrong ? What I need to configure ?
What I don’t understand with Replica set configuration ?

I need help
Regards
Olivier

Hi @Olivier_Studer and welcome to the community forum!!

From the above error message it seems that the error occurs because it is unable to parse the JSON which is passed.

It would be helpful if you could share the output for rs.status() command for the replica set created?

Also, since we not have the expertise for Zabbix, it would be great if you could also verify the configuration setting from Zabbix community forums.
You might want to look at one of the discussions on the forums.

Best Regards
Aasawari

Please review the Zabbix log file to check the error and the find the cause of the error.

Hi Aasawari,

The 3 attached
rs-status-primary-node-svx-lab274.txt (5.4 KB)
rs-status-secondary-node-svx-lab04m.txt (4.7 KB)
rs-status-secondary-node-svx-lab05m.txt (4.7 KB)
files contains the output of the command rs.status() for the primary server and the both secondary.

May be it can help you to understand my problem

Regards
Olivier