I got similar post about $ in the service name and $"$" works fine, this time is password.
If password contain $ or !,
COMMAND: /usr/local/nagios/libexec/check_mssql_server.py -H raqsql2 -U 'sa' -P '\$QLxxxx!' -p 1433 --averagewait --warning 20 --critical 30
OUTPUT: CRITICAL:Unable to access SQL Server.
(see the system auto add \ in front of $, that is reason it can't connect with SQL server"
Run same command directly from nagios server ssh:
[root@nagiosxi libexec]# ./check_mssql_server.py -H raqsql2 -U 'sa' -P '$QLxxxx!' -p 1433 --averagewait --warning 20 --critical 30
CRITICAL:Average Wait Time is 2296.0ms|Average_Wait_Time=2296.0ms;;;;
So the question is: how to escape $ or ! in password?
How to escape $ and ! in password?
Re: How to escape $ and ! in password?
This should get you past the $ sign. See if that works.
http://support.nagios.com/wiki/index.ph ... ck_Command
There is a known issue with form repopulation when there is an ! in the password, and that is currently on our bug list. One workaround you could do in the meantime is add a new $USERx$ macro to the /usr/local/nagios/etc/resource.cfg file and then just use that in the service definition. That only works well though if there's a common password for multiple machines...
http://support.nagios.com/wiki/index.ph ... ck_Command
There is a known issue with form repopulation when there is an ! in the password, and that is currently on our bug list. One workaround you could do in the meantime is add a new $USERx$ macro to the /usr/local/nagios/etc/resource.cfg file and then just use that in the service definition. That only works well though if there's a common password for multiple machines...
Re: How to escape $ and ! in password?
Happy new year! Any progress on this bug?
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: How to escape $ and ! in password?
Did you read mguthrie's reply?relateqld wrote:Happy new year! Any progress on this bug?
mguthrie wrote:This should get you past the $ sign. See if that works.
http://support.nagios.com/wiki/index.ph ... ck_Command
There is a known issue with form repopulation when there is an ! in the password, and that is currently on our bug list. One workaround you could do in the meantime is add a new $USERx$ macro to the /usr/local/nagios/etc/resource.cfg file and then just use that in the service definition. That only works well though if there's a common password for multiple machines...
Re: How to escape $ and ! in password?
solution in the link doesn't work.
macro solution doesn't work for test command, but works for service check,
Anyway, that is what I want, thanks
macro solution doesn't work for test command, but works for service check,

-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: How to escape $ and ! in password?
It does kind of depend on the quoting that may or may not be around the field you are using.
In your example instead of this
you would need to go with this (removing the single quote)
where you have added the following to the resources.cfg and restarted nagios
In your example instead of this
Code: Select all
/usr/local/nagios/libexec/check_mssql_server.py -H raqsql2 -U 'sa' -P '\$QLxxxx!' -p 1433 --averagewait --warning 20 --critical 30
Code: Select all
/usr/local/nagios/libexec/check_mssql_server.py -H raqsql2 -U 'sa' -P \\$$QLxxxx$USER9$ -p 1433 --averagewait --warning 20 --critical 30
Code: Select all
$USER9$="!"