我正在使用prometheus为node.js应用程序编写一个监控工具。我当前正在使用以下node.js客户端进行检测:
prom-client
我已经将所有配置为从node.js应用程序收集和收集默认度量值,并且监控按预期工作。我想知道普罗米修斯是否有可能从我的应用程序公开的端点刮取json。
例如,node.js应用程序有一个健康检查端点(/health),它返回关于应用程序整体健康状况及其依赖项的简单json数据(布尔值或0/1)。我可以配置prometheus和/或prom客户机从健康端点刮取json,然后基于该信息记录度量吗?
最佳答案
我相信你可以。
下面我链接的blogposts详细介绍了如何使用prometheus python客户端将json格式的度量摄取到prometheus中。
https://www.robustperception.io/writing-a-jenkins-exporter-in-python/
https://www.robustperception.io/writing-json-exporters-in-python/