Skip to content
This repository was archived by the owner on Nov 6, 2019. It is now read-only.

Exporter which retrieves stats from a modbus system and exports them via HTTP for Prometheus consumption.

License

Notifications You must be signed in to change notification settings

mxinden/modbus_exporter

This branch is 71 commits ahead of lupoDharkael/modbus_exporter:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

3023040 · Nov 6, 2019
Jun 28, 2019
Jun 28, 2019
Jun 28, 2019
Apr 13, 2019
Jun 4, 2019
Jun 27, 2019
Jun 28, 2019
Apr 4, 2017
Jun 28, 2019
Nov 6, 2019
Jun 28, 2019
Jun 27, 2019
Jun 27, 2019
Jun 28, 2019
Jun 28, 2019
Jun 27, 2019
Jun 28, 2019
Jun 28, 2019

Repository files navigation

Development on this fork has been discontinued. You can check out https://github.com/richih/modbus_exporter instead.

Modbus exporter

Prometheus exporter which retrieves stats from a modbus tcp system and exports them via HTTP for Prometheus consumption.

Scrape sequence

Reproduce diagram

Go to: https://bramp.github.io/js-sequence-diagrams/

Note right of Prometheus: promehteus.yml \n --- \n target: Modbus-TCP-10.0.0.5 \n subtarget: Modbus-Unit-10 \n module: VendorXY
Prometheus->Exporter: http://xxx.de/metrics?target=10.0.0.5&subtarget=10&module=vendorxy
Note right of Exporter: modbus.yml \n --- \n module: VendorXY \n - temperature_a: 40001 \n - temperature_b: 40002

Exporter->Modbus_TCP_10.0.0.5: tcp://10.0.0.5?unit=10&register=40001
Modbus_TCP_10.0.0.5->Modbus_RTU_10: rtu://_?register=40001
Modbus_RTU_10-->Modbus_TCP_10.0.0.5: value=20
Modbus_TCP_10.0.0.5-->Exporter: value=20

Exporter->Modbus_TCP_10.0.0.5: tcp://10.0.0.5?unit=10&register=40002
Modbus_TCP_10.0.0.5->Modbus_RTU_10: rtu://_?register=40002
Modbus_RTU_10-->Modbus_TCP_10.0.0.5: value=19
Modbus_TCP_10.0.0.5-->Exporter: value=19

Exporter-->Prometheus:temperature_a{module="VendorXY",sub_target="10"} 20 \ntemperature_b{module="VendorXY",sub_target="10"} 19

Building

make build

Getting Started

The modbus exporter needs to be passed the target and module as parameters by Prometheus, this can be done with relabelling (see prometheus.yml).

Once Prometheus is properly configured, run the exporter via:

./modbus_exporter [flags]

Supported flags:

Usage of ./modbus_exporter:
  -config.file string
    	Sets the configuration file. (default "modbus.yml")
  -modbus-listen-address string
    	The address to listen on for HTTP requests exposing modbus metrics. (default ":9602")
  -telemetry-listen-address string
    	The address to listen on for HTTP requests exposing telemetry metrics about the exporter itself. (default ":9011")

Configuration File

Check out modbus.yml for more details on the configuration file format.

TODO

  • Rework logging.

  • Revisit bit parsing.

  • Print name, version, ... on exporter startup.


Support for serial modbus was dropped in git commit d06573828793094fd2bdf3e7c5d072e7a4fd381b.

About

Exporter which retrieves stats from a modbus system and exports them via HTTP for Prometheus consumption.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 96.2%
  • Makefile 3.8%