How to pass in a parameter with $ in it

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
stecino
Posts: 248
Joined: Thu Mar 14, 2013 4:42 pm

How to pass in a parameter with $ in it

Post 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
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: How to pass in a parameter with $ in it

Post 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:

Code: Select all

$USER2$=134$abc
Then in your command:

Code: Select all

check_command check_ftp_login!'test'!'"$USER2$"'!
Former Nagios employee
stecino
Posts: 248
Joined: Thu Mar 14, 2013 4:42 pm

Re: How to pass in a parameter with $ in it

Post 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$

}
stecino
Posts: 248
Joined: Thu Mar 14, 2013 4:42 pm

Re: How to pass in a parameter with $ in it

Post by stecino »

I ended up changing the password where it doesn't have any $ in it. It's working now
Locked