json_exporter
json_exporter copied to clipboard
how to scrape two json files that have different metrics
how to use two configuration files to convert/scrape two different json files in one program, or I have to start two programs with using two different port numbers
Also interested in this.
this is currently possible as long as the json paths are unique between the two endpoints, but it creates a mess in the error logs, due to all the error messages about not being able to find paths / extract values...
Would be great to be able to tag metrics w/ endpoint URLs (or URL regexes) to which they will be applied.
Any updates on this feature ?
me too, Also interested in this.
I'd also like this and the only way I can think to do it (in kubernetes) is running multiple instances of json_exporter
with multiple configmaps
. Unless anyone has a better idea.
This is a duplicate of https://github.com/prometheus-community/json_exporter/issues/14, which was closed for some reason. Commenting to subscribe!
+1 on this. I need to extract values from multiple json endpoints with conflicting paths.
Commented on #14 already, but chiming in here, I also greatly support this enhancement. I am now using 6 Dockerized instances of this exporter within my monitoring stack in order to poll multiple endpoints with differing authentication, as there is no way to distinguish between sending auth to any particular endpoint. This is not very scalable
Given that there's no movement on this, and I have no capabilities of writing something myself, are there any recommended alternatives for polling multiple endpoints?
I believe I have found a solution, albeit a bit labor intensive (due to the custom processing required):
Instead of relying on json_exporter
at all, configure node_exporter
to scrape a local directory for *.prom files with its textfile-collector:
https://github.com/prometheus/node_exporter#textfile-collector
A recurring cron would hit every desired endpoint, parse, and output the data to a file (or multiple files!) in the appropriate format for node_exporter
to scrape.
Maybe not as elegant as json_exporter
is attempting to be, but this should solve the problem. I'll let you know how it goes!
Follow up: This totally worked. No more awful errors.
I wrote a simple shell script that curls the necessary endpoints, pipes the data through jq
to parse, and then writes out to a file.
Then, I have a cron that runs every minute to execute the script and replace the file with the latest data. Dead-simple and now my logs are ::chefs kiss::
This should now be possible with the added support for modules in https://github.com/prometheus-community/json_exporter/pull/146
Brilliant! Thanks for this!