network-weathermap
network-weathermap copied to clipboard
Weathermap.class.php warnings
Hi, im writing a weathermap module for centreon (not cacti)
I am getting warning for array key "argv" not set for $_SERVER at line 718
I am also having relative path troubles with opendir() trying to open .../lib/lib/datasources
.../lib/lib/pre
.../lib/lib/post
(double lib) at line 719
A workaround was to replace L434:
$this->LoadPlugins('data', 'lib' . DIRECTORY_SEPARATOR . 'datasources');
$this->LoadPlugins('pre', 'lib' . DIRECTORY_SEPARATOR . 'pre');
$this->LoadPlugins('post', 'lib' . DIRECTORY_SEPARATOR . 'post');
to
$this->LoadPlugins('data', DIRECTORY_SEPARATOR . 'datasources');
$this->LoadPlugins('pre', DIRECTORY_SEPARATOR . 'pre');
$this->LoadPlugins('post', DIRECTORY_SEPARATOR . 'post');
fixing that I had an error at WeatherMapDataSource_snmp.php#L114 and WeatherMapDataSource_snmp.php#L129
Array and string offset access syntax with curly braces is no longer supported
0.98a
0.98-php8
PHP Version 8.0.21
With which versions of PHP, weathermap and OS?
On Thu, 21 Jul 2022, 19:41 Luiz Felipe Aranha, @.***> wrote:
Hi
I am getting warning for array key "argv" that I assume it doesn't exist anymore for $_SERVER at line 718 https://github.com/howardjones/network-weathermap/blob/version-0.98a/lib/Weathermap.class.php#L718
I am also having relative path troubles with opendir() trying to open /lib/lib/datasources (double lib) at line 719 https://github.com/howardjones/network-weathermap/blob/version-0.98a/lib/Weathermap.class.php#L719
— Reply to this email directly, view it on GitHub https://github.com/howardjones/network-weathermap/issues/301, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG6YJO6NRI2UB4VAO424WTVVGKUXANCNFSM54IT2PHQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
0.98a
0.98-php8
PHP Version 8.0.21
CentOS Linux release 7.9.2009
(sorry for replying to issues on my phone - I didn't see that you had already given most of those details)
For the LoadPlugins issue - does the command-line tool still work then? I think it won't. It is expecting your current working directory to be the one containing lib
.
I did have a quick check through for PHP 8 updates, and I think the command-line tool also will have issues with CLI/Getopt. The curly brace error is also a quick fix - they just need to be replaced with [ ]. I'll try to get some time for this in the next week or so.
Turns out I did already start this, and it's in the 0.98-php8 branch: https://github.com/howardjones/network-weathermap/tree/0.98-php8
Still more to go!
here is another one:
HTML_ImageMap.class.php lines 112, 149, 230 has a required parameter after an optional parameter which is deprecated
PHP Deprecated: Required parameter $coords follows optional parameter $name in HTML_ImageMap.class.php on line 112
when I run weathermap cli script i am getting relative path issues with icons:
/usr/share/centreon/www/modules/centreon-weathermap/src/weathermap --config /usr/share/centreon/www/modules/centreon-weathermap/src/configs/test.conf --output ../output/test.png --htmloutput /usr/share/centreon/www/modules/centreon-weathermap/src/output/test.html
generates the following warning:
WARNING: /usr/share/centreon/www/modules/centreon-weathermap/src/configs/test.conf: ICON 'images/Cloud-Filled.png' does not exist, or is not readable. Check path and permissions. [WMARN38]
this file exists in /usr/share/centreon/www/modules/centreon-weathermap/src/images/Cloud-Filled.png
I tried to use --image-uri
but I think it does not applies for icons
What is the current working directory? (you can also use a full pathname for the icon)
/usr/share/centreon/www/modules/centreon-weathermap/src/
I generate my config files using WriteConfig()
function, I don't know how to set full pathname for icons
When you create the WeatherMapNode, just pass the full pathname to for iconfile instead of "images/blah.png"
if I force WeatherMapNode iconfile it messes up the properties list next time I open it
I had to add this to pre_render() because somehow its reference is lib directory
if(!is_readable($this->iconfile)) {
$this->iconfile = __DIR__ . "/../" . $this->iconfile;
}
Well, at least that is consistent with your LoadPlugins issue, too. I think the working directory is not correct.
Hi there, I came to share my initial release of centreon's module https://github.com/kozfelipe/centreon-weathermap