Page 1 of 1
How to pass in a parameter with $ in it
Posted: Tue Jul 08, 2014 1:20 pm
by stecino
In one of my service definitions I have a command that takes a parameter that has $ in it.
Something like define service{
use url-services
host_name test.abc.net
service_description FTP LOGIN CHECK
check_command check_ftp_login!'test'!'"134$abc"'!
}
how do I pass this in for it to be handled as string?
It complains that it can't login
Re: How to pass in a parameter with $ in it
Posted: Tue Jul 08, 2014 1:26 pm
by tmcdonald
Take a look at the /usr/local/nagios/etc/resource.cfg file. The macros there can be used to store sensitive information or other things that might have special characters. Then the macros are referenced like any other.
Add a line like the following:
Then in your command:
Code: Select all
check_command check_ftp_login!'test'!'"$USER2$"'!
Re: How to pass in a parameter with $ in it
Posted: Tue Jul 08, 2014 2:29 pm
by stecino
Still not good.
Here is what I have:
./check_ftp_rw --host test.abc.net --user 'test' --password '134$abc'
Connected to test.abc.net, logged in as test
# 'check_ftp_login' command definition
define command{
command_name check_ftp_login
command_line $USER1$/check_ftp_rw --host $HOSTADDRESS$ --user $ARG1$ --password $ARG2$
}
Re: How to pass in a parameter with $ in it
Posted: Tue Jul 08, 2014 2:45 pm
by stecino
I ended up changing the password where it doesn't have any $ in it. It's working now