influxdata / helm-charts

Official Helm Chart Repository for InfluxData Applications
MIT License
231 stars 329 forks source link

Missing Feature: Prometheus ServiceMonitor for [[outputs.prometheus_client]] in telegraf chart #417

Open RalfWenzel opened 2 years ago

RalfWenzel commented 2 years ago

We are using the [[outputs.prometheus_client]] plugin in telegraf. The plugin itself is working as expected.

From my experience, most installations use the prometheus-operator when deploying prometheus on k8s. prometheus-operator uses a ServiceMonitor CRD to automatically detect metric endpoints (here: endpoint exposed by [outputs.prometheus_client]])

This ServiceMonitor is normally deployed with the application to be monitored. As an example see ServiceMonitor template in Grafana Chart. So it would be desirable to have a ServiceMonitor template added to the chart.

As a workaround i manually deployed a ServiceMonitor manifest after deploying the telegraf chart.

# Prometheus ServiceMonitor for telegraf
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: telegraf
  namespace: monitoring
  labels:
    app: telegraf
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: telegraf
  namespaceSelector:
    matchNames:
    - monitoring
  endpoints:
    - port: prometheus-client
      path: /metrics

See also:

Let me note that i did not read your ``Contributing" section yet. If it helps i can provide a suggestion for ServiceMonitor template, just let me know.

alespour commented 2 years ago

Hello, a pull request or a suggestion would be appreciated for sure. Thank you.

RalfWenzel commented 2 years ago

@alespour , thx for comment, i'll have a look at it.