Skip to content

[inputs.upsd] Set ups_vendorid, ups_productid and any other metrics to be always strings #18308

@clickbg

Description

@clickbg

Relevant telegraf.conf

# Monitor UPSes connected via Network UPS Tools
[[inputs.upsd]]
  ## A running NUT server to connect to.
  ## IPv6 addresses must be enclosed in brackets (e.g. "[::1]")
   server = "127.0.0.1"
   port = 3493
   username = "HIDDEN"
   password = "HIDDEN"

   additional_fields = ["*"]

# Map enum values according to given table.
  ## ## UPS beeper status (enabled, disabled or muted)
  ## Convert 'enabled' and 'disabled' values back to string from boolean
[[processors.enum]]
  [[processors.enum.mapping]]
    field = "ups_beeper_status"
    [processors.enum.mapping.value_mappings]
      true = "enabled"
      false = "disabled"

[[processors.converter]]
  [processors.converter.fields]
    string = ["ups_vendorid"]

[[processors.converter]]
  [processors.converter.fields]
    string = ["ups_productid"]

Logs from Telegraf

System 1:

2026-02-08T07:59:37.858702+02:00 atlas telegraf[1311943]: 2026-02-08T05:59:37Z E! [agent] Error writing to outputs.influxdb_v2: failed to write metrics to telegraf (will be dropped: 422 Unprocessable Entity): unprocessable entity: failure writing points to database: partial write: field type conflict: input field "ups_vendorid" on measurement "upsd" is type string, already exists as type integer dropped=1

System 2:
2026-02-08T07:59:41.155498+02:00 bes telegraf[4052494]: 2026-02-08T05:59:41Z E! [agent] Error writing to outputs.influxdb_v2: failed to write metrics to telegraf (will be dropped: 422 Unprocessable Entity): unprocessable entity: failure writing points to database: partial write: field type conflict: input field "ups_vendorid" on measurement "upsd" is type string, already exists as type integer dropped=1

System info

Telegraf 1.37.1, Ubuntu 24.04, Not in Docker - runs directly on the system

Docker

Hi,

We hit a strange issue with the upsd input. We have 2 systems with 2 UPSes writing to the same InfluxDB using the same telegraf configuration (provided above). Both systems have different UPS units connected to them - System 1 has EATON UPS while System 2 has APC UPS. This is causing some major issues. The input is processing the APC vendorid as an integer and the EATON vendorid as a string and both try to write it in the same place. This is also happening with productid and all other such metrics. We tried to convert them with a processors.converter but after a recent update one of the systems has sneaked in an integer requiring us to drop the entire upsd and start again.

Please, please make all metrics consistent. Mark them as strings even if they are integers and lets stop this conversion and guess work.

Thanks!

Steps to reproduce

  1. Install Telegraf and NUT
  2. Connect two different UPS units to it
  3. Watch one of them complain for filed type mismatch
    ...

Expected behavior

All metrics should have stable and predictable type. Changing them based on vendor will always be problematic, especially if you have multiple UPSes.

Actual behavior

The input plugin is setting the metric type based on the data it is receiving.

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugunexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions