prometheus-modbus-exporter
by Prometheus
A Helm chart for prometheus-modbus-exporter
About this chart
prometheus-modbus-exporter
Prometheus exporter for scraping metrics via modbus based protocol.
Intro
This chart bootstraps a modbus_exporter deployment on a Kubernetes cluster using the Helm 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:
- 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 (Go).
- 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+
Usage
The chart is distributed as an OCI Artifact as well as via a traditional Helm Repository.
- OCI Artifact:
oci://ghcr.io/prometheus-community/charts/prometheus-modbus-exporter - Helm Repository:
https://prometheus-community.github.io/helm-chartswith chartprometheus-modbus-exporter
The installation instructions use the OCI registry. Refer to the [helm repo](helm repo) command documentation for information on installing charts via the traditional repository.
Install Chart
helm install [RELEASE_NAME] oci://ghcr.io/prometheus-community/charts/prometheus-modbus-exporter
See [configuration](## Configuring) below.
See helm install for command documentation.
Uninstall Chart
helm uninstall [RELEASE_NAME]
This removes all the Kubernetes components associated with the chart and deletes the release.
See helm uninstall for command documentation.
Upgrading Chart
helm upgrade [RELEASE_NAME] [CHART] --install
Configuring
See Customizing the Chart Before Installing. To see all configurable options with detailed comments, visit the chart's values.yaml, or run these configuration commands:
helm show values oci://ghcr.io/prometheus-community/charts/prometheus-modbus-exporter
For more information please refer to the modbus_exporter documentation.
Deploy prometheus-modbus-exporter with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has prometheus-modbus-exporter on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartprometheus-modbus-exporter is pinned at v0.1.4 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply