success story: passing arguments with quoted spaces to check_nrpe from nagios.

I have managed to to pass parameter as twice quoted (“ ‘ param value ‘ “) on nagios side and the command was executed, but it happens only from command line, and i can’t pass parameter from nagios config. In my humble opinion less elegant and non-flexible code is better than non-working solution, as a bad peace is better than a good quarrel. At least it work for me and solution was to hardcoded parameter on nrpe side:
filename with special characters must be quoted with double quotes. Check following command first from command line on remote host
# ./check_file_size.sh -v --maxcrit 100000 "/tmp/Some File Name with Spaces.log"

If command returns filename and file size, the next step to add command to NRPE config. Let’s edit nrpe.cfg and add new command

command[check_file_demo]=/usr/local/nagios/libexec/check_file_size.sh -v --maxcrit 100000 "/tmp/Some File Name with Spaces.log"

save file and execute from command line on remote host

./check_nrpe -H 127.0.0.1 -c check_file_demo

when it works you can use check_nrpe command already from nagios server.

Enjoy!

No comments:

HOWTO: Repair Logitech M325 Mouse

FixIt says that you will find single screw under CE label. It isn't always true.