Dial out Telegraf configuration not storing xml into file

Hello!

Currently I am streaming telemetry data from Juniper to Telegraf using UDP / protobuf format; protoc command shows the information as follows:

$ /usr/local/bin/protoc  --decode TelemetryStream  telemetry/23.4/23.4R2-EVO/protos/rpd_ni_bgp_oc.proto  -I ./telemetry/23.4/23.4R2-EVO/protos/ < ./data.gpb

system_id: “acx0.ATL”
component_id: 65535
sub_component_id: 0
sensor_name: “ALARMS:/system/alarms/:/system/alarms/:re0/alarmd”
sequence_number: 414174
timestamp: 1771620895681
version_major: 1
version_minor: 0
eom: true
enterprise {
  [juniperNetworks] {
    111 {
      150 {
        151 {
          51: “240518168943”
          51: “240518168943”
          151 {
            51: “240518168943”
            53: “OPTICS”
            52: “ALARM_REASON_OPTICS_CONFIG_MISMATCH: port-0/0/0: Optics does not support configured speed”
            54: 1770930620000000000
            55 {
              9: 0x524f4e49
            }
            56: “SYSTEM”
          }
        }
        151 {
          51: “240518234479”
          51: “240518234479”
          151 {
            51: “240518234479”
            53: “OPTICS”

snip…

My telegraf.conf is as follows:

[global_tags]
[agent]
interval = “10s”
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = “0s”
flush_interval = “10s”
flush_jitter = “0s”
precision = “0s”
debug = true
omit_hostname = true

[[outputs.file]]
files = [“/tmp/metrics.json”]
data_format = “json”
namepass = [“telemetry_junos_evo”] 


[[inputs.socket_listener]]
service_address = “udp://:50002”
data_format = “xpath_protobuf”
xpath_protobuf_type = “TelemetryStream”
xpath_protobuf_import_paths = [“/usr/include/protos”]
xpath_native_types = true
xpath_print_document = true
xpath_protobuf_files = [“telemetry_top.proto”,
“aftman-cos-oc_render.proto”,
”a bunch of other .proto files”]

Debug output snip is as follows:

telegraf | 2026-02-20T21:00:26Z I! Loading config: /etc/telegraf/telegraf.conf
telegraf | 2026-02-20T21:00:26Z I! Starting Telegraf 1.36.4 brought to you by InfluxData the makers of InfluxDB
telegraf | 2026-02-20T21:00:26Z I! Available plugins: 239 inputs, 9 aggregators, 35 processors, 26 parsers, 65 outputs, 6 secret-stores
telegraf | 2026-02-20T21:00:26Z I! Loaded inputs: socket_listener
telegraf | 2026-02-20T21:00:26Z I! Loaded aggregators:
telegraf | 2026-02-20T21:00:26Z I! Loaded processors:
telegraf | 2026-02-20T21:00:26Z I! Loaded secretstores:
telegraf | 2026-02-20T21:00:26Z I! Loaded outputs: file
telegraf | 2026-02-20T21:00:26Z I! Tags enabled:
telegraf | 2026-02-20T21:00:26Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:“”, Flush Interval:10s
telegraf | 2026-02-20T21:00:26Z W! [agent] The default value of ‘skip_processors_after_aggregators’ will change to ‘true’ with Telegraf v1.40.0! If you need the current default behavior, please explicitly set the option to ‘false’!
telegraf | 2026-02-20T21:00:26Z D! [agent] Initializing plugins
telegraf | 2026-02-20T21:00:26Z D! [agent] Connecting outputs
telegraf | 2026-02-20T21:00:26Z D! [agent] Attempting connection to [outputs.file]
telegraf | 2026-02-20T21:00:26Z D! [agent] Successfully connected to outputs.file
telegraf | 2026-02-20T21:00:26Z D! [agent] Starting service inputs
telegraf | 2026-02-20T21:00:26Z I! [inputs.socket_listener] Listening on udp://[::]:50002
telegraf | 2026-02-20T21:00:27Z D! [parsers.xpath_protobuf::socket_listener] XML document equivalent: “<version_minor>0</version_minor>false<jnpr_network_instances_ni_bgp_ext><network_instance>DEFAULTBGPDEFAULT</network_instance></jnpr_network_instances_ni_bgp_ext><system_id>acx0.ATL</system_id><component_id>65535</component_id><sub_component_id>0</sub_component_id><sensor_name>BGP-OC:/network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/state/:/network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/state/:rpd</sensor_name><sequence_number>829727</sequence_number>1771622158994<version_major>1</version_major>”
telegraf | 2026-02-20T21:00:27Z D! [parsers.xpath_protobuf::socket_listener] Number of configs: 0
telegraf | 2026-02-20T21:00:27Z D! [inputs.socket_listener] No metrics were created from a message. Verify your parser settings. This message is only printed once.
telegraf | 2026-02-20T21:00:28Z D! [parsers.xpath_protobuf::socket_listener] XML document equivalent: “<system_id>acx0.ATL</system_id><sub_component_id>0</sub_component_id><sensor_name>BGP-OC:/network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/state/:/network-instances/network-instance/protocols/protocol/bgp/neighbors/neighbor/state/:rpd</sensor_name><sequence_number>829728</sequence_number><version_major>1</version_major><version_minor>0</version_minor>false<jnpr_network_instances_ni_bgp_ext><network_instance>DEFAULTBGPDEFAULT</network_instance></jnpr_network_instances_ni_bgp_ext><component_id>65535</component_id>1771622159101”

I am not sure why the xml output is not being written to a file, debug output hints something is missing in configuration but I am not sure what else can I add into the socket_listener section to make it work.

The errors:

D! [inputs.socket_listener] No metrics were created from a message. Verify your parser settings. This message is only printed once.

and the following one which is printed frequently

D! [parsers.xpath_protobuf::socket_listener] Number of configs: 0

May hint the issue but I am not able to pinpoint what to do.

I can attach the file data.gpb If needed

Hi @vostorga

Have you defined any rules to tell Telegraf which specific fields from that structure should become InfluxDB-style metrics?

I believe the xpath_protobuf parser requires at least one [[inputs.socket_listener.xpath]] configuration block to map the data. In your telegraf.conf, you need to define how to handle the decoded document. Based on your debug output, try to structure the [[inputs.socket_listener.xpath]] section to something like this:

[[inputs.socket_listener]]
  service_address = "udp://:50002"
  data_format = "xpath_protobuf"
  xpath_protobuf_type = "TelemetryStream"
  # ... your existing import_paths and files ...

  [[inputs.socket_listener.xpath]]
    # 1. Define the "Metric Name"
    metric_name = "'telemetry_junos_evo'"

    # 2. Define the "Root" of the data you want to iterate over
    # If the data is flat, use "."
    selection = "."

    # 3. Define Tags (Metadata)
    [inputs.socket_listener.xpath.tags]
      device = "/system_id"
      sensor = "/sensor_name"
      component = "/component_id"

    # 4. Define Fields (The actual data values)
    [inputs.socket_listener.xpath.fields]
      sequence_number = "/sequence_number"
      # To capture nested enterprise data (like the alarms in your snippet):
      # Note: You may need to adjust these paths based on the exact XML output
      alarm_id = "//151/51"
      alarm_reason = "//151/52"

Hello @grant1 , thank you for your detailed explanation. That was indeed the issue.

@vostorga Great! Please mark my post above as “Solution” so others can find it in the future.

Additionally, a quick and dirty way of mapping all fields is

[[inputs.socket_listener.xpath]]
field_selection = “//*”
field_name_expansion = false
metric_name = “string(‘telemetry_junos_evo’)”
1 Like