I am trying to connect the output of geth metrics of a local node to Grafana. I am initializing my node using the following geth command:

geth --datadir "n1" --nodiscover --networkid "4013" --metrics --metrics.addr "localhost"  --metrics.port "30301"

I can see the expected output when I navigated to http://localhost:30301/debug/metrics/prometheus. Even curl in powershell also returns the output.

Now when I try to import with the url as a Data Source in Grafana (and using browser access) the JS console outputs the following

Access to fetch at 'http://localhost:30301/debug/metrics/prometheus/api/v1/query' from origin 'https://jhaendar.grafana.net' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

I know I can set cors domain for the HTTP server, is there any way to set it for metrics server as well?


you can add --rpccorsdomain jhaendar.grafana.net or --rpccorsdomain=*

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .