I have an issue where I need to supply a string as a parameter to a check command. The issue is that sometimes this string has an exclamation point. Of course this confuses how nagios is parsing the check_command parameters since nagios itself uses ! marks as field delimeters.
I have tried enclosing my string in single quotes but the ! mark continues
to confuse nagios.
Anyone have any suggestions on how to get around this?
As you can see the pass is something like “gt.ko!6” and the desired directory to check is “/”. The output is somthing like the following.I try with one, two and none backslash:
Try putting the exclamation point in your command_line definition instead and remove it from the check_command definition.
If this doesn’t work another option is to remove the parameter passing from the service definition on your nagios server and move it to the command definition (e.g. if you are using nrpe) on the system you are monitoring.
I can’t touch anything in the monitored system. And change the check_command.cfg in the way you mention is nasty thing and…in order to make it work I can (actually, I have done this) also change the script asociated code, wich is still a very nasty thing. The point is that I need to use that check_command (check_ftpdir) with a number of machines.
Sooo I need to make that exclamation mark work. Any more ideas??
If you have other services which currently use command_name check_ftpdir, create a new one, e.g. check_ftpdir_special which has the same exact command definition as check_ftpdir, but it includes the exclamation point in it. That way you won’t effect the other services that also use the check_ftpdir command.
Of course you will have to define the new service with the check_command of check_ftpdir_special to use the new command.