Weathermap - Cacti 1.x compatible release available for testing

Support questions about the Network Weather Map plugin

Moderators: Developers, Moderators

leonardo0014
Posts: 3
Joined: Sun Jan 19, 2020 12:21 pm
Location: Bavaria, Germany

Re: Weathermap - Cacti 1.x compatible release available for testing

Post by leonardo0014 »

Howie wrote: Mon Jan 20, 2020 2:50 pm Cacti helpfully shows messages in reverse order. The two above it in your screenshot are after it, if you look at the times. i.e. the map was actually written. You can confirm by looking at the file dates in the output/ folder.

What issue are you actually seeing?
You are right, I was just too stupid to read correctly. There are no errors in the map, it is shown correctly. :o
Thanks for the hint.
It's a shame that I can't just limit the output to the result line (summary). With the other log option (“quiet mode”), it does not output anything.
Last edited by leonardo0014 on Tue Jan 21, 2020 6:10 pm, edited 1 time in total.
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Weathermap - Cacti 1.x compatible release available for testing

Post by Howie »

In the weathermap settings (misc tab) there is a “quiet mode” option that removes a few more log messages. Does that help?
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
fatihylmz06
Posts: 4
Joined: Tue Nov 12, 2019 3:11 pm

Re: Weathermap - Cacti 1.x compatible release available for testing

Post by fatihylmz06 »

Thank you so much for saving me from a lot of trouble. :D
nicolatron
Posts: 40
Joined: Mon Jan 28, 2008 4:11 am

Re: Weathermap - Cacti 1.x compatible release available for testing

Post by nicolatron »

Hello,

I'm giving it a try. My database had weathermap stuff already on it, as it's the same i used to test Howie's latest weathermap dev version like a year ago.
Once i installed the plugin it was not working right, so i uninstalled plugin and manually deleted all weathermap* tables and all weathermap* entries in settings table, afterwards y reinstalled plugin but it did not create weathermap tables (_auth, _data, _groups, _maps,_settings), it did create the entires in settings table though.
So i manually executed the table creation statements contained on setup.php, and installed the plugin again.
Now it's failing with this error:

2020/01/29 09:00:19 - CMDPHP ERRORS DETECTED - DISABLING PLUGIN 'weathermap'
2020/01/29 09:00:19 - CMDPHP PHP ERROR Backtrace: (CactiShutdownHandler())
2020/01/29 09:00:19 - ERROR PHP ERROR in Plugin 'weathermap': Uncaught PDOException: SQLSTATE[HY000]: General error: 1364 Field 'last_time' doesn't have a default value in /opt/cacti/plugins/weathermap/lib/datasources/WeatherMapDataSource_rrd.php:143 Stack trace: #0 /opt/cacti/plugins/weathermap/lib/datasources/WeatherMapDataSource_rrd.php(143): PDOStatement->execute(Array) #1 /opt/cacti/plugins/weathermap/lib/datasources/WeatherMapDataSource_rrd.php(596): WeatherMapDataSource_rrd->wmrrd_read_from_poller_output('/opt/cacti/rra/...', 'AVERAGE', 'now-800', 'now', Array, Array, Object(WeatherMap), 0, Object(WeatherMapLink)) #2 /opt/cacti/plugins/weathermap/lib/Weathermap.class.php(955): WeatherMapDataSource_rrd->ReadData('/opt/cacti/rra/...', Object(WeatherMap), Object(WeatherMapLink)) #3 /opt/cacti/plugins/weathermap/lib/poller-common.php(195): WeatherMap->ReadData() #4 /opt/cacti/plugins/weathermap/setup.php(778): weathermap_run_maps('/opt/cacti/plug...') #5 /opt/cacti/lib/plugins.php(177): weathermap_poller_bottom(Array) #6 /opt/cacti/lib/plugins.php(74): api_plugin_run in file: /opt/cacti/plugins/weathermap/lib/datasources/WeatherMapDataSource_rrd.php on line: 143

