Steps to using Influx / Telegraf with a modbus device.
In this example, an Edge Computer (192.168.4.44) and Coupler (192.168.4.29) are used.
- Shell into the Edge Computer
ssh root@192.168.4.44
- Install Influx
docker run -d --restart unless-stopped --name=influxdb --network=host -v influx-storage:/etc/influxdb/ influxdb:latest
- Setup Influx using browser
http://192.168.4.44:8086
- Create default telegraf configuration file
docker run --rm telegraf telegraf config > telegraf_complete.conf
- Copy configuration file to local machine using a new terminal window.
scp root@192.168.4.44:/root/telegraf_complete.conf telegraf_complete.conf
-
Edit the configuration file to suit your device (or use my example attached). I recommend deleting unused sections. Be advised this file is 10k lines, so try to simplify it to make your life easier! Finally, save this file as telegraf.conf.
-
Generate an API token in chronograf and copy/paste it into the telegraf.conf.
-
Copy the telegraf.conf back to the server using scp command
scp telegraf.conf root@192.168.4.44:/root
- Run telegraf with the new configuration.
docker run -d --name=telegraf --network=host -v $PWD/telegraf.conf:/etc/telegraf/telegraf.conf:ro telegraf
- Monitor the telegraf logs to make sure telegraf is working ok. You should see the following lines for example.
docker logs -f telegraf
11. Data should now be inserted into the influx DB bucket.
Complete tutorial located here:
telegraf.conf.txt (1.8 KB)
3 Likes
Hey @WagoKurt ,
Using the same Telegraf Modbus input plugin, here is another example monitoring the PRO2 PSU (with a communication module).
The configuration looks like this :
[[inputs.modbus]]
name = "PRO2_PSU"
slave_id = 1
timeout = "1s"
controller = "tcp://192.168.68.52:502"
holding_registers = [
{ name ="Outputvoltage", byte_order = "AB", data_type = "UINT16", scale=1.0,address = [1280]},
{ name ="OutputCurrent", byte_order = "AB", data_type = "UINT16", scale=1.0,address = [1281]},
{ name ="OutputPower", byte_order = "ABCD", data_type = "UINT32", scale=1.0,address = [1286,1287]},
{ name ="Outputlastsecond", byte_order = "ABCD", data_type = "UINT32", scale=1.0,address = [1288,1289]},
{ name ="Outputlastminute", byte_order = "ABCD", data_type = "UINT32", scale=1.0,address = [1290,1291]},
{ name ="Outputlasthour", byte_order = "ABCD", data_type = "UINT32", scale=1.0,address = [1292,1293]}
]
You can import the Dashboard from there :
Hey @WagoKurt , it looks you are using the InfluxDB 2.0.
Even if InfluxDB now embed the Chronograf visuzalition tool, Iām more familiar with Grafana.
Any experience using it with Grafana ?
Thanks
Excellent @quenorha, this makes a lot of sense to monitor a passive device like the Pro2 PS. Thanks for sharing.
I have used Grafana but always with Influx buckets as the database. Lately, I prefer to use the hosted influxdata site (which is free for 2 buckets & 30 days retention) or in on-premise then influx 2.0 in a container since it comes with chronograf built-in. Grafana has better graphics however, so it depends on what is needed.
1 Like