Skip to content

Possible incorrect InfluxDB line protocol escaping in centreon-certified/influxdb/influxdb2-metrics-apiv2.lua #293

Description

@aeblyve

The code writes out the data in this way:

  local event = self.sc_event.event
  local tags = 'host.name=' .. event.cache.host.name .. ',poller=' .. self:escape_special_characters(event.cache.poller)

This appears to cause issues when event.cache.host.name contains spaces. From influxdb:

https://docs.influxdata.com/influxdb/v1/write_protocols/line_protocol_reference/#special-characters

In tag keys, tag values, and field keys, you must escape:

    commas
    equal signs
    spaces

I am not certain that this applies in the same way to influx v2, but adding


  local trpl = string.gsub(event.cache.host.name, " ", "\\ ")
  local tags = 'host.name=' .. trpl .. ',poller=' .. self:escape_special_characters(event.cache.poller)

Seemed like a quick fix to get the broker working again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions