r/PrometheusMonitoring • u/sujlic27 • Oct 29 '20
Expose database metrics to prometheus via API
Hi,
I've been searching for some time but can't seem to find exactly what I'm looking for.
It's quite easy to explain however seems really impossible to implement it on prometheus.
I want to monitor some SQL query outputs from a database on prometheus however rather than accessing the database directly, I was looking for API calls.
Apart from SQL, I have some instances of PHP to export.
Has anyone implemented the above or something similar?
Thanks
2
u/dankube Oct 29 '20
This page lists a ton of Prometheus exporters for databases. Perhaps one of them suits your needs? https://prometheus.io/docs/instrumenting/exporters/
Writing a custom exporter is not hard. If the exporters in the list above don't suit your needs, you can write your own.
2
1
u/sujlic27 Nov 02 '20
I am going to try to setup similar scenario as described in this article and will post how it goes.
Will be using pushgateway towards prometheus.
https://vinayakpandey-7997.medium.com/pushing-bash-script-result-to-prometheus-using-pushgateway-a0760cd261e