Telegraf | xml input and no output from prometheus output plugin

Hello Folks,

i want to read out my heater with the help from telegraf. The vendor has a xml api which i can use for reading the needed data


telegraf config:

[agent]

interval = “5s”

debug = true

quiet = false

round_interval = true

metric_batch_size = 1000

metric_buffer_limit = 10000

collection_jitter = “0s”

flush_interval = “2s”

flush_jitter = “0s”

precision = “”

[[outputs.prometheus_client]]

listen = “:9273”

metric_version = 2

path = “/metrics”

collectors_exclude = [“gocollector”, “process”]

Input Plugins

[[inputs.http]]

urls = [“http://192.168.0.221:8080/user/var/120/10251/0/0/12242”]

method = “GET”

data_format = “xml”

[[inputs.http.xml]]

[inputs.http.xml.fields]

puffer_oben = “/eta/value[1]/@strValue

[[inputs.http]]

urls = [“http://192.168.0.221:8080/user/var/120/10251/0/0/12528”]

method = “GET”

data_format = “xml”

[[inputs.http.xml]]

[inputs.http.xml.fields]

puffer_ladezustand = “/eta/value[1]/@strValue


in the syslogfile i see that the two metrics has been found

example

Mar 17 20:33:05 eta-data-collector telegraf[2652]: 2022-03-17T20:33:05Z D! [parsers.xml::http] Number of selected metric nodes: 1
Mar 17 20:33:05 eta-data-collector telegraf[2652]: 2022-03-17T20:33:05Z D! [parsers.xml::http] Number of selected metric nodes: 1
Mar 17 20:33:05 eta-data-collector telegraf[2652]: 2022-03-17T20:33:05Z D! [outputs.prometheus_client] Wrote batch of 2 metrics in 172.538µs


if i do a curl like curl http://localhost:9273/metrics there are no metrics. Does someone have a clue what my fault is?

Hi @HardwareWhisperer,
Can you provide an XML sample, then I can look to reproduce it with your config here.

Thanks,
Jay

Hello @Jay_Clifford thanks for your help

curl http://192.168.0.221:8080/user/var/120/10251/0/0/12528

<?xml version="1.0" encoding="utf-8"?>
<eta version="1.0" xmlns="http://www.eta.co.at/rest/v1">
  <value uri="/user/var/120/10251/0/0/12528" strValue="63" unit="%" decPlaces="0" scaleFactor="10" advTextOffset="0">626</value>
</eta>

I also did two testings with with output file and send it to influxdb


additional info

[[outputs.file]]
files = ["/tmp/metrics.out"]

Contents of this file

http,host=eta-data-collector,url=http://192.168.0.221:8080/user/var/120/10251/0/0/12242 puffer_oben="74" 1647532660000000000
http,host=eta-data-collector,url=http://192.168.0.221:8080/user/var/120/10251/0/0/12242 puffer_oben="74" 1647532665000000000
http,host=eta-data-collector,url=http://192.168.0.221:8080/user/var/120/10251/0/0/12242 puffer_oben="74" 1647532670000000000
http,host=eta-data-collector,url=http://192.168.0.221:8080/user/var/120/10251/0/0/12242 puffer_oben="74" 1647532675000000000
http,host=eta-data-collector,url=http://192.168.0.221:8080/user/var/120/10251/0/0/12242 puffer_oben="74" 1647532680000000000
http,host=eta-data-collector,url=http://192.168.0.221:8080/user/var/120/10251/0/0/12242 puffer_oben="74" 1647532685000000000

and i saw entries in the influxdb