Open Sparc0 opened 2 years ago
I use version 0.26 of gnmic.
pull request verified working in my env.
[
{
"name": "interface_state",
"timestamp": 1663692516962334193,
"tags": {
"component_name": "FPC5",
"source": "junos-mx-960",
"subscription-name": "interface_state"
},
"values": {
"/components/component/state/software-version": "Version 19.4R3-S7.3 by builder on 2021-12-22 20:43:49 UTC"
}
}
]
2022/09/20 18:48:36.967232 [prometheus_output:output-prom] got event to store: {"name":"interface_state","timestamp":1663692516962334193,"tags":{"component_name":"FPC5","source":"junos-mx-960","subscription-name":"interface_state"},"values":{"/components/component/state/software-version":"Version 19.4R3-S7.3 by builder on 2021-12-22 20:43:49 UTC"}}
2022/09/20 18:48:36.967293 [prometheus_output:output-prom] saved key=18357390127090588070, metric: name=gnmic_components_component_state_software_version,labels=[component_name=FPC5,software_version=Version 19.4R3-S7.3 by builder on 2021-12-22 20:43:49 UTC,source=junos-mx-960,subscription_name=interface_state],value=1.000000,time=nil,addedAt=2022-09-20 18:48:36.967248785 +0200 CEST m=+37.883707192
2022/09/20 18:48:36.967234 [prometheus_write_output:prom-remote] got event to buffer: {"name":"interface_state","timestamp":1663692516962334193,"tags":{"component_name":"FPC5","source":"junos-mx-960","subscription-name":"interface_state"},"values":{"/components/component/state/software-version":"Version 19.4R3-S7.3 by builder on 2021-12-22 20:43:49 UTC"}}
2022/09/20 18:48:36.967327 [prometheus_write_output:prom-remote] saving metrics metadata
2022/09/20 18:48:36.967331 [prometheus_write_output:prom-remote] writing TimeSeries to buffer
[
{
"name": "interface_state",
"timestamp": 1663692516969377531,
"tags": {
"component_name": "FPC5",
"source": "junos-mx-960",
"subscription-name": "interface_state"
},
"values": {
"/components/component/state/allocated-power": 496
}
}
]
2022/09/20 18:48:37.170235 [prometheus_output:output-prom] got event to store: {"name":"interface_state","timestamp":1663692516969377531,"tags":{"component_name":"FPC5","source":"junos-mx-960","subscription-name":"interface_state"},"values":{"/components/component/state/allocated-power":496}}
2022/09/20 18:48:37.170277 [prometheus_write_output:prom-remote] got event to buffer: {"name":"interface_state","timestamp":1663692516969377531,"tags":{"component_name":"FPC5","source":"junos-mx-960","subscription-name":"interface_state"},"values":{"/components/component/state/allocated-power":496}}
2022/09/20 18:48:37.170304 [prometheus_write_output:prom-remote] saving metrics metadata
2022/09/20 18:48:37.170308 [prometheus_write_output:prom-remote] writing TimeSeries to buffer
2022/09/20 18:48:37.170309 [prometheus_output:output-prom] saved key=5079452650561576165, metric: name=gnmic_components_component_state_allocated_power,labels=[component_name=FPC5,source=junos-mx-960,subscription_name=interface_state],value=496.000000,time=nil,addedAt=2022-09-20 18:48:37.170256367 +0200 CEST m=+38.086714778
2022/09/20 18:48:41.481888 [prometheus_write_output:prom-remote] write interval reached, writing to remote
2022/09/20 18:48:41.481913 [prometheus_write_output:prom-remote] write triggered, buffer size: 2
2022/09/20 18:48:41.481953 [prometheus_write_output:prom-remote] writing a 2 time series chunk
Telegraf debug log
2022-09-20T16:48:57Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
2022-09-20T16:49:07Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
2022-09-20T16:49:17Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
# HELP prometheus_remote_write_components_component_state_software_version Telegraf collected metric
# TYPE prometheus_remote_write_components_component_state_software_version untyped
prometheus_remote_write_components_component_state_software_version{component_name="FPC5",host="mon1",software_version="Version 19.4R3-S7.3 by builder on 2021-12-22 20:43:49 UTC",source="junos-mx-960",subscription_name="interface_state"} 1
# HELP prometheus_remote_write_components_component_state_allocated_power Telegraf collected metric
# TYPE prometheus_remote_write_components_component_state_allocated_power untyped
prometheus_remote_write_components_component_state_allocated_power{component_name="FPC5",host="mon1",source="junos-mx-960",subscription_name="interface_state"} 496
2022-09-20T16:49:27Z D! [outputs.file] Wrote batch of 2 metrics in 108.601µs
2022-09-20T16:49:27Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
It seems that the strings-as-labels config variable is not working on the prometheus-remote-write output. It works for the prometheus scrape based output.
Paths i subscribed on to make sure i get one with a string value and one with a int value.
stdout
prometheus scrape based output
prometheus remote write debug log
Telegraf debug log