Skip to content
This repository has been archived by the owner on Aug 22, 2022. It is now read-only.

Commit

Permalink
[mqtt-exporter] Add new chart (#1584)
Browse files Browse the repository at this point in the history
* added mqtt-exporter

* added servicemonitor

* fix interval

* fix timeout

* exclude from ct

* docs

* Update charts/stable/mqtt-exporter/values.yaml

Co-authored-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>

* Update charts/stable/mqtt-exporter/values.yaml

Co-authored-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>

* Update charts/stable/mqtt-exporter/values.yaml

Co-authored-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>

* Update charts/stable/mqtt-exporter/values.yaml

Co-authored-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>

* Update charts/stable/mqtt-exporter/values.yaml

Co-authored-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>

* Update charts/stable/mqtt-exporter/values.yaml

Co-authored-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>

* Update charts/stable/mqtt-exporter/values.yaml

Co-authored-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>

* Update charts/stable/mqtt-exporter/values.yaml

Co-authored-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>

* Update charts/stable/mqtt-exporter/values.yaml

Co-authored-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>

* Update charts/stable/mqtt-exporter/values.yaml

Co-authored-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>

* Update charts/stable/mqtt-exporter/values.yaml

Co-authored-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>

* Update charts/stable/mqtt-exporter/values.yaml

Co-authored-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>

* Update charts/stable/mqtt-exporter/templates/servicemonitor.yaml

Co-authored-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>

* Update charts/stable/mqtt-exporter/values.yaml

Co-authored-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>

* fix ci

* fix docs

* fixes

* Update values.yaml

* Update values.yaml

Co-authored-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>
  • Loading branch information
runningman84 and bjw-s committed Jun 3, 2022
1 parent 7a849b1 commit 93b52f1
Show file tree
Hide file tree
Showing 9 changed files with 248 additions and 0 deletions.
26 changes: 26 additions & 0 deletions charts/stable/mqtt-exporter/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
# OWNERS file for Kubernetes
OWNERS
# helm-docs templates
*.gotmpl
26 changes: 26 additions & 0 deletions charts/stable/mqtt-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
apiVersion: v2
appVersion: 1.0.0
description: Simple and generic Prometheus exporter for MQTT. Tested with Mosquitto MQTT and Xiaomi sensors.
name: mqtt-exporter
version: 1.0.0
kubeVersion: ">=1.16.0-0"
keywords:
- zigbee2mqtt
- prometheus
home: https://github.com/k8s-at-home/charts/tree/master/charts/stable/mqtt-exporter
icon: https://static.veritone.com/assets/favicon/favicon.ico
sources:
- https://github.com/kpetremann/mqtt-exporter
- https://hub.docker.com/r/kpetrem/mqtt-exporter
maintainers:
- name: philipp
email: phil@hellmi.de
dependencies:
- name: common
repository: https://library-charts.k8s-at-home.com
version: 4.4.2
annotations:
artifacthub.io/changes: |-
- kind: added
description: Initial version
62 changes: 62 additions & 0 deletions charts/stable/mqtt-exporter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# mqtt-exporter

![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square)

Simple and generic Prometheus exporter for MQTT. Tested with Mosquitto MQTT and Xiaomi sensors.

**Homepage:** <https://github.com/k8s-at-home/charts/tree/master/charts/stable/mqtt-exporter>

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| philipp | phil@hellmi.de | |

## Source Code

* <https://github.com/kpetremann/mqtt-exporter>
* <https://hub.docker.com/r/kpetrem/mqtt-exporter>

## Requirements

Kubernetes: `>=1.16.0-0`

| Repository | Name | Version |
|------------|------|---------|
| https://library-charts.k8s-at-home.com | common | 4.4.2 |

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| env | object | See below | environment variables. See [image docs](https://developer.us-1.veritone.com/machinebox/overview) for more details. |
| env.LOG_LEVEL | string | `"INFO"` | Logging level |
| env.MQTT_ADDRESS | string | `"127.0.0.1"` | IP or hostname of MQTT broker |
| env.MQTT_IGNORED_TOPICS | string | `nil` | Comma-separated lists of topics to ignore. Accepts wildcards. |
| env.MQTT_KEEPALIVE | int | `60` | Keep alive interval to maintain connection with MQTT broker |
| env.MQTT_PASSWORD | string | `nil` | Password which should be used to authenticate against the MQTT broker |
| env.MQTT_PORT | int | `1883` | TCP port of MQTT broker |
| env.MQTT_TOPIC | string | `"#"` | Topic path to subscribe to |
| env.MQTT_USERNAME | string | `nil` | Username which should be used to authenticate against the MQTT broker |
| env.PROMETHEUS_PORT | int | `9000` | HTTP server PORT to expose Prometheus metrics |
| env.PROMETHEUS_PREFIX | string | `"mqtt_"` | Prefix added to the metric name, example: mqtt_temperature |
| env.TOPIC_LABEL | string | `"topic"` | Define the Prometheus label for the topic, example temperature{topic="device1"} |
| env.TZ | string | `"UTC"` | Set the container timezone |
| env.ZIGBEE2MQTT_AVAILABILITY | string | `"False"` | Normalize sensor name for device availability metric added by Zigbee2MQTT |
| image.pullPolicy | string | `"IfNotPresent"` | image pull policy |
| image.repository | string | `"kpetrem/mqtt-exporter"` | image repository |
| image.tag | string | `"latest"` | image tag |
| ingress.main | object | See values.yaml | Enable and configure ingress settings for the chart under this key. |
| metrics.enabled | bool | See values.yaml | Enable and configure a Prometheus serviceMonitor for the chart under this key. |
| metrics.serviceMonitor.interval | string | `"30s"` | Interval at which Prometheus should scrape metrics |
| metrics.serviceMonitor.labels | object | `{}` | Additional labels for the Kubernetes `ServiceMonitor` object |
| metrics.serviceMonitor.scrapeTimeout | string | `"10s"` | Timeout after which the scrape is ended |
| persistence | object | See values.yaml | Configure persistence settings for the chart under this key. |
| securityContext.capabilities.drop[0] | string | `"ALL"` | |
| securityContext.readOnlyRootFilesystem | bool | `true` | |
| securityContext.runAsNonRoot | bool | `true` | |
| securityContext.runAsUser | int | `65534` | |
| service | object | See values.yaml | Configures service settings for the chart. |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)
9 changes: 9 additions & 0 deletions charts/stable/mqtt-exporter/README_CONFIG.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{- define "custom.custom.configuration.header" -}}
## Custom configuration
{{- end -}}

