Christian Mayer's Weblog

Nagios Config String escape

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/ -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.

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

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