How to use newline in config files
Jason Bodnar
jason at shakabuku.org
Mon Dec 19 19:46:29 CET 2005
On Sun, 18 Dec 2005 10:08:37 +0100, Sebastian Kayser wrote
> * Jason Bodnar <jason at shakabuku.org> wrote:
> > I need to have a newline as an arguement for a check_command. \n doesn't work.
> > ^J does work. Hitting Enter and putting the rest on a separate line causes
> > nagios to choke on the config file. How do you put include a newline in an
> > arguement?
>
> You could try to write a wrapper (with bash/perl/...) for your check
> script which calls the relevant command with a newline. Thereafter
> you would define a check_command for your wrapper instead of the relevant
> command itself.
>
> But post some details on which command you want to be called on how you
> have tried it 'til now, maybe there are other ways.
I have a service defined as so:
define service {
use generic-service
host_name db
service_description AppServer
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_interval 60
notification_period 24x7
check_command check_tcp!db.foo.com!3737!PING\n!ACK
}
But that doesn't work even when using the command line like so:
$ /usr/lib/nagios/plugins/check_tcp -H db.foo.com -p 3737 -s 'PING\n' -e 'ACK'
What does work is putting actuall newlines but you can't do that in the config
file. I remember reading about a character sequence you're supposed to use for
newlines in the config files but I can't find it anywhere.
--
Jason Bodnar
jason at shakabuku.org
http://www.shakabuku.org
UnWired Buyer. The best way to win on eBay. Period.
http://www.unwiredbuyer.com
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list