check_mysql messed up by passwd, $ appended to request.

John Stile john at stilen.com
Tue Oct 25 22:51:44 CEST 2005


Andreas Ericsson wrote:

> John Stile wrote:
>
>> I'm trying to use check_nrpe to run check_mysql on a monitored client.
>> It seems that the mysql passwd is messing up check_mysql.
>>
>> On the client to be monitored, I get a vaid response from: 
>> /usr/lib/nagios/plugins/check_mysql -uroot -p'Blr$3%' -P3306
>> or /usr/lib/nagios/plugins/check_mysql -uroot -pBlr\$3\% -P3306
>>
>> I setup nrpe.conf on the client, and turned on debugging.
>> nrpe.conf has:
>> command[check_mysql]=/usr/lib/nagios/plugins/check_mysql -uroot 
>> -pBlr\$3\%c -P3306
>>
>> When I issue the check_nrpe from the nagios server, a '$' is appended to
>> the end of the line once the request (seen in debug output on client).
>> This does not happen for the other checks in nrpe.conf
>>
>
> This is due to a bug in the macro interpolation code (which was 
> inherited from Nagios). It doesn't recognize the fact that it failed 
> to find a complete macro, so it adds a closing dollar-sign at the end 
> of the command if they aren't in even pairs. You can escape 
> dollar-signs with another dollar-sign, like so;
>
> check_mysql -uroot -p'Blr$$3%c'
>
> and it should work. The single quotes are to escape the dollar-signs 
> for the shell.
>
> Granted, it shouldn't touch it in the first place, and I'll have this 
> fixed by the end of the week. In the meantime the double-dollar sign 
> escape thing is the way to go. That syntax will be maintained for 
> backwards compatibility btw, so nothing will break later if you add it.
>
>>> From the server:
>>
>>  /usr/lib/nagios/plugins/check_nrpe -H bugzilla.stilen.com -c 
>> check_mysql
>> On the client debug log:
>> Oct 25 11:13:20 bugzilla nrpe[15494]: Connection from 192.168.0.195 
>> port 25005
>> Oct 25 11:13:20 bugzilla nrpe[15494]: Host address checks out ok
>> Oct 25 11:13:20 bugzilla nrpe[15494]: Handling the connection...
>> Oct 25 11:13:20 bugzilla nrpe[15494]: Host is asking for command 
>> 'check_mysql' to be run...
>> Oct 25 11:13:20 bugzilla nrpe[15494]: Running command: 
>> /usr/lib/nagios/plugins/check_mysql -uroot -pBlr\$3\%c -P3306$
>> Oct 25 11:13:20 bugzilla nrpe[15494]: Command completed with return 
>> code 2 and output: Access denied for user 'root'@'localhost' (using 
>> password: YES)
>> Oct 25 11:13:20 bugzilla nrpe[15494]: Return Code: 2, Output: Access 
>> denied for user 'root'@'localhost' (using password: YES)
>> Oct 25 11:13:20 bugzilla nrpe[15494]: Connection from 192.168.0.195 
>> closed.
>>
>> I have been playing with the nrpe.conf configuration trying to find the
>> correct thing to do.  Any help would be appreciated. 
>> This is a list of the nrpe.conf lines I've tired:
>> command[check_mysql]=/usr/lib/nagios/plugins/check_mysql -H localhost 
>> -u root -p 'Blr$3%'
>> command[check_mysql]=/usr/lib/nagios/plugins/check_mysql 
>> --hostname='localhost' --username='root' --password='Blr$3%'
>> command[check_mysql]=/usr/lib/nagios/plugins/check_mysql -u 'root' -p 
>> 'Blr$3%'
>> command[check_mysql]=/usr/lib/nagios/plugins/check_mysql -H 
>> 'localhost' -u 'root' -p 'Blr$e%'
>>
>> I have also tried to pass the username and passwd as arguments from the
>> nagios server, also with no luck.
>
That worked. :))  Thank you!
the line from nrpe.conf now reads:
 command[check_mysql]=/usr/lib/nagios/plugins/check_mysql -u 'root' -p 
'Blr$$3%'



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list