Sent from Gmail Mobile
On Thu, 14 Sep 2023 at 18:45, Amit Kulkarni <[email protected]> wrote: > 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? if some one has done this before please help. > --- > - name: check the MongoDB replicaset status > hosts: mongodb1 > become: yes > become_method: su > tasks: > - name: check for the status of MongoDB > community.mongodb.mongodb_status: > replica_set: rs0 > poll: 5 > interval: 10 > when: ansible_hostname == "mongodb1" > register: rs_status > > - name: send email notification based on Replica set status > mail: > host: xxx.xxx.xxx.xxx > port: xxxxxxxx > sender: '' > to: '' > subject: 'Report for replicaset' > body: '' > delegate_to: > when: (rs_status != "PRIMARY" ) or (rs_status != "SECONDARY") or > (rs_status != "ARBITER" ) > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/c85bc0f1-37c4-4df6-9157-97e77955b3a6n%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/c85bc0f1-37c4-4df6-9157-97e77955b3a6n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAF8BbLa2Kj6wM_RuEffucW3m2KhkDV9BmXvheA99X0CavPpcMg%40mail.gmail.com.
