Solved

How to define a command in nagios with special characters

Posted on 2012-12-27
2
5,011 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

As dyndns has reduced the capabilities of the free service, I looked around for other free providers of Dynamic DNS service. After testing several I decided to move my DNS hosting to Hurricane Electric as then domains that require dynamic hostnam…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
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…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

895 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now