ricoberger / script_exporter

Prometheus exporter to execute scripts and collect metrics from the output or the exit status.
MIT License
354 stars 82 forks source link

Adding prefix path option to discovery #74

Closed EarthlingDavey closed 1 year ago

EarthlingDavey commented 1 year ago

Hi, thanks for the nice project.

I hit an issue, because I'm running the exporter behind a reverse-proxy.

Example

myhost/script_exporter   -> localhost:9469
myhost/node_exporter     -> localhost:9100

When I call myhost/script_exporter/discovery the response loses the context of /script_exporter and responds with

[
    {
        "targets": [
            myhost:443"
        ],
        "labels": {
            "__scheme__": "http",
            "__metrics_path__": "/probe",
            "__param_script": "pg-auto-failover"
        }
    }
]

After the PR...

An edit to /config.yaml like:

discovery:
  path: "/script_exporter"

Returns

... "__metrics_path__": "/script_exporter/probe" ...

Please consider reviewing / merging. I'm no go developer, so there will be room to improve this PR.

Thanks :)

ricoberger commented 1 year ago

Hi @EarthlingDavey thanks for your contribution 🙂

EarthlingDavey commented 1 year ago

You're welcome bro