Page 2 of 3

Re: Nagios XI API question

Posted: Mon Mar 28, 2016 1:40 pm
by jkinning
Attached

Re: Nagios XI API question

Posted: Mon Mar 28, 2016 3:12 pm
by tgriep
Can you run those 3 commands from before but substitute the "x.x.x.x" with the actual IP address of your Nagios XI server and post the txt files?

Re: Nagios XI API question

Posted: Tue Mar 29, 2016 6:17 am
by jkinning
Sorry I thought I did that. Guess that is what I get for trying to multi-task. :oops:

Re: Nagios XI API question

Posted: Tue Mar 29, 2016 12:21 pm
by rkennedy
Looking at the file, there seems to be an issue with the SSL connection -

Code: Select all

* About to connect() to 10.131.98.100 port 443 (#0)
*   Trying 10.131.98.100... connected
* Connected to 10.131.98.100 (10.131.98.100) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* Peer's certificate issuer is not recognized: 'CN=WSFG Enterprise CA2,DC=WS,DC=WSFGRP,DC=NET'
* NSS error -8179
* Closing connection #0
* Peer certificate cannot be authenticated with known CA certificates
Have you imported the full certificate chain? This may be the issue.

Re: Nagios XI API question

Posted: Mon Jun 13, 2016 2:23 pm
by rkennedy
To follow up on this, I had a remote session that was similar. The underlying issue, is that his HTTPS didn't have a rule for the API. You may need to add this in your <VirtualHost> directive in your SSL file.

Code: Select all

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule nagiosxi/api/v1/(.*)$ /usr/local/nagiosxi/html/api/v1/index.php?request=$1 [QSA,NC,L]
</IfModule>

Re: Nagios XI API question

Posted: Tue Jun 14, 2016 10:49 am
by jkinning
I have imported teh certificate chain awhile back and still got the same error message:

Code: Select all

https://nagiosl1t.ws.wsfgrp.net/nagiosxi/api/v1/objects/hoststatus?apikey=elarg9deek3m242gsmvr65a9s7ttiobvdkqqq668p8tqasb6g8vlb9u7fp2uhdts&pretty=1
404

Not Found

The requested URL /nagiosxi/api/v1/objects/hoststatus was not found on this server.

Apache/2.2.15 (CentOS) Server at nagiosl1t.ws.wsfgrp.net Port 443
I added this to the <VirtualHost> section, about 4 lines down and still nothing changed. Developer that was working on this has temporarily transferred to another assignment which I why there hasn't been any new activity on my side. We'll be back at it probably in a few weeks.

Re: Nagios XI API question

Posted: Tue Jun 14, 2016 12:37 pm
by rkennedy
Can you post your ssl_error_log and error_log for us to look at? I'd like to see what file it says is missing.

Also, a copy of your /etc/httpd/conf.d/ssl.conf file will help as well.

Re: Nagios XI API question

Posted: Wed Jun 15, 2016 8:20 am
by jkinning
The ssl_error log is empty.

Re: Nagios XI API question

Posted: Wed Jun 15, 2016 9:38 am
by lmiltchev
I didn't see the section below in the ssl.conf...

Code: Select all

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule nagiosxi/api/v1/(.*)$ /usr/local/nagiosxi/html/api/v1/index.php?request=$1 [QSA,NC,L]
</IfModule>
Is it present in the "/etc/httpd/conf.d/nagiosxi.conf"? If you don't have it, the api commands will fail (if you are using ssl). Did you configure SSL in XI by following this document?

Re: Nagios XI API question

Posted: Wed Jun 15, 2016 9:51 am
by jkinning
Yes, it is in the nagiosxi.conf (attached) and yes I followed that guide to setup SSL.