# Perform Monitoring of MongoDB Replicaset using ansible

**URL:** <https://forum.ansible.com/t/perform-monitoring-of-mongodb-replicaset-using-ansible/38440>\
**Category:** Ansible Project\
**Created:** [September 14, 2023, 4:45pm UTC](https://forum.ansible.com/t/perform-monitoring-of-mongodb-replicaset-using-ansible/38440 "2023-09-14T16:45:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amit\_Kulkarni](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@Amit\_Kulkarni](https://forum.ansible.com/u/Amit_Kulkarni)\
**Post date:** [September 14, 2023, 4:45pm UTC](https://forum.ansible.com/t/perform-monitoring-of-mongodb-replicaset-using-ansible/38440/1 "2023-09-14T16:45:46Z")

</div>

Hello All,

I need to monitor MongoDB replica set using Ansible, I have created below playbook, i need some guidance on the same, if some one has done this before please help.

---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [September 14, 2023, 7:45pm UTC](https://forum.ansible.com/t/perform-monitoring-of-mongodb-replicaset-using-ansible/38440/2 "2023-09-14T19:45:01Z")

</div>

> Hello All,
> 
> I need to monitor MongoDB replica set using Ansible

How is this monitoring supposed to happen? I’m asking because ansible is a configuration management tool. Monitoring is usually done with monitoring tools.

> I have created below playbook, i need some guidance on the same

What is the problem/error you encounter?

---

<div class="post-metadata">

**Author:** ![Amit\_Kulkarni](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@Amit\_Kulkarni](https://forum.ansible.com/u/Amit_Kulkarni)\
**Post date:** [September 14, 2023, 7:58pm UTC](https://forum.ansible.com/t/perform-monitoring-of-mongodb-replicaset-using-ansible/38440/3 "2023-09-14T19:58:50Z")

</div>

Hello Dick,

Thanks for the response.

We are trying to do monitoring with Splunk but as of now we are sure if we can query to the admin DB and get the output of command rs.status(), in splunk.

That’s why I am thinking of having this playbook as an alternative arrangement.

I have not tested it yet but happy to get feedback on the playbook, if it’s looking allrite

Regards  
Amit

---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [September 15, 2023, 7:42am UTC](https://forum.ansible.com/t/perform-monitoring-of-mongodb-replicaset-using-ansible/38440/4 "2023-09-15T07:42:03Z")

</div>

I would not use ansible for this purpose at all, so I don’t think it looks “allrite” 🙂  
If you have actual errors/issues with running the playbook then we have something tangible.  
I wonder why you have not even tested it…?
