Problem with plugins

Hi
Today I had the same problem on two hosts “All menu items jumping to dasboard”
After dailly …

Now Librenms interface is crash and I in see error_log:

2018/07/17 15:40:09 [error] 1289#1289: *8 FastCGI sent in stderr: “PHP message: PHP Fatal error: Cannot declare class Weathermap, because the name is already in use in /opt/librenms/html/plugins/Weathermap/Weathermap.php on line 3” while reading response header from upstream, client: 10.1.1.131, server: librenms.example.com, request: “GET / HTTP/1.1”, upstream: “fastcgi://unix:/var/run/php/php7.0-fpm.sock:”, host: “10.1.1.44”
2018/07/17 15:43:46 [error] 1289#1289: *16 FastCGI sent in stderr: “PHP message: PHP Fatal error: Cannot declare class Vlan_Search, because the name is already in use in /opt/librenms/html/plugins/Vlan_Search/Vlan_Search.php on line 13” while reading response header from upstream, client: 10.1.1.131, server: librenms.example.com, request: “GET / HTTP/1.1”, upstream: “fastcgi://unix:/var/run/php/php7.0-fpm.sock:”, host: “10.1.1.44”

LibreNMS | 1.41-36-g67c585b
DB Schema | 254
PHP | 7.0.30-0ubuntu0.16.04.1
MySQL | 10.0.34-MariaDB-0ubuntu0.16.04.1
RRDTool | 1.5.5
SNMP | NET-SNMP 5.7.3

[OK] Composer Version: 1.6.5
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct

Best regards
Lukasz

Hello

I submitted a PR for Weathermap plugin just now. Until then, the fix is easy :
add the following line

namespace LibreNMS\Plugins;

after the

<?php

@laf: PR is in the librenms-plugins repo.

PipoCanaja

Thank you, now LibreNMS interfase works, but unfortunately, these plugins aren’t working right now :frowning:
I I added the attachment with error.

I added an entry “namespace LibreNMS\Plugins;” to all plugin

/opt/librenms/html/plugins/Weathermap/Weathermap.php
/opt/librenms/html/plugins/Vlan_Search/Vlan_Search.php
/opt/librenms/html/plugins/DepMap/DepMap.php
/opt/librenms/html/plugins/ConfigValidator/ConfigValidator.php

Thanks for a quick response.

Lukasz

libreplugins

Correct. The changes are a little bit more complicated to be posted here. But weathermap is in working state here :

Still unsure about what @laf will decide for this code.

PipoCanaja

Thanks PipoCanaja

@PipoCanaja Adding a namespace to the plugin is fine, but this was fixed upstream.

It was broken by an update to the plugin system that caused the plugin class file to be included twice in a non-obvious way.

Thanks Murrant.

I removed the your patch, next I done ./daily.sh (10 minutes ago),
I have removed example: an entry (namespace … ) from the file : Vlan_Search.php. Now I have white screen and error:

2018/07/18 01:06:11 [error] 1308#1308: *2512 FastCGI sent in stderr: “PHP message: PHP Fatal error: Cannot declare class Vlan_Search, because the name is already in use in /opt/librenms/html/plugins/Vlan_Search/Vlan_Search.php on line 17
PHP message: PHP Fatal error: Uncaught BadMethodCallException: Method [send] does not exist on view. in /opt/librenms/vendor/laravel/framework/src/Illuminate/View/View.php:399
Stack trace:
#0 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(112): Illuminate\View\View->__call(‘send’, Array)
#1 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(89): Illuminate\Foundation\Bootstrap\HandleExceptions->renderHttpResponse(Object(Symfony\Component\Debug\Exception\FatalErrorException))
#2 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(123): Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Symfony\Component\Debug\Exception\FatalErrorException))
#3 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()
#4 {main}
thrown in /opt/librenms/vendor/laravel/framework/src/Illuminate/View/View.php on line 399” while reading response header from upstream, client: 192.168.66.17, server: librenms.example.com, request: “GET /plugin/p=Weathermap HTTP/1.1”, upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:2018/07/18 01:06:11 [error] 1308#1308: *2512 FastCGI sent in stderr: “PHP message: PHP Fatal error: Cannot declare class Vlan_Search, because the name is already in use in /opt/librenms/html/plugins/Vlan_Search/Vlan_Search.php on line 17
PHP message: PHP Fatal error: Uncaught BadMethodCallException: Method [send] does not exist on view. in /opt/librenms/vendor/laravel/framework/src/Illuminate/View/View.php:399
Stack trace:
#0 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(112): Illuminate\View\View->__call(‘send’, Array)
#1 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(89): Illuminate\Foundation\Bootstrap\HandleExceptions->renderHttpResponse(Object(Symfony\Component\Debug\Exception\FatalErrorException))
#2 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(123): Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Symfony\Component\Debug\Exception\FatalErrorException))
#3 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()
#4 {main}
thrown in /opt/librenms/vendor/laravel/framework/src/Illuminate/View/View.php on line 399” while reading response header from upstream, client: 192.168.66.17, server: librenms.example.com, request: “GET /plugin/p=Weathermap HTTP/1.1”, upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:

Ps. I will be grateful for the help, I and my clients use these plugins, until today :wink:
Lukasz

It is working for me using the current LibreNMS version and the current Vlan_search code from github.

Is it still broken for you?

Yes, after today update Vlan_search works now.

At the moment don’t work “Dependency Map” plugin yet.
Could you install this plugin and check on your librenms test system?

Thanks for help.
Regards
Lukasz