0

I want to get serverstatus data from mongodb on nodejs for all my users(of their respective databases). I have to do this repeatedly unless user makes x field false. N when he turns it true again I will have to start fetching data again. I thought of starting async function everytime it goes true, but I don't know how to stop it. Is there some better way to solve this?

J Ej
  • 1
  • 1
  • Can you elaborate on what `serverstatus ` is or what it will be used for? – Daniel Aug 06 '20 at 10:12
  • This gives data of mongodb instance like it's log, memory usage ,storage usage and lot of other things – J Ej Aug 07 '20 at 11:54

1 Answers1

0

I suggest investigation Prometheus. It's a great tool for collecting metrics monitoring and alerts.

You can use a Mongo Prometheus Exporter (like mongodb_exporter) to expose metrics and let Prometheus collect them.

Prometheus has HTTP and Push notification APIs for you to integrate with as you wish.

Hope this will put you on the right track.

Daniel
  • 1,496
  • 9
  • 14