Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Lippert <[email protected]>
  • Loading branch information
lippertmarkus committed Aug 15, 2023
2 parents 2e48ede + b5519f4 commit 4892a83
Show file tree
Hide file tree
Showing 63 changed files with 2,419 additions and 832 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
/charts/prometheus-fastly-exporter/ @arslanbekov
/charts/prometheus-json-exporter/ @schmiddim @xiu @zanhsieh
/charts/prometheus-kafka-exporter/ @gkarthiks @golgoth31 @zeritti
/charts/prometheus-modbus-exporter/ @openenergyprojects
/charts/prometheus-mongodb-exporter/ @steven-sheehy @zeritti
/charts/prometheus-mysql-exporter/ @juanchimienti @monotek
/charts/prometheus-nats-exporter/ @caarlos0 @okgolove
Expand Down
2 changes: 1 addition & 1 deletion charts/alertmanager-snmp-notifier/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ home: https://github.com/maxwo/snmp_notifier
sources:
- https://github.com/maxwo/snmp_notifier
type: application
version: 0.1.1
version: 0.1.2
appVersion: v1.4.0
keywords:
- monitoring
Expand Down
2 changes: 2 additions & 0 deletions charts/alertmanager-snmp-notifier/values.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=values.schema.json

image:
repository: maxwo/snmp-notifier
pullPolicy: IfNotPresent
Expand Down
2 changes: 1 addition & 1 deletion charts/alertmanager/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ icon: https://raw.githubusercontent.com/prometheus/prometheus.github.io/master/a
sources:
- https://github.com/prometheus/alertmanager
type: application
version: 1.1.0
version: 1.5.0
appVersion: v0.25.0
kubeVersion: ">=1.19.0-0"
keywords:
Expand Down
5 changes: 3 additions & 2 deletions charts/alertmanager/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.config }}
{{- if .Values.config.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
Expand All @@ -12,7 +12,8 @@ metadata:
namespace: {{ include "alertmanager.namespace" . }}
data:
alertmanager.yml: |
{{- toYaml .Values.config | default "{}" | nindent 4 }}
{{- $config := omit .Values.config "enabled" }}
{{- toYaml $config | default "{}" | nindent 4 }}
{{- range $key, $value := .Values.templates }}
{{ $key }}: |-
{{- $value | nindent 4 }}
Expand Down
10 changes: 8 additions & 2 deletions charts/alertmanager/templates/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ spec:
{{- if (and (eq .Values.service.type "NodePort") .Values.service.nodePort) }}
nodePort: {{ .Values.service.nodePort }}
{{- end }}
{{- with .Values.service.extraPorts }}
{{- toYaml . | nindent 4 }}
{{- end }}
selector:
{{- include "alertmanager.selectorLabels" . | nindent 4 }}
---
Expand All @@ -53,13 +56,16 @@ spec:
name: http
{{- if or (gt (int .Values.replicaCount) 1) (.Values.additionalPeers) }}
- port: {{ .Values.service.clusterPort }}
targetPort: {{ .Values.service.clusterPort }}
targetPort: clusterpeer-tcp
protocol: TCP
name: cluster-tcp
- port: {{ .Values.service.clusterPort }}
targetPort: {{ .Values.service.clusterPort }}
targetPort: clusterpeer-udp
protocol: UDP
name: cluster-udp
{{- end }}
{{- with .Values.service.extraPorts }}
{{- toYaml . | nindent 4 }}
{{- end }}
selector:
{{- include "alertmanager.selectorLabels" . | nindent 4 }}
33 changes: 31 additions & 2 deletions charts/alertmanager/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ metadata:
namespace: {{ include "alertmanager.namespace" . }}
spec:
replicas: {{ .Values.replicaCount }}
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
selector:
matchLabels:
{{- include "alertmanager.selectorLabels" . | nindent 6 }}
Expand Down Expand Up @@ -97,18 +98,36 @@ spec:
- name: {{ .Chart.Name }}-{{ .Values.configmapReload.name }}
image: "{{ .Values.configmapReload.image.repository }}:{{ .Values.configmapReload.image.tag }}"
imagePullPolicy: "{{ .Values.configmapReload.image.pullPolicy }}"
{{- with .Values.configmapReload.extraEnv }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
args:
{{- if and (hasKey .Values.configmapReload.extraArgs "config-file" | not) (hasKey .Values.configmapReload.extraArgs "watched-dir" | not) }}
- --watched-dir=/etc/alertmanager
{{- end }}
{{- if not (hasKey .Values.configmapReload.extraArgs "reload-url") }}
- --reload-url=http://127.0.0.1:9093/-/reload
{{- end }}
{{- range $key, $value := .Values.configmapReload.extraArgs }}
- --{{ $key }}={{ $value }}
{{- end }}
resources:
{{- toYaml .Values.configmapReload.resources | nindent 12 }}
{{- with .Values.configmapReload.containerPort }}
ports:
- containerPort: {{ . }}
{{- end }}
{{- with .Values.configmapReload.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: config
mountPath: /etc/alertmanager
{{- if .Values.configmapReload.extraVolumeMounts }}
{{- toYaml .Values.configmapReload.extraVolumeMounts | nindent 12 }}
{{- end }}
{{- end }}
- name: {{ .Chart.Name }}
securityContext:
Expand All @@ -130,7 +149,9 @@ spec:
{{- end }}
args:
- --storage.path=/alertmanager
{{- if not (hasKey .Values.extraArgs "config.file") }}
- --config.file=/etc/alertmanager/alertmanager.yml
{{- end }}
{{- if or (gt (int .Values.replicaCount) 1) (.Values.additionalPeers) }}
- --cluster.advertise-address=[$(POD_IP)]:{{ $svcClusterPort }}
- --cluster.listen-address=0.0.0.0:{{ $svcClusterPort }}
Expand All @@ -153,14 +174,22 @@ spec:
- name: http
containerPort: 9093
protocol: TCP
{{- if or (gt (int .Values.replicaCount) 1) (.Values.additionalPeers) }}
- name: clusterpeer-tcp
containerPort: {{ $svcClusterPort }}
protocol: TCP
- name: clusterpeer-udp
containerPort: {{ $svcClusterPort }}
protocol: UDP
{{- end }}
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
{{- if .Values.config }}
{{- if .Values.config.enabled }}
- name: config
mountPath: /etc/alertmanager
{{- end }}
Expand All @@ -179,7 +208,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
{{- if .Values.config }}
{{- if .Values.config.enabled }}
- name: config
configMap:
name: {{ include "alertmanager.fullname" . }}
Expand Down
4 changes: 4 additions & 0 deletions charts/alertmanager/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,10 @@
"description": "Alertmanager configuration.",
"type": "object",
"properties": {
"enabled": {
"description": "Whether to create alermanager configmap or not.",
"type": "boolean"
},
"global": {
"description": "Global configuration options.",
"type": "object"
Expand Down
30 changes: 30 additions & 0 deletions charts/alertmanager/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

replicaCount: 1

# Number of old history to retain to allow rollback
# Default Kubernetes value is set to 10
revisionHistoryLimit: 10

image:
repository: quay.io/prometheus/alertmanager
pullPolicy: IfNotPresent
Expand Down Expand Up @@ -107,6 +111,9 @@ service:
# if you want to force a specific nodePort. Must be use with service.type=NodePort
# nodePort:

# Optionally specify extra list of additional ports exposed on both services
extraPorts: []

ingress:
enabled: false
className: ""
Expand Down Expand Up @@ -201,6 +208,7 @@ configAnnotations: {}
# slack_api_url: '${vault:secret/data/slack-hook-alerts#URL}'

config:
enabled: true
global: {}
# slack_api_url: ''

Expand Down Expand Up @@ -245,6 +253,28 @@ configmapReload:
##
resources: {}

extraArgs: {}

## Optionally specify extra list of additional volumeMounts
extraVolumeMounts: []
# - name: extras
# mountPath: /usr/share/extras
# readOnly: true

## Optionally specify extra environment variables to add to alertmanager container
extraEnv: []
# - name: FOO
# value: BAR

securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsUser: 65534
# runAsNonRoot: true
# runAsGroup: 65534

templates: {}
# alertmanager.tmpl: |-

Expand Down
4 changes: 4 additions & 0 deletions charts/kube-prometheus-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ name: kube-prometheus-stack
sources:
- https://github.com/prometheus-community/helm-charts
- https://github.com/prometheus-operator/kube-prometheus
<<<<<<< HEAD
version: 48.4.0
=======
version: 48.3.1
>>>>>>> upstream/main
appVersion: v0.66.0
kubeVersion: ">=1.16.0-0"
home: https://github.com/prometheus-operator/kube-prometheus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
{{- end }}
{{- if .Values.global.imagePullSecrets }}
imagePullSecrets:
{{ include "kube-prometheus-stack.imagePullSecrets" . | trim | indent 2 }}
{{- include "kube-prometheus-stack.imagePullSecrets" . | indent 8 }}
{{- end }}
containers:
- name: {{ template "kube-prometheus-stack.name" . }}
Expand Down
2 changes: 1 addition & 1 deletion charts/prometheus-blackbox-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
description: Prometheus Blackbox Exporter
name: prometheus-blackbox-exporter
version: 8.2.0
version: 8.3.0
appVersion: v0.24.0
home: https://github.com/prometheus/blackbox_exporter
sources:
Expand Down
4 changes: 4 additions & 0 deletions charts/prometheus-blackbox-exporter/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ metadata:
{{ toYaml .Values.service.labels | indent 4 }}
{{- end }}
spec:
{{- if .Values.service.ipDualStack.enabled }}
ipFamilies: {{ toYaml .Values.service.ipDualStack.ipFamilies | nindent 4 }}
ipFamilyPolicy: {{ .Values.service.ipDualStack.ipFamilyPolicy }}
{{- end }}
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
Expand Down
4 changes: 4 additions & 0 deletions charts/prometheus-blackbox-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ service:
labels: {}
type: ClusterIP
port: 9115
ipDualStack:
enabled: false
ipFamilies: ["IPv6", "IPv4"]
ipFamilyPolicy: "PreferDualStack"

# Only changes container port. Application port can be changed with extraArgs (--web.listen-address=:9115)
# https://github.com/prometheus/blackbox_exporter/blob/998037b5b40c1de5fee348ffdea8820509d85171/main.go#L55
Expand Down
19 changes: 19 additions & 0 deletions charts/prometheus-modbus-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v2
name: prometheus-modbus-exporter
description: A Helm chart for prometheus-modbus-exporter

keywords:
- modbus
- modbus_exporter
- metric
- monitoring
- prometheus

type: application

version: 0.1.0
appVersion: "0.4.0"

maintainers:
- name: openenergyprojects
email: [email protected]
80 changes: 80 additions & 0 deletions charts/prometheus-modbus-exporter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# prometheus-modbus-exporter

Prometheus exporter for scraping metrics via modbus based protocol.

## Intro

This chart bootstraps a [modbus_exporter](https://github.com/RichiH/modbus_exporter) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

The serviceMonitor objects are created for Prometheus Operator.

## Configuration

The configuration of the modbus_exporter can be provided either via helm's custom values, or via an already existing (independently managed) configMap.
Either way, every time the configuration is getting updated, the modbus_exporter is getting restarted in order to fetch it. This is done using sidecar reloader: <https://github.com/Pluies/config-reloader-sidecar>.

## Tests

This setup has been tested with both real unit (Janitza Power Analizer UMG series) as well as using an simulator <https://www.modbustools.com/download.html>.
Other simulators (fully free) exist as well:

1. the one included as part of the test (fake server) in the <https://github.com/RichiH/modbus_exporter/blob/main/tests/fake_server/main.go>, which uses <https://github.com/tbrandon/mbserver> (golang).
2. Many others, like pymodslave, based on py module: <https://github.com/ljean/modbus-tk>, which has its own demo simulator as well.

## Notes

There are 4 types of read registries, hence 4 read function codes (1,2,3,4).
Don't forget to prefix (first digit) your registry with the required function.
Your address should be always 6 digits.
E.g. for holding registry 22, the address is: 300022 (where the 3 denotes the holding registry function).
More on Modbus function codes: <https://ozeki.hu/p_5873-modbus-function-codes.html>

## Prerequisites

- Kubernetes 1.10+ with Beta APIs enabled
- Helm 3+

## Get Repository Info

```console
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
```

_See [helm repository](https://helm.sh/docs/helm/helm_repo/) for command documentation._

## Install Chart

```console
helm install [RELEASE_NAME] prometheus-community/prometheus-modbus-exporter
```

_See [configuration](## Configuring) below._

_See [helm install](https://helm.sh/docs/helm/helm_install/) for command documentation._

## Uninstall Chart

```console
helm uninstall [RELEASE_NAME]
```

This removes all the Kubernetes components associated with the chart and deletes the release.

_See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command documentation._

## Upgrading Chart

```console
helm upgrade [RELEASE_NAME] [CHART] --install
```

## Configuring

See [Customizing the Chart Before Installing](https://helm.sh/docs/intro/using_helm/#customizing-the-chart-before-installing). To see all configurable options with detailed comments, visit the chart's [values.yaml](./values.yaml), or run these configuration commands:

```console
helm show values prometheus-community/prometheus-modbus-exporter
```

For more information please refer to the [modbus_exporter](https://github.com/RichiH/modbus_exporter) documentation.
3 changes: 3 additions & 0 deletions charts/prometheus-modbus-exporter/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
For any help, see:
- https://github.com/RichiH/modbus_exporter
- https://github.com/prometheus-community/helm-charts/issues
Loading

0 comments on commit 4892a83

Please sign in to comment.