Using ! exclamation mark in Nagios CFG files?

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
AlanSommerville
Posts: 2
Joined: Tue Feb 14, 2012 8:55 pm

Using ! exclamation mark in Nagios CFG files?

Post by AlanSommerville »

I know that NAGIOS uses the ! mark character in CFG files as a seperator. Example:

check_command check_win_disk1!C!80!90!12480

The issue I have is my company uses the ! character in our SMTP community string. I need to populate this string as an argument when running a command:

define service{
use generic-service
host_name my_server_name
service_description DELL_OPENMANAGE_STATUS
check_command check_dell_openmanage!mycommun!tystring!dellom
normal_check_interval 3
retry_check_interval 1
}

Is there a special character I can use to get it to treat the ! as a character rather than a seperator? I've tried "", //, '', etc... Also checked google but can't get an answer anywhere. Anyone know? Appreciate any assistance in advance.
AlanSommerville
Posts: 2
Joined: Tue Feb 14, 2012 8:55 pm

Re: Using ! exclamation mark in Nagios CFG files?

Post by AlanSommerville »

I found a work around for this which was to define my string with the ! character as a user variable in "RESOURCES.CFG"

ie $USER2$ = mycommun!tystring

In my code below I then changes the line to:

check_command check_dell_openmanage!$USER2$!dellom

Would still be interested to know if there are any escape characters which could also be used.
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: Using ! exclamation mark in Nagios CFG files?

Post by jsmurphy »

I believe the escape character is backslash \ as it is in most programming/scripting languages... I think you can also use single quotes around whole strings ' '. It's been too long since I last tried to escape something, if you decide to try these I'd be interested to know if they work as I remember.
Locked