Page 1 of 1

API not found

Posted: Mon Sep 26, 2016 12:44 pm
by asardouk
Hi,

I installed Nagios XI since few months. it works well. I tried to use the API.
The old one works well, but i got a message for the new one with the URL : https://xxxxxxx.fr/nagiosxi/api/v1/syst ... xxxxxxxxxx

Code: Select all

Not Found

The requested URL /nagiosxi/api/v1/system/status was not found on this server.
How can i resolve this ?

Thanks,

Centos 7 64 bits
Nagios XI 5.2.5 by manual Install
httpd with SSL

Re: API not found

Posted: Mon Sep 26, 2016 1:00 pm
by rkennedy
Can you please post everything in your /etc/httpd/conf.d/ directory? It might just need a rewrite rule for SSL, but this will help to see for sure what's going on.

Re: API not found

Posted: Tue Sep 27, 2016 3:28 am
by asardouk
Here is the nagiosxi.conf from /etc/httpd/conf.d/

Code: Select all

#NameVirtualHost *:443
<VirtualHost *:80> # Add this line
<Directory "/usr/local/nagiosxi/html">
# SSLRequireSSL
        Options None
        AllowOverride None
        Order allow,deny
        Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
# AuthName "Nagios XI"
# AuthType Basic
# AuthUserFile /usr/local/nagiosxi/etc/htpasswd.users
        Require all granted
</Directory> # Add this line
        RewriteEngine On
        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://%{SERVER_NAME}/nagiosxi/$1 [R,L]
</VirtualHost>
<VirtualHost *:443>
        ServerName XXXXX
        SSLEngine on
        SSLCompression off
        SSLProtocol all -SSLv2 -SSLv3
        SSLCertificateFile /etc/letsencrypt/live/XXXXX/cert.pem
        SSLCertificateChainFile /etc/letsencrypt/live/XXXXX/lets-encrypt-x3-cross-signed.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/XXXXX/privkey.pem
        SSLHonorCipherOrder on
        SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DE$
<Directory "/usr/local/nagiosxi/html">
        AllowOverride All
        Require all granted
</Directory>
</VirtualHost>

Alias /nagiosxi "/usr/local/nagiosxi/html"


Re: API not found

Posted: Tue Sep 27, 2016 9:34 am
by lmiltchev
Do you see the following section of code in the "/etc/httpd/conf.d/ssl.conf" before d before </VirtualHost>?

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>
https://assets.nagios.com/downloads/nag ... s%20XI.pdf

Re: API not found

Posted: Tue Sep 27, 2016 12:56 pm
by asardouk
I found it in another file "ssl.conf" with the AJAXTERM part. So i put them in my nagiosxi.conf and it works !!

Thanks for help :D