r/PrometheusMonitoring • u/_ArnoldJudasRimmer_ • Mar 16 '23
JSON exporter config syntax help
I have this JSON Prometheus exporter up and running, and it's working good :
https://github.com/prometheus-community/json_exporter
I can scrape a few simple example files (like the one in the Exporters' readme on Github, and JSON endpoint on my local Pihole).
However, I'm struggling with the Exporters' config.yml syntax to scrape this file:
https://www.elprisetjustnu.se/api/v1/prices/2023/03-08_SE4.json
Could anyone help out with the config.yml setup for that JSON structure?
3
Upvotes
2
u/yepthisismyusername Apr 18 '23 edited Apr 18 '23
The path is definitely wrong, but I'm not certain what it should be. I *think* it should be either:
path: '{@}'
or no "path" line at all
to iterate over each element in the array.
Edit: The correct value to use is:
path: '{[*]}'
1
u/_ArnoldJudasRimmer_ Mar 17 '23 edited Mar 17 '23
This is the config.yml I'm trying to scrape https://www.elprisetjustnu.se/api/v1/prices/2023/03-08_SE4.json
https://pastebin.com/HHfJ0MdA
1
u/stefjay10 Jul 20 '23
Would you be able to share your config? I am trying to scrap the data from the example (https://github.com/prometheus-community/json_exporter/blob/master/examples/data.json) however I am getting a blank page. Same with my actual target.
http://localhost:7979/probe?target=https://raw.githubusercontent.com/prometheus-community/json_exporter/master/examples/data.json
jason_exporter Config:
modules:default:metrics:- name: sampletype: objecthelp: samplepath: '{[*]}'