[英]Self monitoring of mongodb with nodejs
I want to get serverstatus data from mongodb on nodejs for all my users(of their respective databases).我想为我的所有用户(他们各自的数据库)从 nodejs 上的 mongodb 获取服务器状态数据。 I have to do this repeatedly unless user makes x field false.
除非用户使 x 字段为假,否则我必须重复执行此操作。 N when he turns it true again I will have to start fetching data again.
N 当他再次将其变为真时,我将不得不再次开始获取数据。 I thought of starting async function everytime it goes true, but I don't know how to stop it.
我想每次都启动异步 function ,但我不知道如何阻止它。 Is there some better way to solve this?
有没有更好的方法来解决这个问题?
I suggest investigation Prometheus
.我建议调查
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.您可以使用 Mongo Prometheus 导出器(如mongodb_exporter )公开指标并让 Prometheus 收集它们。
Prometheus has HTTP and Push notification APIs for you to integrate with as you wish. Prometheus 有 HTTP 和推送通知 API 供您随意集成。
Hope this will put you on the right track.希望这会让你走上正轨。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.