Nagios XI API question

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: Nagios XI API question

Post by jkinning »

Attached
You do not have the required permissions to view the files attached to this post.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Nagios XI API question

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: Nagios XI API question

Post by jkinning »

Sorry I thought I did that. Guess that is what I get for trying to multi-task. :oops:
You do not have the required permissions to view the files attached to this post.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Nagios XI API question

Post 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.
Former Nagios Employee
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Nagios XI API question

Post 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>
Former Nagios Employee
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: Nagios XI API question

Post 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.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Nagios XI API question

Post 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.
Former Nagios Employee
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: Nagios XI API question

Post by jkinning »

The ssl_error log is empty.
You do not have the required permissions to view the files attached to this post.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Nagios XI API question

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: Nagios XI API question

Post by jkinning »

Yes, it is in the nagiosxi.conf (attached) and yes I followed that guide to setup SSL.
You do not have the required permissions to view the files attached to this post.
Locked