Hello Ladies and Gentlemen,
I’m running LibreNMS 1.33 on a Debian 9, apache2 2.4.25, php7 + php7-fpm. This way it’s super fast, but the API is not working. Before I upgraded from Debian 8 and php 5.5 it worked fine.
Here a curl output on the api_v0.php
Here the rewrite log about the same curl earlier
Here you have a strace of the curl:
[pid 18375] open(“/dev/urandom”, O_RDONLY|O_CLOEXEC) = 20
[pid 18375] stat(“/opt/librenms/html/api_v0.php”, {st_mode=S_IFREG|0644, st_size=10402, …}) = 0
[pid 18375] open(“/opt/librenms/html/.htaccess”, O_RDONLY|O_CLOEXEC) = 20
[pid 18375] open(“/opt/librenms/html/api_v0.php/.htaccess”, O_RDONLY|O_CLOEXEC) = -1 ENOTDIR (Not a directory)
[pid 18375] stat(“/opt/librenms/html/api_v0.php”, {st_mode=S_IFREG|0644, st_size=10402, …}) = 0
Here a strace of a /api/v0/devices curl
Validate.php output:
Component | Version |
---|---|
LibreNMS | 201605-3592-g13f0b9726 |
DB Schema | 214 |
PHP | 7.0.19-1 |
MySQL | 10.1.26-MariaDB-0+deb9u1 |
RRDTool | 1.6.0 |
SNMP | NET-SNMP 5.7.3 |
Here you have my fpm include of the virtual host:
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php7.0-fpm.sock|fcgi://localhost"
</FilesMatch>
I can access every file in my librenms/html directory, execept the api_v0.php. The file itself is accessable by www-data as i show you below:
-rw-r--r-- 1 librenms librenms 11K Oct 25 09:24 html/api_v0.php
librenms@server:/opt/librenms$ groups
librenms www-data
The Webgui is working fine. Only the api is not running at all. It seems that the api_v0.php file is not recognized as a php file but a directory.
Thank you in advance!
###Additions due to comments:
Zmegolaz33m
Hi! You should use curl -H ‘X-Auth-Token: YOURAPITOKENHERE’ https://librenms.org/api/v0 instead of accessing the api_v0.php file directly.
Here a rewrite log of:
curl -si -H "X-Auth-Token: MYTOKEN" https://librenms.example.com/api/v0
Here a rewrite log of:
curl -si -H "X-Auth-Token: MYTOKEN" https://librenms.example.com/api/v0/devices
lafGreat contributor7m
Double check your apache config, if you’ve updated from an older version of apache then it has a slight difference.https://docs.librenms.org/#Installation/Installation-Ubuntu-1604-Apache/#configure-apache