xi 2012R1.0 Breaks monitoring another Nagios xi server

This support forum board is for support questions relating to Nagios xi, our flagship commercial network monitoring solution.
User avatar
GldRush98
Posts: 256
Joined: Wed May 25, 2011 10:51 am
Location: Springfield, IL

Re: xi 2012R1.0 Breaks monitoring another Nagios xi server

Post by GldRush98 »

I was trying to recreate it myself. I set up 2 clean CentOS installs of 2012 and it worked fine between the 2.
I did not how ever enable and try using ssl. I could be wrong, but it's the only thing really out-of-the-ordinary that I can think of that might be fouling it up.
Dev & Prod xi: Debian 12 - Nagios xi 2024R1.3
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: xi 2012R1.0 Breaks monitoring another Nagios xi server

Post by mguthrie »

Can you verify in the Core Config Manager->Services and see if http:// is maybe hard-coded in the check command for those services?
User avatar
GldRush98
Posts: 256
Joined: Wed May 25, 2011 10:51 am
Location: Springfield, IL

Re: xi 2012R1.0 Breaks monitoring another Nagios xi server

Post by GldRush98 »

I temporarily enabled http on the main xi server and changed the check (running at command line) to http and it worked... so it is definitely something with https breaking it.

mguthrie wrote:Can you verify in the Core Config Manager->Services and see if http:// is maybe hard-coded in the check command for those services?
Looks ok there.
check_xi_nagiosxiserver

Code: Select all

/usr/bin/php $USER1$/check_nagiosxiserver.php $ARG1$
Dev & Prod xi: Debian 12 - Nagios xi 2024R1.3
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: xi 2012R1.0 Breaks monitoring another Nagios xi server

Post by mguthrie »

Just to check and see something, try updating line 535 of /usr/local/nagios/libexec/check_nagiosxiserver.php from:

Code: Select all

        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
To

Code: Select all

        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
User avatar
GldRush98
Posts: 256
Joined: Wed May 25, 2011 10:51 am
Location: Springfield, IL

Re: xi 2012R1.0 Breaks monitoring another Nagios xi server

Post by GldRush98 »

I just figured it out!!!

I enabled debugging in the /usr/local/nagios/libexec/check_nagiosxiserver.php file.

With the check not working, I got:

Code: Select all

[root@nagios httpd]# /usr/bin/php /usr/local/nagios/libexec/check_nagiosxiserver.php --address=mydomain.com --url=https://mydomain.com/nagiosxi --username=nagiosadmin --ticket="xxxxxxxx" --mode=load --warn="5,4,4" --crit="10,10,7"
ACCESSING URL: https://mydomain.com/nagiosxi/backend/?username=nagiosadmin&ticket=xxxxxxx&cmd=getsysstat
RESULT:
Array
(
    [headers] => Array
        (
        )

    [body] =>
    [info] => Array
        (
            [url] => https://mydomain.com:80/nagiosxi/backend/
            [content_type] =>
            [http_code] => 0
            [header_size] => 0
            [request_size] => 0
            [filetime] => -1
            [ssl_verify_result] => 0
            [redirect_count] => 0
            [total_time] => 0
            [namelookup_time] => 0.001075
            [connect_time] => 0.003838
            [pretransfer_time] => 0
            [size_upload] => 0
            [size_download] => 0
            [speed_download] => 0
            [speed_upload] => 0
            [download_content_length] => -1
            [upload_content_length] => -1
            [starttransfer_time] => 0
            [redirect_time] => 0
            [certinfo] => Array
                (
                )

        )

)
Error: Could not parse XML from https://mydomain.com/nagiosxi ()
Well hold on a minute... why is it telling it to use port 80 over https? That will never work...
So I adjusted the check command to:

Code: Select all

[root@nagios httpd]# /usr/bin/php /usr/local/nagios/libexec/check_nagiosxiserver.php --address=mydomain.com --url=https://mydomain.com:443/nagiosxi --username=nagiosadmin --ticket="xxxxxxx" --mode=load --warn="5,4,4" --crit="10,10,7"
And bam, it worked. So not only is https:// necessary, but the :443 port now has to be specified.
Dev & Prod xi: Debian 12 - Nagios xi 2024R1.3
User avatar
GldRush98
Posts: 256
Joined: Wed May 25, 2011 10:51 am
Location: Springfield, IL

Re: xi 2012R1.0 Breaks monitoring another Nagios xi server

Post by GldRush98 »

mguthrie wrote:Just to check and see something, try updating line 535 of /usr/local/nagios/libexec/check_nagiosxiserver.php from:

Code: Select all

        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
To

Code: Select all

        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
I checked this for you, but that wasn't it. Still need :443 in the url
Dev & Prod xi: Debian 12 - Nagios xi 2024R1.3
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: xi 2012R1.0 Breaks monitoring another Nagios xi server

Post by mguthrie »

Ok, I'll have to take a look at that function and see what's going on. Obviously it's "supposed" to default to 443 for SSL, but evidently not ; ) Thanks for the report!