The SQL statements I manually executed (changed engine from MyISAM to InnoDB, maybe that's a problem?.

CREATE TABLE weathermap_maps (
id int(11) NOT NULL auto_increment,
sortorder int(11) NOT NULL default 0,
group_id int(11) NOT NULL default 1,
active set('on','off') NOT NULL default 'on',
configfile text NOT NULL,
imagefile text NOT NULL,
htmlfile text NOT NULL,
titlecache text NOT NULL,
filehash varchar (40) NOT NULL default '',
warncount int(11) NOT NULL default 0,
config text NOT NULL,
thumb_width int(11) NOT NULL default 0,
thumb_height int(11) NOT NULL default 0,
schedule varchar(32) NOT NULL default '*',
archiving set('on','off') NOT NULL default 'off',
PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE TABLE weathermap_groups (
`id` INT(11) NOT NULL auto_increment,
`name` VARCHAR( 128 ) NOT NULL default '',
`sortorder` INT(11) NOT NULL default 0,
PRIMARY KEY (id)
) ENGINE=InnoDB;
INSERT INTO weathermap_groups (id,name,sortorder) VALUES (1,'Weathermaps',1);
CREATE TABLE IF NOT EXISTS weathermap_data (
id int(11) NOT NULL auto_increment,
rrdfile varchar(255) NOT NULL,
data_source_name varchar(19) NOT NULL,
last_time int(11) NOT NULL,
last_value varchar(255) NOT NULL,
last_calc varchar(255) NOT NULL,
sequence int(11) NOT NULL,
local_data_id int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (id), KEY rrdfile (rrdfile),
KEY local_data_id (local_data_id),
KEY data_source_name (data_source_name)
)ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS weathermap_data (id int(11) NOT NULL auto_increment,
rrdfile varchar(255) NOT NULL,
data_source_name varchar(19) NOT NULL,
last_time int(11) NOT NULL,
last_value varchar(255) NOT NULL,
last_calc varchar(255) NOT NULL,
sequence int(11) NOT NULL,
local_data_id int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (id),
KEY rrdfile (rrdfile),
KEY local_data_id (local_data_id),
KEY data_source_name (data_source_name) ) ENGINE=InnoDB;
CREATE TABLE weathermap_settings (
id int(11) NOT NULL auto_increment,
mapid int(11) NOT NULL default '0',
groupid int(11) NOT NULL default '0',
optname varchar(128) NOT NULL default '',
optvalue varchar(128) NOT NULL default '',
PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE TABLE weathermap_auth (
userid mediumint(9) NOT NULL default '0',
mapid int(11) NOT NULL default '0'
) ENGINE=InnoDB;

As good as this is, It would be even better if changes to make the plugin work could be merged with latest network-weathermap code :)

Thank you! :)

Setup
Debian 10
cacti 1.2.8
weathermap v0.98a
PHP 7.3.11-1~deb10u1
10.3.18-MariaDB
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Weathermap - Cacti 1.x compatible release available for testing

Post by phalek »

1) It looks like your database user does not have the rights to create tables. Can you check what access rights that user has ?
2) 'last_time' doesn't have a default value -> See here https://github.com/thurban/plugin_weathermap/issues/1
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
nicolatron
Posts: 40
Joined: Mon Jan 28, 2008 4:11 am

Re: Weathermap - Cacti 1.x compatible release available for testing

Post by nicolatron »

I used the grant all on cacti.*... Just in case i executed GRANT CREATE, and flushed privileges. And login with cacti user and host (same as in include/config.php I can create tables...
MariaDB [cacti]> create table test (id varchar(19));
Query OK, 0 rows affected (0.006 sec)

MariaDB [cacti]> drop table test;
Query OK, 0 rows affected (0.007 sec)

After checking this, I unistalled plugin, manually deleted all weathermap* tables and setting entries, installed plugin again and tables are not created, let's see if i can enable some debug somewhere, thanks.
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Weathermap - Cacti 1.x compatible release available for testing

Post by Howie »

You might also need to delete the "weathermap_version" row from the settings table. That's how weathermap decides if it needs to do anything.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
nicolatron
Posts: 40
Joined: Mon Jan 28, 2008 4:11 am

Re: Weathermap - Cacti 1.x compatible release available for testing

Post by nicolatron »

phalek wrote: Wed Jan 29, 2020 4:25 am 1) It looks like your database user does not have the rights to create tables. Can you check what access rights that user has ?
2) 'last_time' doesn't have a default value -> See here https://github.com/thurban/plugin_weathermap/issues/1
Applying the fixes commented in that link solved the problem for me. Once again not reading carefuly made me lost some time.
Thanks! :)
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Weathermap - Cacti 1.x compatible release available for testing

