diff --git a/charts/graylog/Chart.yaml b/charts/graylog/Chart.yaml index 3e9af8c82cce30e253feb09ff39c3c187364db1f..2d8e2dd593e14f1159f21e599ff35b3960069790 100644 --- a/charts/graylog/Chart.yaml +++ b/charts/graylog/Chart.yaml @@ -7,7 +7,7 @@ type: application maintainers: - name: groundhog2k -version: "0.9.6" +version: "0.9.7" appVersion: "6.1.6" diff --git a/charts/graylog/README.md b/charts/graylog/README.md index da89f1157e736a1dce544b20f36bbe14486a2a71..fa8a4c9bf3c73189dccd5d1394f82b05c9e0bc37 100644 --- a/charts/graylog/README.md +++ b/charts/graylog/README.md @@ -1,6 +1,6 @@ # Graylog -   +   ## Changelog @@ -223,3 +223,23 @@ The policyTypes will be automatically set | settings.smtp.subjectPrefix | string | `"[graylog]"` | Mail subject prefix | Further Graylog parameter can be set via environment variables (see Deployment parameter: `env:`) + +## Metrics support parameters + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| metrics.enabled | bool | `false` | Enable metrics support | +| metrics.service.type | string | `"ClusterIP"` | Service type (not available when haMode is enabled) | +| metrics.service.servicePort | int | `9833` | Redis metrics exporter service port | +| metrics.service.containerPort | int | `9833` | Redis metrics exporter container port | +| metrics.service.nodePort | int | `nil` | The node port (only relevant for type LoadBalancer or NodePort - not available when haMode is enabled) | +| metrics.service.clusterIP | string | `nil` | The cluster ip address (only relevant for type LoadBalancer or NodePort) | +| metrics.service.loadBalancerIP | string | `nil` | The load balancer ip address (only relevant for type LoadBalancer - not available when haMode is enabled) | +| metrics.service.annotations | object | `{}` | Additional service annotations | +| metrics.service.lables | object | `{}` | Additional service labels | +| metrics.serviceMonitor.additionalLabels | object | `{}` | Additional labels for the service monitor object | +| metrics.serviceMonitor.annotations | object | `{}` | Annotations for the service monitor object | +| metrics.serviceMonitor.interval | Duration | `nil` | Scrape interval for prometheus | +| metrics.serviceMonitor.scrapeTimeout | Duration | `nil` | Scrape timeout value | +| metrics.serviceMonitor.extraEndpointParameters | object | `nil` | Extra parameters rendered to the [service monitor endpoint](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#endpoint) | +| metrics.serviceMonitor.extraParameters | object | `nil` | Extra parameters rendered to the [service monitor object](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#servicemonitorspec) | diff --git a/charts/graylog/RELEASENOTES.md b/charts/graylog/RELEASENOTES.md index 336e3d5618d289b397bd9c4fdf77bb7f5ea9b580..6dcca0c4394d1e3cfe5e46d0edb8e5de0dca1a4d 100644 --- a/charts/graylog/RELEASENOTES.md +++ b/charts/graylog/RELEASENOTES.md @@ -86,4 +86,6 @@ | 0.9.4 | 6.1.4 | Updated chart for Graylog 6.1.4 | | 0.9.5 | 6.1.5 | Updated chart for Graylog 6.1.5 | | 0.9.6 | 6.1.6 | Updated chart for Graylog 6.1.6 | +| 0.9.7 | 6.1.6 | Added support for prometheus metrics and service-monitor | | | | | + diff --git a/charts/graylog/templates/_helpers.tpl b/charts/graylog/templates/_helpers.tpl index ec041e4595044d8387e25ad4cf9d42a1625fdb59..8fe004aa98a8cf2badb1732a982f63d232b695ba 100644 --- a/charts/graylog/templates/_helpers.tpl +++ b/charts/graylog/templates/_helpers.tpl @@ -156,4 +156,10 @@ Graylog settings via environment variables value: {{ .Values.initGeoIPDatabase.proxy | quote }} {{- end }} {{- end }} +{{- if .Values.metrics.enabled }} +- name: GRAYLOG_PROMETHEUS_EXPORTER_ENABLED + value: {{ .Values.metrics.enabled | quote }} +- name: GRAYLOG_PROMETHEUS_EXPORTER_BIND_ADDRESS + value: "0.0.0.0:{{ .Values.metrics.service.servicePort }}" +{{- end }} {{- end }} diff --git a/charts/graylog/templates/service-metrics.yaml b/charts/graylog/templates/service-metrics.yaml new file mode 100644 index 0000000000000000000000000000000000000000..ea9af0b11954cf7ce612c22b9eb50a2ebd1c07d1 --- /dev/null +++ b/charts/graylog/templates/service-metrics.yaml @@ -0,0 +1,34 @@ +{{- if and .Values.metrics.enabled .Values.metrics.service.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "graylog.fullname" . }}-metrics + labels: + {{- include "graylog.labels" . | nindent 4 }} + graylog/metrics-service: {{ include "graylog.fullname" . }}-metrics + {{- with .Values.metrics.service.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.metrics.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + ports: + - port: {{ .Values.metrics.service.servicePort }} + targetPort: exporter + protocol: TCP + name: exporter + {{- if and ( or (eq .Values.metrics.service.type "LoadBalancer") (eq .Values.metrics.service.type "NodePort") ) (.Values.metrics.service.nodePort) }} + nodePort: {{ .Values.service.nodePort }} + {{- end }} + type: {{ .Values.metrics.service.type }} + {{- if and (eq .Values.metrics.service.type "LoadBalancer") (.Values.metrics.service.loadBalancerIP) }} + loadBalancerIP: {{ .Values.metrics.service.loadBalancerIP }} + {{- end }} + {{- if .Values.metrics.service.clusterIP }} + clusterIP: {{ .Values.metrics.service.clusterIP }} + {{- end }} + selector: + {{- include "graylog.selectorLabels" . | nindent 4 }} +{{- end }} \ No newline at end of file diff --git a/charts/graylog/templates/servicemonitor.yaml b/charts/graylog/templates/servicemonitor.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b8750f55211f34903f45fc52786193cf70766e78 --- /dev/null +++ b/charts/graylog/templates/servicemonitor.yaml @@ -0,0 +1,36 @@ +{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "graylog.fullname" . }} + labels: + {{- include "graylog.labels" . | nindent 4 }} + {{- with .Values.metrics.serviceMonitor.additionalLabels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.metrics.serviceMonitor.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + endpoints: + - port: "exporter" + path: {{ .Values.metrics.serviceMonitor.path }} + scheme: {{ .Values.metrics.serviceMonitor.scheme }} + {{- if .Values.metrics.serviceMonitor.interval }} + interval: {{ .Values.metrics.serviceMonitor.interval }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }} + {{- end }} + {{- with .Values.metrics.serviceMonitor.extraEndpointParameters }} + {{- toYaml . | nindent 6 }} + {{- end }} + {{- with .Values.metrics.serviceMonitor.extraParameters }} + {{- toYaml . | nindent 2 }} + {{- end }} + selector: + matchLabels: + {{- include "graylog.selectorLabels" . | nindent 6 }} + graylog/metrics-service: {{ include "graylog.fullname" . }}-metrics +{{- end }} \ No newline at end of file diff --git a/charts/graylog/templates/statefulset.yaml b/charts/graylog/templates/statefulset.yaml index 830825d10d66c37ba0aaccf4a0663c486f430224..25621157bcbde19b867be1f83360b2197f58be28 100644 --- a/charts/graylog/templates/statefulset.yaml +++ b/charts/graylog/templates/statefulset.yaml @@ -88,6 +88,11 @@ spec: - name: http containerPort: 9000 protocol: TCP + {{- if .Values.metrics.enabled }} + - name: exporter + containerPort: {{ .Values.metrics.service.containerPort }} + protocol: TCP + {{- end }} {{- range $service := .Values.extraServices }} - name: {{ $service.name }} containerPort: {{ $service.containerPort}} diff --git a/charts/graylog/values.yaml b/charts/graylog/values.yaml index a3656b55530db4f1ea467f2eaf651181168ea6de..c2bcf49a35d72ee29272994b7075bbb12124fb2f 100644 --- a/charts/graylog/values.yaml +++ b/charts/graylog/values.yaml @@ -62,6 +62,53 @@ securityContext: runAsGroup: 1100 runAsUser: 1100 +## Prometheus metrics and service monitor configuration +metrics: + ## Enable metrics export + enabled: false + + ## Exporter service configuration + service: + ## Enable metrics service + enabled: true + ## Type of service (not available when haMode is enabled) + type: ClusterIP + ## Valkey exporter service port + servicePort: 9833 + ## Valkey exporter container port + containerPort: 9833 + ## The node port (only relevant for type LoadBalancer or NodePort - not available when haMode is enabled) + nodePort: + ## The cluster ip address (only relevant for type LoadBalancer or NodePort) + clusterIP: + ## The loadbalancer ip address (only relevant for type LoadBalancer - not available when haMode is enabled) + loadBalancerIP: + # Annotations to add to the service + annotations: {} + # Labels to add to the service + labels: {} + + ## Prometheus service monitor configuration + serviceMonitor: + ## Enable service monitor + enabled: true + ## Additional labels for the service monitor object + additionalLabels: {} + ## Annotations for the service monitor object + annotations: {} + ## The scrape interval for prometheus + # interval: + ## The scrape timeout value + # scrapeTimeout: + ## Extra parameters rendered to the service monitor endpoint + extraEndpointParameters: {} + ## Extra parameters rendered to the service monitor + extraParameters: {} + ## Path to metrics + path: "/api/metrics/prometheus" + ## Scheme to use for metrics endpoint + scheme: http + ## Default Graylog service port (default web service port) service: type: ClusterIP