bluecmd/fortigate_exporter

Running fortigate exporter in Kubernetes

deggja opened this issue · 2 comments

Hey guys and @bluecmd,

I am experimenting with using your exporter in my Kubernetes cluster and I am having some issues with the Prometheus scrape config.

The exporter is working and I'm able to probe it and receive the metrics on my local system. However, attempting to use Prometheus to scrape it I am getting the following error in my exporter container:

2023/03/02 15:15:37 Probe request rejected; error is: Unsupported scheme "fortigate-exporter-test.monitoring-test.svc.cluster.local"

The prometheus target overview shows a similar error:

server returned HTTP status 400 Bad Request

Here is the prometheus configuration that I am using:

- job_name: 'fortigate_exporter_test
        metrics_path: /probe
        scrape_interval: 1m
        static_configs:
          - targets:
            - fortigate-exporter-test.monitoring-test.svc.cluster.local:80
            labels:
              namespace: monitoring-test
              customer: test
              platform: cloud
              type: network
        relabel_configs:
          - source_labels: [__address__]
            target_label: __param_target
          - source_labels: [__param_target]
            target_label: instance
            # Drop the https:// and port (if specified) for the 'instance=' label
            regex: '(?:.+)(?::\/\/)([^:]*).*'
          - target_label: __address__
            replacement: '[::1]:9710'

The service that I am targeting is exposing the deployment for the exporter. Similar setups work fine for other exporters, but obviously I am doing something wrong here for this one.

I can't figure out whats wrong. I would really appreciate any pointers in the right direction if you have any ideas or experience with running it in k8s.

Thanks for the awesome exporter by the way!

Hello!

I think your got your config a bit backwards. The exporter address goes on the last line of your example (the replacement into __address__) - and the targets are the Fortigate instances your want to probe - with https:// prefix.

@bluecmd Thanks. I dont know how I missed that. It works just fine now.