Solved

How to define a command in nagios with special characters

Posted on 2012-12-27
2
5,236 Views
Last Modified: 2013-01-02
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
}
0
Comment
Question by:abhinav4
2 Comments
 
LVL 23

Assisted Solution

by:Kamaraj Subramanian
Kamaraj Subramanian earned 250 total points
ID: 38726270
you need to escape the special characters.

use back slash \ to escape the special characters
0
 
LVL 10

Accepted Solution

by:
ienaxxx earned 250 total points
ID: 38726289
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!
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Network ports are the threads that hold network communication together. They are an essential part of networking that can be easily ignore or misunderstood, my goals is to show those who don't have a strong network foundation how network ports opera…
Quality of Service (QoS) options are nearly endless when it comes to networks today. This article is merely one example of how it can be handled in a hub-n-spoke design using a 3-tier configuration.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question