$ not escaping correctly in check_xi_mysql_database

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
cjwallgren
Posts: 2
Joined: Tue Jan 26, 2016 11:04 am

$ not escaping correctly in check_xi_mysql_database

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

Re: $ not escaping correctly in check_xi_mysql_database

Post 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
Former Nagios employee
cjwallgren
Posts: 2
Joined: Tue Jan 26, 2016 11:04 am

Re: $ not escaping correctly in check_xi_mysql_database

Post by cjwallgren »

Thanks for the quick response! When we tried $$, the script just spit out \$\$.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: $ not escaping correctly in check_xi_mysql_database

Post 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
Former Nagios Employee
Locked