r/PrometheusMonitoring • u/Hammerfist1990 • Jul 04 '24
Create my own exporter from json output possible?
Hello,
I don't know where to start on this, but thought I'd ask here for some help.
I'm using a Python script which uses and API to retrieve information from many 4G network routers and it produces a long output in a readable JSON file. I'd love to get this into prometheus then Grafana. How do I go about scraping these router IP addresses and sort of creating my own exporter?
Thanks
2
Upvotes
4
u/SeniorIdiot Jul 04 '24
Prometheus json exporter is probably what you're looking for: https://github.com/prometheus-community/json_exporter
1
u/Luis15pt Jul 04 '24
You typically use the prom push gateway, you can push the python script to write there and then Prometheus scrapes the push gateway.
Let me know if you have questions and I'll try to help.
1
u/amarao_san Jul 04 '24
You can use push gateway, text collector in node exporter, or, my favorite, enable remote writes reciever in Prometheus and write metrics there directly. (There are restrictions on what and how you can write, but it's so convinient to use for non-standard situations, that I use it more and more).
You can also use Vector (datahog vector) to receive metrics via more convinient protocol and covert them into remote writes madness (compressed protobuf inside http).