Problem reading password from resource file

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
maxleonca
Posts: 3
Joined: Tue Oct 08, 2013 4:26 pm

Problem reading password from resource file

Post by maxleonca »

Hello,

I'm implementing some checks on our vm hosts, the checks seem to be working just fine if I run them by hand, but when I run them with the Nagios engine is having serious issues reading the password from the resource file.

Currently what I have is something like this on the resource file:

$USER20$=monitor
$USER21$=\@T4rd3$$

As you can see I have scaped the @ with a backslash and the $ with an extra $ but is not working.
If I run it by hand it works using just backslashes for both special characters, any idea on how to tackle this one?

Thank you
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Problem reading password from resource file

Post by tmcdonald »

If it is in the resource file you should not need to escape the characters at all.
Former Nagios employee
maxleonca
Posts: 3
Joined: Tue Oct 08, 2013 4:26 pm

Re: Problem reading password from resource file

Post by maxleonca »

Odd, I tried it in any way shape or form I can think of and still it doesn't work.

Any idea what may be the issue, I did double check the commands to see that the actual macros were being used and indeed they are.
FTL
Posts: 72
Joined: Fri Oct 21, 2011 7:23 am

Re: Problem reading password from resource file

Post by FTL »

what happens if you wrap the password in quotes?

"@T4rd3$"
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Problem reading password from resource file

Post by abrist »

You probably want to wrap the macro itself in quotes in the command:

Code: Select all

"$USER21$"
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
maxleonca
Posts: 3
Joined: Tue Oct 08, 2013 4:26 pm

Re: Problem reading password from resource file

Post by maxleonca »

Thank you for your input, I still have the same message when I add quotes to the macro in the command file.
I figure that the issue here is the $ inside the password, but sadly I'm not in the liberty to change it.

Any other suggestions are more than welcome.

Cheers
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Problem reading password from resource file

Post by sreinhardt »

Does this particular plugin allow for accepting user\pass via file? You might be able to give it a flat file instead with the password and get out of having it in resources.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked