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.
kg2857
Posts: 491
Joined: Wed Apr 12, 2023 5:48 pm

Re: How can use complex password in check_http for url

Post by kg2857 »

You probably need to escape the password, as has been suggested.
User avatar
lgute
Posts: 415
Joined: Mon Apr 06, 2020 2:49 pm

Re: How can use complex password in check_http for url

Post by lgute »

Hi @baber, thanks for reaching out.

I think there is a bit of confusion about what you are trying to do.
  • Are you running XI and using NRPE to run the check_http plugin, remotely on "myurl.com"?
  • Did you install the "Nagios XI Linux NRPE Agent" tarball or did you install NRPE from source?
  • Can you use check_http, without using NRPE?
If you need/want more expedient help you can open a case on Answer Hub. While most of the answers here are coming from Nagios staff, this forum is intended to be a "community support" tier. The ticket support system will allow the Support Team to dig into your environment and help you troubleshoot exactly what's happening.

For those asking about the two commands run together in the check_command, this is how the NRPE wizard sets up service definitions for check_nrpe and the plugin that it is requesting Nagios Remote Plugin Executor to execute. See Monitoring Hosts Using NRPE.

As this diagram shows, check_nrpe is executed on the monitoring (XI) server and contacts NRPE running on the "remote" server. NRPE then runs the "check command" requested by check_nrpe.
nrpe.png

Here is an example of a default service setup by the NRPE wizard.

Code: Select all

define service {
    host_name                192.168.58.241
    service_description      Current Load
    use                      generic-service
    check_command            check_nrpe!check_load! -a '-w 5,10,15 -c 10,20,30'!!!!!!
    max_check_attempts       5
    check_interval           5
    retry_interval           1
    check_period             xi_timeperiod_24x7
    notification_interval    60
    notification_period      xi_timeperiod_24x7
    contacts                 nagiosadmin
    _xiwizard                nrpe
    register                 1
}
Which translates to...

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 192.168.58.241 -t 30 -c check_load  -a '-w 5,10,15 -c 10,20,30'
You do not have the required permissions to view the files attached to this post.
Please let us know if you have any other questions or concerns.

-Laura
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 »

Actually I am using nagios core . Is there any solution for that ?
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 »

As I said it is working on nagios server manually such as follow

Code: Select all

[root@nagios ~]# /usr/local/nagios/libexec/check_http -H mb.com -w 5 -c 10 -p 8980 -u /mb/ai/branch/all -a mba:785\!"@"Nobv
HTTP OK: HTTP/1.1 200 OK - 11413 bytes in 0.017 second response time |time=0.017223s;5.000000;10.000000;0.000000 size=11413B;;;0

but when I use it in config file such as follow it does not work

Code: Select all

define service{
        use                     local-service
        host_name               subs
        service_description     mebp
        servicegroups           OD
        check_command           check_nrpe!check_http!' -H mb.com -w 5 -c 10 -p 8980 -u /mb/ai/branch/all  -a mba:785\!"@"Nobv'
}

kg2857
Posts: 491
Joined: Wed Apr 12, 2023 5:48 pm

Re: How can use complex password in check_http for url

Post by kg2857 »

You're running check_http directly on the nagios server, but the command is running check_http via nrpe on the http server. These aren't the same. Try getting rid of the check_nrpe part in the command. This was suggested several posts back.
Last edited by kg2857 on Tue Jul 09, 2024 1:25 am, edited 1 time in total.
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 how can correct it ?
kg2857
Posts: 491
Joined: Wed Apr 12, 2023 5:48 pm

Re: How can use complex password in check_http for url

Post by kg2857 »

Edit the service in CCM, change the command from nrpe to http, and change the arguments as needed.
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 »

I changed it such as follow

Code: Select all

define service{
        use                     local-service
        host_name               subs
        service_description     mebp
        servicegroups           OD
        check_command           check_http!' -H mb.com -w 5 -c 10 -p 8980 -u /mb/ai/branch/all  -a mba:785\!"@"Nobv'
}

Is that correct ?
kg2857
Posts: 491
Joined: Wed Apr 12, 2023 5:48 pm

Re: How can use complex password in check_http for url

Post by kg2857 »

What happens when it runs?
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

HTTP WARNING: HTTP/1.1 400 Bad Request - 309 bytes in 0.001 second response time
Performance Data: time=0.000723s;;;0.000000 size=309B;;;0
Current Attempt: 4/4 (HARD state)

but when run it manually from nagios server shows :

Code: Select all

HTTP OK: HTTP/1.1 200 OK - 11413 bytes in 0.010 second response time |time=0.009974s;5.000000;10.000000;0.000000 size=11413B;;;0
Locked