grafana-json-datasource icon indicating copy to clipboard operation
grafana-json-datasource copied to clipboard

Problem with partial string match

Open sickel opened this issue 3 years ago • 1 comments

I am reading in statusjson data from nagios.

A part of it: nagiosexample.txt

I want to do a partial match on $.data.hostlist.[*].name, so I do

$.data.hostlist[?(@.name=~/bb/)].name

I would expect to get back [aaknes-bb]. What I do get is [-1, -1]. And indeed, if I do

$.data.hostlist[?(@.name=~/bb/)]. I get

{"name":-1,"plugin_output":"OK - x.y.z.z1: rta 726.213ms, (...) {"name":-1,"plugin_output":"OK - x.y.z.z2: rta 710.566ms, (...)

and so on, rather than filtering, I have rewritten the json.

sickel avatar Jul 06 '22 08:07 sickel

This may be the same issue as the jsonpath part of https://github.com/marcusolsson/grafana-json-datasource/issues/185

sickel avatar Jul 06 '22 08:07 sickel