0

Is there a way to force the Grafana Agent to use IPv4 when scraping Prometheus data from a Spring Boot application? In the Tomcat access logs of the application, I'm seeing that the Grafana Agent request comes from 0:0:0:0:0:0:0:1 instead of the expected and authorized 127.0.0.1:

0:0:0:0:0:0:0:1 - - [14/Aug/2022:18:48:44 +0000] "GET /api/actuator/prometheus HTTP/1.1" 403 123
geschema
  • 153

1 Answers1

2

Found the answer by myself. In the grafana-agent.yaml configuration file, in the targets section, use 127.0.0.1 instead of localhost:

metrics:
...
    - job_name: integrations/spring-boot
      metrics_path: /api/actuator/prometheus
      static_configs:
      - targets:
        - 127.0.0.1:8082
  global:
    scrape_interval: 60s
  wal_directory: /tmp/grafana-agent-wal
geschema
  • 153