Solved

How to define a command in nagios with special characters

Posted on 2012-12-27
2
4,750 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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 …
PRTG Network Monitor lets you monitor your bandwidth usage, so you know who is using up your bandwidth, and what they're using it for.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

757 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

20 Experts available now in Live!

Get 1:1 Help Now