sni / Thruk

Thruk is a multibackend monitoring webinterface for Naemon, Nagios, Icinga and Shinken using the Livestatus API.
http://www.thruk.org
Other
406 stars 147 forks source link

How to escape "!" in service arguements? #1381

Closed heinowalther closed 2 months ago

heinowalther commented 2 months ago

Describe the bug I am trying to monitor a switch via the snmp check. The community string includes a "!" which I am trying to pass as an arg via "$ARG1$" to the command... But of cause this is interpreted as a separator... I have of cause tried the most common options like \"community!\" and "community!!" and "community!" etc. etc. but nothing seems to work?

Thruk Version 3.12 OMD 5.30

sni commented 2 months ago

tbh, i would replace the community string with something that does not contain funny characters like quotes, dollar or exclamation marks. If that is not an option, a common workaround is to define the "!" as user macro in your resource config and the use that macro.

ex.: resource.cfg $USER25$=!

objects.cfg: check_command check_snmp!... -p community$USER25$ ...

(assuming you are using naemon as monitoring core, basically this is a limitation of the core, not thruk)

heinowalther commented 2 months ago

I agree, but sadly it is used as part of another system, so we cannot change the communitystring... But I guess there is no escape char for this? We will create a custom command for this then... it's not pretty.. I think we will just add the communitystring in the command, and not use the resource.cfg for this...
Thanks for the fast response...

sni commented 2 months ago

have you tried \!

heinowalther commented 2 months ago

Yes I have, but then the config-check complains :-)