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

[chart] Create a service monitor for each script #112

Closed BapRx closed 9 months ago

BapRx commented 10 months ago

Hi, this PR allows us to track the scripts using a service monitor instead of manually configuring the prometheus additional scrape configs.

If you prefer adding a separate option under .Values.serviceMonitor to enable those extra resources I can edit this PR.

I also bumped the image tag to v2.17.0 in the appVersion.

ricoberger commented 9 months ago

Hi @BapRx thanks for your contribution 🙂

If you prefer adding a separate option under .Values.serviceMonitor to enable those extra resources I can edit this PR.

I think a separate option would make sense. Can you please add it?

BapRx commented 9 months ago

Another option while we're still implementing this would be to handle this like prometheus-blackbox-exporter does, it's not automatically creating a serviceMonitor for each target but allows the user to enable or disable it per probe. The selfMonitor is also optional and disabled by default (we could set it to true to avoid a breaking change).

What method do you prefer?

ricoberger commented 9 months ago

Hi, the implementation from the blackbox exporter Helm chart looks awesome and providing the same functionality would be great.

But I'm also fine with creating a default ServiceMonitor per probe in a first step, because this is already a huge improvement.

BapRx commented 9 months ago

I just pushed a new commit which brings the best of both worlds (I hope!), it defaults to the automatic discovery but also allows the users to override this behavior by providing a list of the scripts to scrape.

I enabled the self-serviceMonitor by default.

ricoberger commented 9 months ago

Awesome @BapRx, thanks again 🙂