RESOLVED: How can use complex password in check_http for url

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
baber
Posts: 308
Joined: Wed Oct 21, 2015 4:39 am

RESOLVED: How can use complex password in check_http for url

Post 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 ?
jsimon
Posts: 339
Joined: Wed Aug 23, 2023 11:27 am

Re: How can use complex password in check_http for url

Post 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!
baber
Posts: 308
Joined: Wed Oct 21, 2015 4:39 am

Re: How can use complex password in check_http for url

Post 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
baber
Posts: 308
Joined: Wed Oct 21, 2015 4:39 am

Re: How can use complex password in check_http for url

Post by baber »

Can anyone help me to solve the issue ?
jsimon
Posts: 339
Joined: Wed Aug 23, 2023 11:27 am

Re: How can use complex password in check_http for url

Post 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!"
ssunga
Posts: 72
Joined: Wed Aug 09, 2023 10:38 am

Re: How can use complex password in check_http for url

Post by ssunga »

If that doesn't work, seeing logs from NRPE might help (i believe it usually writes to /var/log/messages).
baber
Posts: 308
Joined: Wed Oct 21, 2015 4:39 am

Re: How can use complex password in check_http for url

Post 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
baber
Posts: 308
Joined: Wed Oct 21, 2015 4:39 am

Re: How can use complex password in check_http for url

Post by baber »

Would you please help me
baber
Posts: 308
Joined: Wed Oct 21, 2015 4:39 am

Re: How can use complex password in check_http for url

Post 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...

baber
Posts: 308
Joined: Wed Oct 21, 2015 4:39 am

Re: How can use complex password in check_http for url

Post by baber »

Would you please help me about it ?
Locked