Search code examples
node.jsjsonprometheusprometheus-node-exporter

Need to post JSON from endpoint to Prometheus using node js


I need to post JSON to Prometheus by collecting the data from endpoint using Node JS. Kindly give me some samples to work on this.


Solution

  • You cannot 'post to Prometheus'. Prometheus works in pull mode. It scrapes metrics exposed by services and exporters. The easiest way to do this is in your node.js application is by using an existing client library. Look at the examples here: https://github.com/siimon/prom-client/tree/master/example.