Page 1 of 1

$ not escaping correctly in check_xi_mysql_database

Posted: Tue Feb 02, 2016 4:34 pm
by cjwallgren
Hello,

We are currently evaluating Nagios XI with the intention to purchase, but we ran into the following issue when running the check_xi_mssql_database check command. Nagios should have sent

Code: Select all

/usr/local/Nagios/libexec/check_mssql_database.py –H (our internal sql IP) –U sa –P \$ocInfo1 –T TestTable –p 1433 –logtruncs –warning 1000 –critical 30
Or

Code: Select all

/usr/local/Nagios/libexec/check_mssql_database.py –H (our internal sql IP) –U ‘sa’ –P ‘$ocInfo1’ –T ‘TestTable’ –p 1433 –logtruncs –warning 1000 –critical 30
By putting the escape sequence \$ inside of quotes, the python script sees everything as

Code: Select all

/usr/local/Nagios/libexec/check_mssql_database.py –H (our internal sql IP) –U sa –P \\$ocInfo1 –T TestTable –p 1433 –logtruncs –warning 1000 –critical 30
So over at the database it perceives NagiosXI as logging in with a password of \$ocInfo1 instead of a password of $ocInfo1.

It seems that NagiosXI runs its escape routine over all of the text contained in the $ARG#$ variables even though it should not do so when within single quotes.

Can you please advise? Thanks!

Re: $ not escaping correctly in check_xi_mysql_database

Posted: Tue Feb 02, 2016 4:53 pm
by tmcdonald
You can either try escaping the dollar sign with itself like so $$ or using the resource.cfg file to hold passwords with special characters:

https://assets.nagios.com/downloads/nag ... ource_file

Re: $ not escaping correctly in check_xi_mysql_database

Posted: Wed Feb 03, 2016 4:31 pm
by cjwallgren
Thanks for the quick response! When we tried $$, the script just spit out \$\$.

Re: $ not escaping correctly in check_xi_mysql_database

Posted: Thu Feb 04, 2016 12:36 pm
by rkennedy
What happens if you define a $USER#$ variable in resource.cfg and call to that?

As an example, you would add the line in resource.cfg -

Code: Select all

$USER8$=$ocInfo1