JSON Import with Dollar sign within parameter value - discarded at "check cli"

Hallo community,

we use JSON to import and generate icinga services. One of these generate “prometheus checks” based on promql. In the past it works well. Now there is new one which contains the Dollar sign. :wink: In this case the parameter will be discarded. Inspect didn’t show it. The parameter is correctly transferred to icinga and I see it “with icinga dump”.

I know Dollar is related to icinga macros. I didn’t see a possibility to escape it probably.

Value at JSON:
“sum(appxXxinfo{exported_namespace=~”^xXx(-.)?$“,health_status!~“Healthy|Progressing”} or appxXxinfo{exported_namespace=~”^xXx(-.)?$“,sync_status!~“Synced”}) OR on() vector(0)”

Value at icinga dump:
sum(appxXxinfo{exported_namespace=~“^xXx(-.)?$“,health_status!~“Healthy|Progressing”} or appxXxinfo{exported_namespace=~”^xXx(-.)?$”,sync_status!~“Synced”}) OR on() vector(0)

My actual solution is to work with wrapper.

Have anyone a idea how to handle Dollar signs with parameter values?

Best regards
Klaus

I forgot …

The wrapper script use fix coded strings and replace them to the real query. Then the check script will be call. If they no coded strings, the original values will be used. So the wrapper works tranparent.

Note
When using the $ sign as single character you must escape it with an additional dollar character ($$).

sounds strange but works as expected.
typical problems with passwords in custom vars containing $ or promql queries containing $.
just replace every $ with a $$
if you need $$ you would use $$$$

I changed to double Dollar Signs and it works.

Thank you