Skip to content

Commit

Permalink
add values
Browse files Browse the repository at this point in the history
Signed-off-by: Efrat Levitan <[email protected]>
  • Loading branch information
Efrat19 committed Oct 22, 2022
1 parent 940c83e commit a28618f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
12 changes: 10 additions & 2 deletions charts/telegraf/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "telegraf.serviceMonitorName" . }}
namespace: {{ .Values.serviceMonitor.namespaceOverride | default .Release.Namespace }}
labels:
{{- include "telegraf.labels" . | nindent 4 }}
{{- if .Values.serviceMonitor.labels }}
Expand All @@ -20,6 +21,13 @@ spec:
matchNames:
- {{ .Release.Namespace }}
endpoints:
- port: prometheus-client
path: /metrics
{{- range $objectKey, $objectValue := .Values.config.outputs }}
{{- range $key, $value := . -}}
{{- $tp := typeOf $value -}}
{{- if eq $key "prometheus_client" }}
- port: {{ trimPrefix ":" $value.listen | int64 }}
path: {{ $value.path | default "/metrics" }}
{{- end }}
{{- end -}}
{{- end }}
{{- end }}
7 changes: 7 additions & 0 deletions charts/telegraf/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ serviceAccount:
# Annotations for the ServiceAccount
annotations: {}

# To make use of the serviceMonitorm, please add a prometheus_client entry to config.outputs:
# - prometheus_client:
# listen: ":9273"
# path: /metrics
serviceMonitor:
# Specifies whether a ServiceMonitor should be created
create: false
Expand All @@ -120,6 +124,9 @@ serviceMonitor:
labels: {}
# Annotations for the ServiceMonitor
annotations: {}
# To install the serviceMonitor in a different namespace than the release set its name here
# For example if your prometheus is <v0.19.0 the serviceMonitor must be installed in the prometheus namespace
namespaceOverride:
## Exposed telegraf configuration
## For full list of possible values see `/docs/all-config-values.yaml` and `/docs/all-config-values.toml`
## ref: https://docs.influxdata.com/telegraf/v1.1/administration/configuration/
Expand Down

0 comments on commit a28618f

Please sign in to comment.