telegraf icon indicating copy to clipboard operation
telegraf copied to clipboard

UPSD issue "partial write: field type conflict"

Open rhaamo opened this issue 2 years ago • 0 comments

Relevant telegraf.conf

[[inputs.upsd]]
    server = "127.0.0.1"
    port = 3493
    username = "upsmonitor"
    password = "xxx"

Logs from Telegraf

# log from host 2 if host 1 started first
E! [outputs.influxdb] E! [outputs.influxdb] Failed to write metric (will be dropped: 400 Bad Request): partial write: field type conflict: input field "firmware" on measurement "upsd" is type string, already exists as type integer dropped=1

# log from host 1 if host 2 started first
E! [outputs.influxdb] Failed to write metric (will be dropped: 400 Bad Request): partial write: field type conflict: input field "firmware" on measurement "upsd" is type integer, already exists as type string dropped=1

System info

telegraf 1.25.0-1

Docker

No response

Steps to reproduce

I have the UPSD input enabled on two servers, apparently the "firmware" returned on one host is integer, and string on the other. Depending on which host writes first, the second cannot write because of different type.

Doing an "upsc xxx | grep firmware" on the hosts I get:

  • host 1: ups.firmware: 02
  • host 2: ups.firmware: 02.08.0010

In the influxdb depending on which one starts first (dropping measurements between tests), I get:

time                battery_charge_percent dc   firmware host                    load_percent model            os    output_voltage serial status_OL status_flags time_left_ns ups_name         ups_status
----                ---------------------- --   -------- ----                    ------------ -----            --    -------------- ------ --------- ------------ ------------ --------         ----------
1672899550000000000 100                    Home 2        courgette.xxx.xxxxxx.xx 41           Ellipse ECO 1200 Linux 230            0      true      8            581000000000 selfhosting-rack OL

or

time                battery_charge_percent dc   firmware   host                load_percent model        os    output_voltage serial status_OL status_flags time_left_ns  ups_name ups_status
----                ---------------------- --   --------   ----                ------------ -----        --    -------------- ------ --------- ------------ ------------  -------- ----------
1672899280000000000 100                    Home 02.08.0010 curry.xxx.xxxxxx.xx 20           Eaton 3S 550 Linux 230            Blank  true      8            1200000000000 curry    OL

Expected behavior

all hosts writes the same type for firmware and metrics don't get dropped

Actual behavior

different value type for firmware and all values get dropped

Additional info

telegraf --test --input-filter upsd --config-directory /etc/telegraf/telegraf.d/

upsd,dc=Home,host=courgette.xxx.xxxxxx.xx,model=Ellipse\ ECO\ 1200,os=Linux,serial=0,status_OL=true,ups_name=selfhosting-rack battery_charge_percent=100i,firmware=2i,load_percent=40i,output_voltage=230,status_flags=8i,time_left_ns=631000000000i,ups_status="OL" 1672900267000000000 and upsd,dc=Home,host=curry.xxx.xxxxxx.xx,model=Eaton\ 3S\ 550,os=Linux,serial=Blank,status_OL=true,ups_name=curry battery_charge_percent=100i,firmware="02.08.0010",load_percent=20i,output_voltage=230,status_flags=8i,time_left_ns=1248000000000i,ups_status="OL" 1672900306000000000

rhaamo avatar Jan 05 '23 06:01 rhaamo