Page 2 of 2

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

Posted: Thu Oct 11, 2012 10:53 am
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.

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

Posted: Thu Oct 11, 2012 10:59 am
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?

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

Posted: Thu Oct 11, 2012 11:15 am
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$

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

Posted: Thu Oct 11, 2012 11:21 am
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);

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

Posted: Thu Oct 11, 2012 11:24 am
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.

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

Posted: Thu Oct 11, 2012 11:27 am
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

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

Posted: Thu Oct 11, 2012 1:15 pm
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!