Page 1 of 3

RESOLVED: How can use complex password in check_http for url

Posted: Tue Jul 02, 2024 2:15 am
by baber
I am using check_http to check url . It is working while I have a simple password for authentication but cannot work with strong password that include !@#$%


/usr/local/nagios/libexec/check_http -H myurl.com -w 5 -c 10 -p 8980 -u /me/api/test/all -a john:555!@BabP



user=john
pass=555!@BabP

but it is working while remove !@ from password . how can solve it ?

Re: How can use complex password in check_http for url

Posted: Tue Jul 02, 2024 9:53 am
by jsimon
Hi @baber,

I am curious what errors you're seeing when you try this. My first thought is to try quote wrapping the parameter after the -a flag, so:

Code: Select all

/usr/local/nagios/libexec/check_http -H myurl.com -w 5 -c 10 -p 8980 -u /me/api/test/all -a 'john:555!@BabP'
You may need to escape the characters if this doesn't work. I found some more info in an older thread: viewtopic.php?t=39561

From this it looks like you may need to escape problematic characters variously with either a leading '\' character or by quote wrapping the problematic character. I would also try this:

Code: Select all

/usr/local/nagios/libexec/check_http -H myurl.com -w 5 -c 10 -p 8980 -u /me/api/test/all -a john:555\!"@"BabP
Note that I put a \ before the ! and quote wrapped the @ character. I would suggest playing around with this and seeing if you can get it working from here. Let us know how it goes!

Re: How can use complex password in check_http for url

Posted: Tue Jul 02, 2024 11:16 am
by baber
so thanks now when I am running

/usr/local/nagios/libexec/check_http -H myurl.com -w 5 -c 10 -p 8980 -u /me/api/test/all -a 'john:555!@BabP

on nagios it is working but when add it to check_command on nagios server for that host

check_command check_nrpe!check_http!' -H myurl.com -w 5 -c 10 -p 8980 -u /me/api/test/all -a 'john:555\!"@"BabP'

it is showing :

CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.

on nagios

Re: How can use complex password in check_http for url

Posted: Wed Jul 03, 2024 1:19 am
by baber
Can anyone help me to solve the issue ?

Re: How can use complex password in check_http for url

Posted: Wed Jul 03, 2024 9:25 am
by jsimon
It looks like your second command has two check commands back to back:

Code: Select all

check_command check_nrpe!check_http!' -H myurl.com -w 5 -c 10 -p 8980 -u /me/api/test/all -a 'john:555\!"@"BabP'
Try removing the "check_nrpe!"

Re: How can use complex password in check_http for url

Posted: Wed Jul 03, 2024 9:57 am
by ssunga
If that doesn't work, seeing logs from NRPE might help (i believe it usually writes to /var/log/messages).

Re: How can use complex password in check_http for url

Posted: Wed Jul 03, 2024 2:07 pm
by baber
jsimon wrote: Wed Jul 03, 2024 9:25 am It looks like your second command has two check commands back to back:

Code: Select all

check_command check_nrpe!check_http!' -H myurl.com -w 5 -c 10 -p 8980 -u /me/api/test/all -a 'john:555\!"@"BabP'
Try removing the "check_nrpe!"

Thanks but we cannot remove check_nrpe

Code: Select all

define service{
        use                     local-service
        host_name               subs
        service_description     mebp
        servicegroups           OD
        check_command           check_nrpe!check_http!' -H myurl.com -w 5 -c 10 -p 8980 -u /me/api/test/all  -a john:555\!"@"BabP'
}

We are using this syntax for all commands

Re: How can use complex password in check_http for url

Posted: Thu Jul 04, 2024 11:04 am
by baber
Would you please help me

Re: How can use complex password in check_http for url

Posted: Sat Jul 06, 2024 4:39 am
by baber
It is showing follow error in /var/log/message on remote server

Code: Select all

 nrpe[13277]: Error: Request contained illegal metachars!
Jul  6 13:07:37 serverA nrpe[13277]: Client request was invalid, bailing out...
Jul  6 13:07:44 serverA nrpe[13307]: Error: Request contained illegal metachars!
Jul  6 13:07:44 serverA nrpe[13307]: Client request was invalid, bailing out...


Re: How can use complex password in check_http for url

Posted: Sun Jul 07, 2024 10:38 pm
by baber
Would you please help me about it ?