Closed ISekan closed 6 years ago
Weathermap isn't supported on 1.x yet. However, @howardjones has been making some changes recently to get it moved towards that goal. I haven't yet had a change to download his latest master source from the repository. You may want to give that a try if you wish to continue using Weathermap.
Thanks, I'm wailting for a changes
It's not ready yet. This error dump is useful though! :-) I think I need to add a line to the README for the dev version to run composer update
. It looks like the vendor/autoload.php is missing in your local copy, which is created by composer. It will still fail somewhere else, but not here.
(In the final release, these files will be baked in, but they shouldn't go in git because they are generated)
Any testing you need, let me know. Creating a few environments for testing different Linux versions to debug a few different issues I've seen with the base Cacti.
Then maybe I can help you :-) In the dev/Vagrant folder is a Vagrantfile that lets you spin up most Cacti versions (0.8.8x + 1.x) with php 5.6 or 7.1 very quickly and with the same setup each time. Maybe it would help with your testing. This is what I use to test weathermap/cacti integration.
If you have similar scripts for something other than Ubuntu, maybe we can join forces?
Hello. I can also help with testing. I'm upgrading my Cacti from the development branch. My latest Cacti version is 1.1.29. My PHP:
PHP 7.0.24 (cli) (built: Oct 25 2017 15:31:55) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.24, Copyright (c) 1999-2017, by Zend Technologies
and my OS version and family:
FreeBSD 11.1-STABLE FreeBSD 11.1-STABLE #7 r324971M: Thu Oct 26 05:34:25 EEST 2017
It's real working cacti server, but the map has not yet been completely drawn, so I can test it.
Other:
Composer version 1.5.6 2017-12-18 12:09:18
bower: 1.8.2
I'm going to be installing a CentOS and Debian platform tomorrow. If there's another platform that would be useful, I can probably add that too. They don't need to be high spec systems since this is more an installation/error tracking exercise. @pautiina has a FreeBSD so that's another one off the list :)
I have update all and I try enable plugin, but on log file have error and plugin automatically disabled:
2018/01/03 17:56:47 - CMDPHP ERRORS DETECTED - DISABLING PLUGIN 'weathermap'
--
2018/01/03 17:56:47 - CMDPHP PHP ERROR Backtrace: (CactiShutdownHandler)(/lib/functions.php: 4448 cacti_debug_backtrace)
2018/01/03 17:56:47 - ERROR PHP ERROR in Plugin 'weathermap': Uncaught Error: Call to undefined function weathermap_run_maps() in /var/www/data/cacti/plugins/weathermap/lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php:167
2018/01/03 17:56:47 - CMDPHP PHP ERROR WARNING Backtrace: (/poller.php: 722 api_plugin_hook)(/lib/plugins.php: 73 api_plugin_run_plugin_hook)(/lib/plugins.php: 170 weathermap_poller_bottom)(/plugins/weathermap/lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php: 148 include_once)(/plugins/weathermap/lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php: 148 CactiErrorHandler)(/lib/functions.php: 4405 cacti_debug_backtrace)
2018/01/03 17:56:47 - ERROR PHP WARNING in Plugin 'weathermap': include_once(): Failed opening '/var/www/data/cacti/plugins/weathermap/lib/Weathermap/Integrations/Cacti/poller-common.php' for inclusion (include_path='.:/usr/local/share/pear') in file: /var/www/data/cacti/plugins/weathermap/lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php on line: 148
2018/01/03 17:56:47 - CMDPHP PHP ERROR WARNING Backtrace: (/poller.php: 722 api_plugin_hook)(/lib/plugins.php: 73 api_plugin_run_plugin_hook)(/lib/plugins.php: 170 weathermap_poller_bottom)(/plugins/weathermap/lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php: 148 include_once)(/plugins/weathermap/lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php: 148 CactiErrorHandler)(/lib/functions.php: 4405 cacti_debug_backtrace)
2018/01/03 17:56:47 - ERROR PHP WARNING in Plugin 'weathermap': include_once(/var/www/data/cacti/plugins/weathermap/lib/Weathermap/Integrations/Cacti/poller-common.php): failed to open stream: No such file or directory in file: /var/www/data/cacti/plugins/weathermap/lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php on line: 148
2018/01/03 17:56:45 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/weathermap/weathermap-cacti10-plugin.php: 16 main)(/plugins/weathermap/lib/Weathermap/Integrations/Cacti/WeatherMapCactiUserPlugin.php: 99 dispatchRequest)(/plugins/weathermap/lib/Weathermap/UI/UIBase.php: 130 handleDefaultView)(/plugins/weathermap/lib/Weathermap/Integrations/Cacti/WeatherMapCactiUserPlugin.php: 251 drawFullMapView)(/plugins/weathermap/lib/Weathermap/Integrations/Cacti/WeatherMapCactiUserPlugin.php: 460 drawOneFullMap)(/plugins/weathermap/lib/Weathermap/Integrations/Cacti/WeatherMapCactiUserPlugin.php: 499 CactiErrorHandler)(/lib/functions.php: 4410 cacti_debug_backtrace)
2018/01/03 17:56:45 - ERROR PHP NOTICE in Plugin 'weathermap': Undefined property: stdClass::$configfile in file: /var/www/data/cacti/plugins/weathermap/lib/Weathermap/Integrations/Cacti/WeatherMapCactiUserPlugin.php on line: 499
I think that weathermap_run_maps() should be a call to runMaps in poller-common.php but don't quote me on that. It is more likely that the file containing weathermap_run_maps() is missing or the function has been accidentally removed.
No, this stuff is halfway between two states. The old way was a single giant function called weathermap_run_maps() (now runMaps) in poller-common. The new way will be to create a Poller object, which asks the MapManager which maps it should run, then for each map it creates a Runtime object that contains all the stuff relevant only to running that map (all the filenames mainly), and actually runs one map.
I said I wasn't expecting anyone to have a working poller :-) Just that one error with autoload.php was easy to fix.
Haha, OK. Missed that above!
Hello. I have retest last you commit and now have new problem:
2018/01/05 12:46:39 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/weathermap/weathermap-cacti10-plugin.php: 16 main)(/plugins/weathermap/lib/Weathermap/Integrations/Cacti/WeatherMapCactiUserPlugin.php: 99 dispatchRequest)(/plugins/weathermap/lib/Weathermap/UI/UIBase.php: 130 handleDefaultView)(/plugins/weathermap/lib/Weathermap/Integrations/Cacti/WeatherMapCactiUserPlugin.php: 251 drawFullMapView)(/plugins/weathermap/lib/Weathermap/Integrations/Cacti/WeatherMapCactiUserPlugin.php: 460 drawOneFullMap)(/plugins/weathermap/lib/Weathermap/Integrations/Cacti/WeatherMapCactiUserPlugin.php: 499 CactiErrorHandler)(/lib/functions.php: 4434 cacti_debug_backtrace)
--
2018/01/05 12:46:39 - ERROR PHP NOTICE in Plugin 'weathermap': Undefined property: stdClass::$configfile in file: /var/www/data/cacti/plugins/weathermap/lib/Weathermap/Integrations/Cacti/WeatherMapCactiUserPlugin.php on line: 499
This happens when I switch to the Weathermap tab.
After this plugin disabled.
Below is a screenshot of what's happening in the browser.
and now we have error, when poller try run create map:
2018/01/05 12:54:22 - CMDPHP ERRORS DETECTED - DISABLING PLUGIN 'weathermap'
--
2018/01/05 12:54:22 - CMDPHP PHP ERROR Backtrace: (CactiShutdownHandler)(/lib/functions.php: 4472 cacti_debug_backtrace)
thrown in file: /var/www/data/cacti/plugins/weathermap/lib/Weathermap/Poller/poller-common.php on line: 191
#4 {main}
#3 /var/www/data/cacti/poller.php(603): api_plugin_hook('poller_bottom')
#2 /var/www/data/cacti/lib/plugins.php(73): api_plugin_run_plugin_hook('poller_bottom', 'weathermap', 'weathermap_poll...', Array)
#1 /var/www/data/cacti/lib/plugins.php(170): weathermap_poller_bottom(Array)
#0 /var/www/data/cacti/plugins/weathermap/lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php(168): Weathermap\Poller\runMaps('/var/www/data/c...')
Stack trace:
2018/01/05 12:54:22 - ERROR PHP ERROR in Plugin 'weathermap': Uncaught Error: Class 'Weathermap\Core\Map' not found in /var/www/data/cacti/plugins/weathermap/lib/Weathermap/Poller/poller-common.php:191
2018/01/05 12:54:22 - WEATHERMAP [Map 1] ISTEC.conf: Map: /var/www/data/cacti/plugins/weathermap/configs/ISTEC.conf -> /var/www/data/cacti/plugins/weathermap/output/30ecedbd3c9f1acabc65.html & /var/www/data/cacti/plugins/weathermap/output/30ecedbd3c9f1acabc65.png
2018/01/05 12:54:22 - WEATHERMAP Weathermap 1.0.0dev starting - Normal logging mode. Turn on DEBUG in Cacti for more information
The update that says "As long as you don't add any maps, poller runs ;-)"?
Still working out the best way to use an autoloader for most of Weathermap, even though Cacti doesn't use one. If I try to load my autoloader, Cacti kills the plugin immediately. So I will probably be:
Making the poller process that actually updates maps into an external process, called by the poller.
Adding a bunch of includes in the Cacti plugin, and trying to keep the size of it to a minimum, even more.
That may be down to the error handling of Cacti's plugin management. I think the autoloader works by tapping in the errors and loading classes if it can find them. It may be worth looking at updating the plugin functionality on cacti to allow that since autoloading is used by a lot of classes. Do you have any error logs that show cacti shutting it down?
I take that back, I was thinking of something else. Autoloading simply uses the __autoload() function or any function you register to spl_autoload_register
so unless an error is occuring, cacti shouldn't be disabling weathermap because of that.
No, that's the slightly annoying part - it's just immediately disabled. I haven't turned up the logging yet - I just tried this quickly last night before I finished. It could well be something like that though, because in the poller, where I check for a writable output directory, I use @fopen to block a likely error and check the result after. That now results in a big stacktrace (but luckily not a plugin-disable) from Cacti, too. It might also be as simple as I got the wrong path for the autoload.php though.
As far as I know, loading multiple autoloaders should just stack them up, and they get called in turn. All Weathermap's classes are in \Weathermap namespaces, so that should be safe. A lot of these newer features get a bit more fun when you are part of a larger piece of code you don't necessarily trust :-) (or vice versa)
Sorry guys, the PIA is draconian on that point. It was deployed this way to protect the web site and poller crashing due to fatal errors inside the plugins themselves.
Yeah, I've seen the code :) Thats why I am sure it's an unhandled error. However, turning up logging shouldn't be necessary because any error of that type in the PIA is recorded from what I've seen.
Understood for catching errors (although an @error isn't really an error...). But what about spl_autoload_register? It's the way of the future for some years now :-)
The beauty of GitHub is that it allows more contribution from others. Cacti is doing pretty well right now. Contributors like netniV are helping clear up the machine. We've now had 40 contributors to Cacti. That would never have happened before GitHub. I enjoy watching it progress. I guess what I'm trying to say, is though I can not contribute directly, I love it when new developers come along to breath a little life into the project.
I started using Cacti in August as a way to provide some stats. It's become a bigger part of my life now as I quite enjoy bug fixing. Plus it's always interesting learning new coding methods.
The plugins only get disabled by Cacti itself in the CactiErrorHandler
if it detects it's within a plugin for the following cases
case E_COMPILE_ERROR:
case E_CORE_ERROR:
case E_ERROR:
case E_PARSE:
Or by the CactiShutdownHandler
on these cases:
case E_ERROR:
case E_CORE_ERROR:
case E_COMPILE_ERROR:
case E_CORE_WARNING:
case E_COMPILE_WARNING:
case E_PARSE:
There is a difference between the two functions in the way they work as one disables the plugin before logging the error, the other logs the error before disabling the plugin. Might raise that as they should be consistent.
The only other two places that disables a plugin is the plugins.php page when a user selects to disable it, or if the 1.0.0 file is run using the databsae_upgrade.php script or /install/ (only from 0.8.x versions) if the plugin is not compatible with that new version of cacti.
As soon as I have a working desktop again (kernel update for meltdown also melted my nvidia drivers) I will be able to investigate further. Like you, I can't work on Cacti, so I'm stuck with what there is, which leads to a somewhat different attitude to it :-)
Looks like there are registered autoloaders for a few other packages (twig, phpmailer) already though, so I'm hopeful that that will be a simple fix.
My company is a little more flexible now when it comes to the GPL since the acquisition in 2011. I just have not gotten the will power to ask if I can contribute again. Maybe, if I'm real lucky, this year I can change that.
I have my test systems built to bare OS installs now. If I get a chance over the weekend, I'll try and get cacti running on one. What version of Linux are you using howard?
My Vagrant box is Ubuntu 16.04 LTS. And actually, so is my dev desktop. It's definitely worth checking out vagrant - you can build and tear down fresh installls in a minute or two, with the same build each time.
Never used it yet, but I have VMware with snapshots so I can do the same sort of thing as long as I have my scripts. However, the vagrant thing may be something I do if I can figure it out.
OK - "working" with the autoloader now. Working as in, not crashing in the poller with no maps. Anything beyond that is a bonus. Everything in the actual user interface is pure luck, especially.
thrown in file: /usr/share/cacti/plugins/weathermap/lib/Weathermap/Core/Map.php on line: 889
2018/01/09 13:24:45 - ERROR PHP ERROR in Plugin 'weathermap': Uncaught Error: Call to undefined method Weathermap\Core\MapLink::my_type() in /usr/share/cacti/plugins/weathermap/lib/Weathermap/Core/Map.php:889 2018/01/09 13:24:45 - WEATHERMAP Wrote map to /usr/share/cacti/plugins/weathermap/output/7f679e3758b03cf95dce.jpg and /usr/share/cacti/plugins/weathermap/output/7f679e3758b03cf95dce.thumb.jpg 2018/01/09 13:24:45 - WEATHERMAP About to write image file. If this is the last message in your log, increase memory_limit in php.ini () [WMPOLL01] : memory_get_usage() says 7.6MBytes used. Limit is 512M 2018/01/09 13:24:45 - WEATHERMAP Map: /usr/share/cacti/plugins/weathermap/configs/simple.conf -> /usr/share/cacti/plugins/weathermap/output/7f679e3758b03cf95dce.html & /usr/share/cacti/plugins/weathermap/output/7f679e3758b03cf95dce.jpg 2018/01/09 13:24:45 - WEATHERMAP Weathermap 1.0.0dev starting - Normal logging mode. Turn on DEBUG in Cacti for more information
I went to test this but the autoloader was missing:
./lib/all.php:require_once dirname(__FILE__) . '/../vendor/autoload.php';
When I tried find . -name \*autoload\*
nothing comes up.
/plugins/weathermap$ find . -name setup\*
./setup-common.php
./setup10.php
./setup88.php
./setup.php
/plugins/weathermap$ find . -name \*autoload\*
/plugins/weathermap$
If anyone else tries that, check out https://github.com/magento/magento2/issues/838
Or follow the proper installation instructions :)
Hmm, bower install
was not working as it returns:
/usr/bin/env: ânodeâ: No such file or directory
Apparently a ubuntu-specific issue as the package installs the file as nodejs
not node
so had to run:
ln -s /usr/bin/nodejs /usr/bin/node
Next issue was:
$ composer update
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for lstrojny/phpunit-clever-and-smart ^0.5.0 -> satisfiable by lstrojny/phpunit-clever-and-smart[0.5.0].
- lstrojny/phpunit-clever-and-smart 0.5.0 requires ext-sqlite3 * -> the requested PHP extension sqlite3 is missing from your system.
Problem 2
- codeclimate/php-test-reporter v0.4.4 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- codeclimate/php-test-reporter v0.4.3 requires ext-curl * -> the requested PHP extension curl is missing from your system.
<truncated>
Ran the following to get this working on ubuntu:
sudo apt install php-curl php-sqlite3
sudo phpenmod curl sqlite3
And now we appear to be done. With only the following warning:
guzzle/guzzle suggests installing guzzlehttp/guzzle (Guzzle 5 has moved to a new package name. The package you have installed, Guzzle 3, is deprecated.)
Package guzzle/guzzle is abandoned, you should avoid using it. Use guzzlehttp/guzzle instead.
Decided to try and create a map tonight once I realised there was an editor link down the bottom. Maybe the main page should prompt a novice user like me 👍
Anyway, I found my way in, tried to create a copy of an existing configuration under the create new map as a copy, and received a not totally unexpected error 500 👎
PHP Fatal error: Uncaught Weathermap\\Core\\WeathermapInternalFail: Don't like this config filename in /usr/share/cacti/develop/plugins/weathermap/lib/Weathermap/Editor/EditorUI.php:900\nStack trace:
#0 /usr/share/cacti/develop/plugins/weathermap/editor.php(34): Weathermap\\Editor\\EditorUI->main(Array, true)
#1 /usr/share/cacti/develop/plugins/weathermap/weathermap-cacti10-plugin-editor.php(22): require_once('/usr/share/cact...')
#2 {main}\n thrown in /usr/share/cacti/develop/plugins/weathermap/lib/Weathermap/Editor/EditorUI.php on line 900,
referer: https://test.cacti.gouldhall.com/plugins/weathermap/weathermap-cacti10-plugin-editor.php
Would also suggest changing the title of this issue if leaving it open so that it reflects all 1.x versions as an update.
The actual UI in Cacti is basically temporary at this point - a half-converted version of the 0.8.8 plugin, modified to work with both versions of Cacti. I got frustrated with the way 1.x expects plugins to work (which I'm mostly guessing, along with cigamit's initial big contribution) that I decided to go a different route and make it mostly client-side.
Anyway, It is indeed my intention to have something like: if (nmaps==0 and user_is_mapadmin()) { pointers to manual, and management page }
:-)
Honestly, I don't really like using Issues for these long rambling threads of "things that don't currently work". The discussion is useful, but this isn't a great format for it, and the issue will basically never "really" close until the release version, by definition. This kind of thing works better in a forum, leaving Issues for one-time, clearly defined, and provably fixed issues.
03-Jan-2018 14:30:30 - CMDPHP ERRORS DETECTED - DISABLING PLUGIN 'weathermap'
03-Jan-2018 14:30:30 - CMDPHP PHP ERROR Backtrace: (CactiShutdownHandler)(/lib/functions.php: 4446 cacti_debug_backtrace) 03-Jan-2018 14:30:30 - ERROR PHP COMPILE_ERROR in Plugin 'weathermap': require_once(): Failed opening required '/usr/share/cacti/plugins/weathermap/lib/../vendor/autoload.php' (include_path='.:/usr/share/pear:/usr/share/php') in file: /usr/share/cacti/plugins/weathermap/lib/all.php on line: 12 03-Jan-2018 14:30:30 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/weathermap/weathermap-cacti10-plugin-editor.php: 22 require_once)(/plugins/weathermap/editor.php: 5 require_once)(/plugins/weathermap/lib/all.php: 12 require_once)(/plugins/weathermap/lib/all.php: 12 CactiErrorHandler)(/lib/functions.php: 4403 cacti_debug_backtrace) 03-Jan-2018 14:30:30 - ERROR PHP WARNING in Plugin 'weathermap': require_once(/usr/share/cacti/plugins/weathermap/lib/../vendor/autoload.php): failed to open stream: No such file or directory in file: /usr/share/cacti/plugins/weathermap/lib/all.php on line: 12
03-Jan-2018 14:31:56 - CMDPHP ERRORS DETECTED - DISABLING PLUGIN 'weathermap'
03-Jan-2018 14:31:56 - CMDPHP PHP ERROR Backtrace: (CactiShutdownHandler)(/lib/functions.php: 4446 cacti_debug_backtrace) thrown in file: /usr/share/cacti/plugins/weathermap/lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php on line: 167
3 {main}
2 /usr/share/cacti/poller.php(722): api_plugin_hook('poller_bottom')
1 /usr/share/cacti/lib/plugins.php(73): api_plugin_run_plugin_hook('poller_bottom', 'weathermap', 'weathermap_poll...', Array)
0 /usr/share/cacti/lib/plugins.php(170): weathermap_poller_bottom(Array)
Stack trace: 03-Jan-2018 14:31:56 - ERROR PHP ERROR in Plugin 'weathermap': Uncaught Error: Call to undefined function weathermap_run_maps() in /usr/share/cacti/plugins/weathermap/lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php:167 03-Jan-2018 14:31:56 - CMDPHP PHP ERROR WARNING Backtrace: (/poller.php: 722 api_plugin_hook)(/lib/plugins.php: 73 api_plugin_run_plugin_hook)(/lib/plugins.php: 170 weathermap_poller_bottom)(/plugins/weathermap/lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php: 148 include_once)(/plugins/weathermap/lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php: 148 CactiErrorHandler)(/lib/functions.php: 4403 cacti_debug_backtrace) 03-Jan-2018 14:31:56 - ERROR PHP WARNING in Plugin 'weathermap': include_once(): Failed opening '/usr/share/cacti/plugins/weathermap/lib/Weathermap/Integrations/Cacti/poller-common.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in file: /usr/share/cacti/plugins/weathermap/lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php on line: 148 03-Jan-2018 14:31:56 - CMDPHP PHP ERROR WARNING Backtrace: (/poller.php: 722 api_plugin_hook)(/lib/plugins.php: 73 api_plugin_run_plugin_hook)(/lib/plugins.php: 170 weathermap_poller_bottom)(/plugins/weathermap/lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php: 148 include_once)(/plugins/weathermap/lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php: 148 CactiErrorHandler)(/lib/functions.php: 4403 cacti_debug_backtrace) 03-Jan-2018 14:31:56 - ERROR PHP WARNING in Plugin 'weathermap': include_once(/usr/share/cacti/plugins/weathermap/lib/Weathermap/Integrations/Cacti/poller-common.php): failed to open stream: No such file or directory in file: /usr/share/cacti/plugins/weathermap/lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php on line: 148