Nagios Config String escape

Published on Christian Mayer's Weblog

You can use Backslash (\) to escape ! and $ characters in a Nagios configuration file.

Example /etc/nagios-plugins/config/redis.cfg:

define command {
	command_name check_redis_pass
	command_line /usr/lib/nagios/plugins/check_redis.pl -H $HOSTADDRESS$ -p $ARG1$ -x '$ARG2$'
}

Example /etc/nagios3/conf.d/host-server1.cnf:

define service {
	use generic-service
	host_name server1
	service_description Redis 24000
	check_command check_redis_pass!24000!my_super\!_secret_pa\$\$word
}

Notice the ! is also used to separate arguments. Especially for Redis you must use a very strong password. Because Redis is very fast.

Recent Posts

About the Author

Christian is a professional software developer living in Vienna, Austria. He loves coffee and is strongly addicted to music. In his spare time he writes open source software. He is known for developing automatic data processing systems on Debian Linux server.

Categories: Productivity
Tags: Server, String, Config, escape, monitoring, Nagios, Redis, Configuration, File, Linux

Archive | Categories | RSS Feed | Usage | Imprint
Copyright © 2006 by