influxdata / influxdata/helm-charts
Missing Feature: Prometheus ServiceMonitor for [[outputs.prometheus_client]] in telegraf chart
- Dominant language
- Mustache
- Stars
- 257
- Forks
- 347
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 9
Description
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](https://github.com/grafana/helm-charts/blob/main/charts/grafana/templates/servicemonitor.yaml). 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:
- [Prometheus Operator Docs](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md)
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.
Contributor guide
Assessment
This issue has not been assessed yet.