{{- define "custom.custom.configuration" -}}
{{ template "custom.custom.configuration.header" . }}

N/A
{{- end -}}
10 changes: 10 additions & 0 deletions charts/stable/mqtt-exporter/ci/ct-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Test

additionalContainers:
mosquitto:
name: mosquitto
image: eclipse-mosquitto:1.6.8
imagePullPolicy: IfNotPresent
ports:
- name: mqtt
containerPort: 1883
1 change: 1 addition & 0 deletions charts/stable/mqtt-exporter/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{- include "common.notes.defaultNotes" . -}}
1 change: 1 addition & 0 deletions charts/stable/mqtt-exporter/templates/common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ include "common.all" . }}
28 changes: 28 additions & 0 deletions charts/stable/mqtt-exporter/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- if .Values.metrics.enabled }}
{{- include "common.values.setup" . -}}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "common.names.fullname" . }}
labels:
{{- include "common.labels" . | nindent 4 }}
{{- with .Values.metrics.serviceMonitor.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
{{- include "common.annotations" . | nindent 4 }}
spec:
selector:
matchLabels:
{{- include "common.labels.selectorLabels" . | nindent 6 }}
endpoints:
- port: http
{{- with .Values.metrics.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
path: /metrics
{{- end }}
85 changes: 85 additions & 0 deletions charts/stable/mqtt-exporter/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#
# IMPORTANT NOTE
#
# This chart inherits from our common library chart. You can check the default values/options here:
# https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common/values.yaml
#

image:
# -- image repository
repository: kpetrem/mqtt-exporter
# -- image tag
tag: latest
# -- image pull policy
pullPolicy: IfNotPresent

# -- environment variables. See [image docs](https://developer.us-1.veritone.com/machinebox/overview) for more details.
# @default -- See below
env:
# -- Set the container timezone
TZ: UTC
# -- Logging level
LOG_LEVEL: INFO
# -- Comma-separated lists of topics to ignore. Accepts wildcards.
MQTT_IGNORED_TOPICS:
# -- IP or hostname of MQTT broker
MQTT_ADDRESS: 127.0.0.1
# -- TCP port of MQTT broker
MQTT_PORT: 1883
# -- Topic path to subscribe to
MQTT_TOPIC: "#"
# -- Keep alive interval to maintain connection with MQTT broker
MQTT_KEEPALIVE: 60
# -- Username which should be used to authenticate against the MQTT broker
MQTT_USERNAME:
# -- Password which should be used to authenticate against the MQTT broker
MQTT_PASSWORD:
# -- HTTP server PORT to expose Prometheus metrics
PROMETHEUS_PORT: 9000
# -- Prefix added to the metric name, example: mqtt_temperature
PROMETHEUS_PREFIX: mqtt_
# -- Define the Prometheus label for the topic, example temperature{topic="device1"}
TOPIC_LABEL: topic
# -- Normalize sensor name for device availability metric added by Zigbee2MQTT
ZIGBEE2MQTT_AVAILABILITY: "False"

# -- Configures service settings for the chart.
# @default -- See values.yaml
service:
main:
ports:
http:
port: 9000

metrics:
# -- Enable and configure a Prometheus serviceMonitor for the chart under this key.
# @default -- See values.yaml
enabled: false
serviceMonitor:
# -- Interval at which Prometheus should scrape metrics
interval: 30s
# -- Timeout after which the scrape is ended
scrapeTimeout: 10s
# -- Additional labels for the Kubernetes `ServiceMonitor` object
labels: {}

ingress:
# -- Enable and configure ingress settings for the chart under this key.
# @default -- See values.yaml
main:
enabled: false

# -- Configure persistence settings for the chart under this key.
# @default -- See values.yaml
persistence:
config:
enabled: false
mountPath: /conf

securityContext:
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 65534

0 comments on commit 93b52f1

Please sign in to comment.