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

Is it possible to run multiple scripts on the same prometheus job/endpoint #100

Closed enidvx closed 11 months ago

enidvx commented 1 year ago

Hi, I have this situation where I want to add a prometheus job to scrape an endpoint and on the server script_exporter would execute let's say 3 scripts. Is it possible to scrape them on the same job like this?

  - job_name: "oracle-scripts"
    scrape_interval: "1h"
    scrape_timeout: "1m"
    scheme: "http"
    metrics_path: "/probe"
    params:
      script:
        - "check_script1"
        - "check_script2"
        - "check_script3"
    file_sd_configs:
      - files:
          - "/etc/prometheus/file_sd/targets.yml"

If I run the above I get the metrics only of the first script check_script1 meaning that the other 2 scripts are not executed. The endpoint scraped from above would be: http://target_server:9469/probe?script=check_script1&script=check_script2&script=check_script3

Thanks, Enid

ricoberger commented 11 months ago

Hi @enidvx, no this is currently not possible, but I think this can be implemented in a nice way. I will have a look at this later today.

ricoberger commented 11 months ago

Hi @enidvx, the feature should be available in v2.16.0.