Post by phalek »

Ok. Going to add these small changes to the code during the next days, so new users trying this out don't have this issue anymore
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
nicolatron
Posts: 40
Joined: Mon Jan 28, 2008 4:11 am

Re: Weathermap - Cacti 1.x compatible release available for testing

Post by nicolatron »

Woohooo I'm happy, thanks again :D
weathermap_cacti_plugin.png
weathermap_cacti_plugin.png (425.13 KiB) Viewed 7168 times
2020/01/30 12:31:00 - WEATHERMAP STATS: Weathermap 0.98a run complete - Thu, 30 Jan 20 12:31:00 +0100: 19 maps were run in 10 seconds with 27 warnings.
nicolatron
Posts: 40
Joined: Mon Jan 28, 2008 4:11 am

Re: Weathermap - Cacti 1.x compatible release available for testing

Post by nicolatron »

For a user to be able to see weathermap tab, he needs to have permission set to (Weathermap:View) at a user level, permission set in the group the user belongs to doesn't seem to be checked.
For example nFlow plugin, does inherit permissions from the group the user belongs to and show the appropiate tab (even if the user don't have that permission).
Just a minor issue to be honest.
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Weathermap - Cacti 1.x compatible release available for testing

Post by phalek »

Thanks. I've created an issue on github for it ( https://github.com/thurban/plugin_weathermap/issues/3 )
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
nicolatron
Posts: 40
Joined: Mon Jan 28, 2008 4:11 am

Re: Weathermap - Cacti 1.x compatible release available for testing

Post by nicolatron »

Hello,
I'm not sure this is a weathermap plugin problem, but it seems the only place where i need this feature, so i'll check here first.
I can't horizontally scroll big maps, there is no scroll bars, resizing with control+wheel works ok, and I can visualize full map, vertical scrolling also works (mouse wheel).
I can horizontally scroll other web pages (like 4k jpg) with shift + mouse wheel, also tested with scrollanywhere plugin for firefox, same result.
If i get for instance manage devices, and change size (with ctrl+wheel) to the point where it doesn't fit screen i can't horizontally scroll neither.
Tested with firefox 68 and chrome (Versión 79.0.3945.130 (Build oficial) (64 bits)) in linux (both wayland and xwindows) and windows 7.
Test with 2 monitors resolutions 1680x1050 and 1600x900.
Cacti 1.2.8
Thanks
nicolatron
Posts: 40
Joined: Mon Jan 28, 2008 4:11 am

Re: Weathermap - Cacti 1.x compatible release available for testing

Post by nicolatron »

Hi there.

I'm testing cacti 1.2.9, most things seem to work just fine, but overlibgraph do not work.
On the browser debug console, i can see several errors like:

Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' 'unsafe-inline'".

at registerCommands (overlib.js:1310)
at overlib.js:32

And a lot of messages like:

Uncaught ReferenceError: DELAY is not defined
at HTMLAreaElement.onmouseover (weathermap-cacti-plugin.php?action=viewmap&id=81f5004d761b0766b31c:190)

Greetings
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Weathermap - Cacti 1.x compatible release available for testing

Post by phalek »

Can you add the following code

Code: Select all

header("Content-Security-Policy:script-src 'self' 'unsafe-inline' 'unsafe-eval';")
to the very top of the weathermap-cacti-plugin.php right after the <?php statement ?

It's not best practive and makes it unsafe, but it's an issue with the external overlib javascript library which makes extensive use of the eval function and needs a rewrite ...
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests