How to define a command in nagios with special characters

abhinav4
abhinav4 used Ask the Experts™
on
I have been trying to define a command in nagios with the command name including special characters like <<CheckFileSize>>. The problem is when I am running pre-flight check on configuration data it gives me error as below

Checking commands...
Error: The name of command '<<CheckFileSize>>" contains one or more illegal characters.
        Checked 32 commands.

command definition:
++++++++++++++++++
define command {
  command_name  <<CheckFileSize>>
  command_line  check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckFileSize -a ShowAll MinWarn=$ARG2$  MinCrit=$ARG1$ File=c:/pagefile.sys
}
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Kamaraj SubramanianApplication Support Analyst
Commented:
you need to escape the special characters.

use back slash \ to escape the special characters
Commented:
Hi abhinav4,
 itkamaraj is right telling u to escape, but there are some special considerations to keep in mind.

To escape a $ sign, the procedure is different.
http://www.krenger.ch/blog/nagios-escape-dollar-character/

To escape in a command specification keep in mind you should escape twice since the first escape is for Nagios and the second is for the command.
http://www.mail-archive.com/nagios-users@lists.sourceforge.net/msg25694.html


With that knowledge you should be ready to start with nagios cfg files with special chars.

HTH
Bye!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial