Closed M0rdecay closed 2 years ago
Well, i think, than all we need is remove error here - https://github.com/influxdata/telegraf/blob/master/plugins/parsers/xml/parser.go#L59
@M0rdecay I agree. However, this also might be an query error... Should we add a flag? Something like accept_empty_selections
which is false
by default?
Upvote on this. Using xml input plugin for pacemaker monitoring via crm_mon utility. There is a <failures>
section present only if fail happened. If status OK, no failure section will be present. In this case, when using metric selection option for gathering multiple nodes:
[[inputs.exec.xml]]
metric_selection = "//failures/failure"
telegraf generates error:
[inputs.exec] Error in plugin: cannot parse with empty selection node
Assuming this xml and overall flow as decent, I suppose there should be option available on plugin side to omit this particular [[inputs.*.xml]]
if node is empty.
p.s. if not use metric_selection
and set explicit xpath, it will work with no section present in actual xml, by setting metrics to zeros.
Lets say, Its is ok. But this way to bypass error leads to lack of flexibility, when multiple nodes gathering needed, which should be kinda fundamental thing in xml and alike formats.
Please, implement. Thanls.
This was already fixed and merged with #11102.
Proposal:
Sometimes it is possible that a selector may not return a node. For example, the original XML looks like this:
And sometimes like this:
Current behavior:
In second case, selector
/SELFCARE/POOL_GET_INFO/POOL/CHILDS/POOL/CHILDS/POOL
returns error:with config:
Desired behavior:
Parser will return a warning, not an error, and continue working
@srebhan