diff --git a/etc/telegraf.conf b/etc/telegraf.conf index d13ec7e2c787b..44b07306d6e90 100644 --- a/etc/telegraf.conf +++ b/etc/telegraf.conf @@ -5145,7 +5145,6 @@ # # data_bits = 8 # # parity = "N" # # stop_bits = 1 -# # transmission_mode = "RTU" # # ## Trace the connection to the modbus device as debug messages # ## Note: You have to enable telegraf's debug mode to see those messages! @@ -5156,7 +5155,12 @@ # ## For Serial you can choose between "RTU" and "ASCII" # # transmission_mode = "RTU" # -# ## Measurements +# ## Define the configuration schema +# ## |---register -- define fields per register type in the original style (only supports one slave ID) +# ## |---request -- define fields on a requests base +# configuration_type = "register" +# +# ## Per register definition # ## # # ## Digital Variables, Discrete Inputs and Coils @@ -5204,6 +5208,79 @@ # { name = "pump1_speed", byte_order = "ABCD", data_type = "INT32", scale=1.0, address = [3,4]}, # ] # +# +# ## Per request definition +# ## +# +# ## Define a request sent to the device +# ## Multiple of those requests can be defined. Data will be collated into metrics at the end of data collection. +# [[inputs.modbus.request]] +# ## ID of the modbus slave device to query. +# ## If you need to query multiple slave-devices, create several "request" definitions. +# # slave_id = 0 +# +# ## Byte order of the data. +# ## |---ABCD or MSW-BE -- Big Endian (Motorola) +# ## |---DCBA or LSW-LE -- Little Endian (Intel) +# ## |---BADC or MSW-LE -- Big Endian with byte swap +# ## |---CDAB or LSW-BE -- Little Endian with byte swap +# # byte_order = "ABCD" +# +# ## Type of the register for the request +# ## Can be "coil", "discrete", "holding" or "input" +# # register = "holding" +# +# ## Name of the measurement. +# ## Can be overriden by the individual field definitions. Defaults to "modbus" +# # measurement = "modbus" +# +# ## Field definitions +# ## Analog Variables, Input Registers and Holding Registers +# ## address - address of the register to query. For coil and discrete inputs this is the bit address. +# ## name *1 - field name +# ## type *1,2 - type of the modbus field, can be INT16, UINT16, INT32, UINT32, INT64, UINT64 and +# ## FLOAT32, FLOAT64 (IEEE 754 binary representation) +# ## scale *1,2 - (optional) factor to scale the variable with +# ## output *1,2 - (optional) type of resulting field, can be INT64, UINT64 or FLOAT64. Defaults to FLOAT64 if +# ## "scale" is provided and to the input "type" class otherwise (i.e. INT* -> INT64, etc). +# ## measurement *1 - (optional) measurement name, defaults to the setting of the request +# ## omit - (optional) omit this field. Useful to leave out single values when querying many registers +# ## with a single request. Defaults to "false". +# ## +# ## *1: Those fields are ignored if field is omitted ("omit"=true) +# ## +# ## *2: Thise fields are ignored for both "coil" and "discrete"-input type of registers. For those register types +# ## the fields are output as zero or one in UINT64 format by default. +# +# ## Coil / discrete input example +# # fields = [ +# # { address=0, name="motor1_run"}, +# # { address=1, name="jog", measurement="motor"}, +# # { address=2, name="motor1_stop", omit=true}, +# # { address=3, name="motor1_overheating"}, +# # ] +# +# ## Holding / input example +# ## All of those examples will result in FLOAT64 field outputs +# # fields = [ +# # { address=0, name="voltage", type="INT16", scale=0.1 }, +# # { address=1, name="current", type="INT32", scale=0.001 }, +# # { address=3, name="power", type="UINT32", omit=true }, +# # { address=5, name="energy", type="FLOAT32", scale=0.001, measurement="W" }, +# # { address=7, name="frequency", type="UINT32", scale=0.1 }, +# # { address=8, name="power_factor", type="INT64", scale=0.01 }, +# # ] +# +# ## Holding / input example with type conversions +# # fields = [ +# # { address=0, name="rpm", type="INT16" }, # will result in INT64 field +# # { address=1, name="temperature", type="INT16", scale=0.1 }, # will result in FLOAT64 field +# # { address=2, name="force", type="INT32", output="FLOAT64" }, # will result in FLOAT64 field +# # { address=4, name="hours", type="UINT32" }, # will result in UIN64 field +# # ] +# +# +# # ## Enable workarounds required by some devices to work correctly # # [inputs.modbus.workarounds] # ## Pause between read requests sent to the device. This might be necessary for (slow) serial devices. @@ -8157,10 +8234,6 @@ # "telegraf/+/mem", # "sensors/#", # ] -# ## Enable extracting tag values from MQTT topics -# ## _ denotes an ignored entry in the topic path -# # topic_tags = "_/format/client/_" -# # topic_measurement = "measurement/_/_/_" # # topic_fields = "_/_/_/temperature" # ## The message topic will be stored in a tag specified by this value. If set # ## to the empty string no topic tag will be created. diff --git a/etc/telegraf_windows.conf b/etc/telegraf_windows.conf index 968de81c5f356..7426c564ad7ea 100644 --- a/etc/telegraf_windows.conf +++ b/etc/telegraf_windows.conf @@ -5019,7 +5019,6 @@ # # data_bits = 8 # # parity = "N" # # stop_bits = 1 -# # transmission_mode = "RTU" # # ## Trace the connection to the modbus device as debug messages # ## Note: You have to enable telegraf's debug mode to see those messages! @@ -5030,7 +5029,12 @@ # ## For Serial you can choose between "RTU" and "ASCII" # # transmission_mode = "RTU" # -# ## Measurements +# ## Define the configuration schema +# ## |---register -- define fields per register type in the original style (only supports one slave ID) +# ## |---request -- define fields on a requests base +# configuration_type = "register" +# +# ## Per register definition # ## # # ## Digital Variables, Discrete Inputs and Coils @@ -5078,6 +5082,79 @@ # { name = "pump1_speed", byte_order = "ABCD", data_type = "INT32", scale=1.0, address = [3,4]}, # ] # +# +# ## Per request definition +# ## +# +# ## Define a request sent to the device +# ## Multiple of those requests can be defined. Data will be collated into metrics at the end of data collection. +# [[inputs.modbus.request]] +# ## ID of the modbus slave device to query. +# ## If you need to query multiple slave-devices, create several "request" definitions. +# # slave_id = 0 +# +# ## Byte order of the data. +# ## |---ABCD or MSW-BE -- Big Endian (Motorola) +# ## |---DCBA or LSW-LE -- Little Endian (Intel) +# ## |---BADC or MSW-LE -- Big Endian with byte swap +# ## |---CDAB or LSW-BE -- Little Endian with byte swap +# # byte_order = "ABCD" +# +# ## Type of the register for the request +# ## Can be "coil", "discrete", "holding" or "input" +# # register = "holding" +# +# ## Name of the measurement. +# ## Can be overriden by the individual field definitions. Defaults to "modbus" +# # measurement = "modbus" +# +# ## Field definitions +# ## Analog Variables, Input Registers and Holding Registers +# ## address - address of the register to query. For coil and discrete inputs this is the bit address. +# ## name *1 - field name +# ## type *1,2 - type of the modbus field, can be INT16, UINT16, INT32, UINT32, INT64, UINT64 and +# ## FLOAT32, FLOAT64 (IEEE 754 binary representation) +# ## scale *1,2 - (optional) factor to scale the variable with +# ## output *1,2 - (optional) type of resulting field, can be INT64, UINT64 or FLOAT64. Defaults to FLOAT64 if +# ## "scale" is provided and to the input "type" class otherwise (i.e. INT* -> INT64, etc). +# ## measurement *1 - (optional) measurement name, defaults to the setting of the request +# ## omit - (optional) omit this field. Useful to leave out single values when querying many registers +# ## with a single request. Defaults to "false". +# ## +# ## *1: Those fields are ignored if field is omitted ("omit"=true) +# ## +# ## *2: Thise fields are ignored for both "coil" and "discrete"-input type of registers. For those register types +# ## the fields are output as zero or one in UINT64 format by default. +# +# ## Coil / discrete input example +# # fields = [ +# # { address=0, name="motor1_run"}, +# # { address=1, name="jog", measurement="motor"}, +# # { address=2, name="motor1_stop", omit=true}, +# # { address=3, name="motor1_overheating"}, +# # ] +# +# ## Holding / input example +# ## All of those examples will result in FLOAT64 field outputs +# # fields = [ +# # { address=0, name="voltage", type="INT16", scale=0.1 }, +# # { address=1, name="current", type="INT32", scale=0.001 }, +# # { address=3, name="power", type="UINT32", omit=true }, +# # { address=5, name="energy", type="FLOAT32", scale=0.001, measurement="W" }, +# # { address=7, name="frequency", type="UINT32", scale=0.1 }, +# # { address=8, name="power_factor", type="INT64", scale=0.01 }, +# # ] +# +# ## Holding / input example with type conversions +# # fields = [ +# # { address=0, name="rpm", type="INT16" }, # will result in INT64 field +# # { address=1, name="temperature", type="INT16", scale=0.1 }, # will result in FLOAT64 field +# # { address=2, name="force", type="INT32", output="FLOAT64" }, # will result in FLOAT64 field +# # { address=4, name="hours", type="UINT32" }, # will result in UIN64 field +# # ] +# +# +# # ## Enable workarounds required by some devices to work correctly # # [inputs.modbus.workarounds] # ## Pause between read requests sent to the device. This might be necessary for (slow) serial devices. @@ -8058,10 +8135,6 @@ # "telegraf/+/mem", # "sensors/#", # ] -# ## Enable extracting tag values from MQTT topics -# ## _ denotes an ignored entry in the topic path -# # topic_tags = "_/format/client/_" -# # topic_measurement = "measurement/_/_/_" # # topic_fields = "_/_/_/temperature" # ## The message topic will be stored in a tag specified by this value. If set # ## to the empty string no topic tag will be created.