Giter VIP home page Giter VIP logo

weathermap's People

Contributors

bakerds avatar barbarossatm avatar clinta avatar elbuit avatar fbouynot avatar geordish avatar holmie avatar laf avatar loveskylark avatar murrant avatar pipocanaja avatar rosiak avatar supertylerc avatar thegreatdoc avatar travishegner avatar vhuk avatar vliberio avatar yon2004 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

weathermap's Issues

Can't access Weathermap Editor after upgrade to PHP 8.1

I upgraded my LibreNMS instance to PHP 8.1 relatively recently and have not been able to access the Weathermap editor since. I am getting the following error after enabling debugging.

{
"message": "Attempt to assign property "configline" on null",
"exception": "Error",
"file": "/opt/librenms/html/plugins/Weathermap/lib/Weathermap.class.php",
"line": 1840,
"trace": [
{
"file": "/opt/librenms/html/plugins/Weathermap/editor.php",
"line": 848,
"function": "ReadConfig",
"class": "WeatherMap",
"type": "->"
}
]
}

I have tried the recommended actions in the LibreNMS Community but did not have any success with resolving the error.

Relative URL

Hello,

I'm making a migration of a LibreNMS server to a new server with a new URL.
I found that full URL are used on the maps generated with the plugin editor (eg librenms.example.com/...) for fields infourl and overlibgraph.

I suggest to use relative URL (as it's work ;-)) to avoid the need to edit the conf files when changing the URL.

Regards,
Anael

New Installs are failing

I have been installing fresh instances for clients with the latest weathermap on this repo and a fresh install of librenms. I follow the instructions https://github.com/librenms-plugins/Weathermap/blob/master/INSTALL.md

everything seems great until I started adding a node and Pick from LibreNMS.

Here is the log dump from my error logs. Librenms owns the files and i am not sure whats going on.

[Tue Feb 23 12:24:48.047924 2016] [:error] [pid 8704] [client 10.20.11.39:60134] PHP Notice: Undefined index: install_dir in /opt/librenms/html/plugins/Weathermap/data-pick.php on line 44, referer: http://192.168.1.20/plugins/Weathermap/editor.php?mapname=District-Office.conf&plug= [Tue Feb 23 12:24:48.048180 2016] [:error] [pid 8704] [client 10.20.11.39:60134] PHP Warning: include_once(/includes/defaults.inc.php): failed to open stream: No such file or directory in /opt/librenms/html/plugins/Weathermap/data-pick.php on line 45, referer: http://192.168.1.20/plugins/Weathermap/editor.php?mapname=District-Office.conf&plug= [Tue Feb 23 12:24:48.048309 2016] [:error] [pid 8704] [client 10.20.11.39:60134] PHP Warning: include_once(): Failed opening '/includes/defaults.inc.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /opt/librenms/html/plugins/Weathermap/data-pick.php on line 45, referer: http://192.168.1.20/plugins/Weathermap/editor.php?mapname=District-Office.conf&plug= [Tue Feb 23 12:24:48.048485 2016] [:error] [pid 8704] [client 10.20.11.39:60134] PHP Warning: chdir(): No such file or directory (errno 2) in /opt/librenms/html/plugins/Weathermap/data-pick.php on line 49, referer: http://192.168.1.20/plugins/Weathermap/editor.php?mapname=District-Office.conf&plug= [Tue Feb 23 12:24:48.048648 2016] [:error] [pid 8704] [client 10.20.11.39:60134] PHP Warning: include_once(/includes/definitions.inc.php): failed to open stream: No such file or directory in /opt/librenms/html/plugins/Weathermap/data-pick.php on line 51, referer: http://192.168.1.20/plugins/Weathermap/editor.php?mapname=District-Office.conf&plug= [Tue Feb 23 12:24:48.048677 2016] [:error] [pid 8704] [client 10.20.11.39:60134] PHP Warning: include_once(): Failed opening '/includes/definitions.inc.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /opt/librenms/html/plugins/Weathermap/data-pick.php on line 51, referer: http://192.168.1.20/plugins/Weathermap/editor.php?mapname=District-Office.conf&plug= [Tue Feb 23 12:24:48.048721 2016] [:error] [pid 8704] [client 10.20.11.39:60134] PHP Warning: include_once(/includes/functions.php): failed to open stream: No such file or directory in /opt/librenms/html/plugins/Weathermap/data-pick.php on line 52, referer: http://192.168.1.20/plugins/Weathermap/editor.php?mapname=District-Office.conf&plug= [Tue Feb 23 12:24:48.048745 2016] [:error] [pid 8704] [client 10.20.11.39:60134] PHP Warning: include_once(): Failed opening '/includes/functions.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /opt/librenms/html/plugins/Weathermap/data-pick.php on line 52, referer: http://192.168.1.20/plugins/Weathermap/editor.php?mapname=District-Office.conf&plug= [Tue Feb 23 12:24:48.048788 2016] [:error] [pid 8704] [client 10.20.11.39:60134] PHP Warning: include_once(/html/includes/functions.inc.php): failed to open stream: No such file or directory in /opt/librenms/html/plugins/Weathermap/data-pick.php on line 53, referer: http://192.168.1.20/plugins/Weathermap/editor.php?mapname=District-Office.conf&plug= [Tue Feb 23 12:24:48.048812 2016] [:error] [pid 8704] [client 10.20.11.39:60134] PHP Warning: include_once(): Failed opening '/html/includes/functions.inc.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /opt/librenms/html/plugins/Weathermap/data-pick.php on line 53, referer: http://192.168.1.20/plugins/Weathermap/editor.php?mapname=District-Office.conf&plug= [Tue Feb 23 12:24:48.048886 2016] [:error] [pid 8704] [client 10.20.11.39:60134] PHP Warning: require_once(/html/includes/authenticate.inc.php): failed to open stream: No such file or directory in /opt/librenms/html/plugins/Weathermap/data-pick.php on line 54, referer: http://192.168.1.20/plugins/Weathermap/editor.php?mapname=District-Office.conf&plug= [Tue Feb 23 12:24:48.048911 2016] [:error] [pid 8704] [client 10.20.11.39:60134] PHP Fatal error: require_once(): Failed opening required '/html/includes/authenticate.inc.php' (include_path='.:/usr/share/php:/usr/share/pear') in /opt/librenms/html/plugins/Weathermap/data-pick.php on line 54, referer: http://192.168.1.20/plugins/Weathermap/editor.php?mapname=District-Office.conf&plug=

name.jpg and name.html not getting created

Hi All,
I was trying to integrate weathermap with librenms. The integration works but when I try to create the map from the librenms admin page, I don't see the following files created
map_name.jpg and map_name.html

  1. Checked under Weathermap-NO
  2. Check under weathermap/output-NO
    However, the map_name.conf gets created under Weathermap/configs directory. Please advice.

Weathermap 0.98

Hi,

Have you plan to upgrade to the last Weathermap version (0.98) ?

Regards,
Stéphane

Where is link to weathermap in librenms menu?

Good morning.
I installed weathermap plugin into librenms. Then I activated this plugin, and I can created map.
But I can't see anywhere my created weathermaps? Should I do edit or turn on something?
Or maybe copying / install missing dependencies?

Where should be link to weathermap in libreNMS menu?
Thank you in advance for your response.

Best regards,
Janusz Janik

Case-Sensitivity Causes Git Grief

On platforms that are not case-sensitive (Windows, Mac OS X), cloning this repository causes significant grief. The filesystem (and therefore git) will view Weathermap.php and weathermap.php as the same file, and when cloning, you will get only one of those files. Then you'll see some nonsense about having untracked files, and it's an all-around mess. Here's an example:

 ❯ git status                                                                                                                                                                                                                                                                                                                                                    [14:33:30]
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   weathermap.php

no changes added to commit (use "git add" and/or "git commit -a")

This is from a fresh clone of this repository on OS X. More details on the craziness:

 ❯ git diff | wc -l                                                                                                                                                                                                                                                                                                                                              [14:34:18]
     341
 ❯ wc -l Weathermap.php                                                                                                                                                                                                                                                                                                                                          [14:34:42]
      12 Weathermap.php
 ❯ wc -l weathermap.php                                                                                                                                                                                                                                                                                                                                          [14:34:44]
      12 weathermap.php

The only work-around, for OS X at least, is to create a new partition that is case-sensitive. For Windows, I'm not sure of a potential workaround (if any exists). On Linux, this obviously isn't a problem.

Would it be possible to rename the files such that there is more that is different about them than just the case?

HTML Pages not being created

I've done a fresh install of LibreNMS, and cloned from github. Even setting the permissions for the entire WeatherMap directory to 777 did not output any html pages.

Am I mssing something. I can get to the editor, and my .conf file are saving. Am I missing something? how would I then see the Weathermap?

Print wrong optical power on weathermap

I am trying to print optical RX value on whether map in Librenms but it does not match from an actual value I am using
SET rrd_use_poller_output 1 but not fix the issue

Printed Value on weather map
image

Actual value is
-2.23 dBm but the printed value is 1.6dBm

Screenshot 2022-03-26 105147

Remote RRDCached support in clustered environment?

So I have a web front-end that polls, a second regular cronjob poller, and two servers that run the librenms-poller-service. The last server is a SQL server that runs memcached, rrdcached, and of course the SQL backend. The SQL server is also the NFS host of the RRD files for all 4 pollers.

When I run the map poller regularly, I get a lot of links with 0's reported for traffic in the links. When checked with rrdtool, it is in fact missing data for the 800 second time frame. When I run /opt/librenms/html/plugins/Weathermap/weathermap.php with the additional --chdir /my/rrd/path, I get a lot more values filled in, but many are missing. I tried adding the --daemon ip.of.my.server:42217 and it didnt seem to help, like it can't read anything in rrdcached.

If i change the config on rrdcached to WRITE_TIMEOUT=720 and WRITE_JITTER=360, I'm then able to get 90% of my links populated with traffic on the map. I saw that WeatherMapDataSource_rrd reads back the last 800 seconds of an rrd, so it seemed the only way to get data to come through was to neuter my rrdcached setup.

TL;DR - How do I get Weathermap to accurately read rrd values from rrdcached when Weathermap is on a different server from the rrdcached server?

Shebang missing in map-poller.php

For my installation of librenms (which was a pre-build vm-image) the map-poller.php needs the shebang #!/usr/bin/env php in order to be executed correctly by cron.

php8 deprecationwarnings

Here's a bunch of changes I did to get rid of various warnings.

Not everything is fixed: strftime will need something better. And the $num_points is also a thing...

I also needed fix to #88.

diff --git a/lib/WeatherMap.functions.php b/lib/WeatherMap.functions.php
index 3c62b13..1967ca5 100644
--- a/lib/WeatherMap.functions.php
+++ b/lib/WeatherMap.functions.php
@@ -269,7 +269,7 @@ function myimagecolorallocate($image, $red, $green, $blue)
 	// it's possible that we're being called early - just return straight away, in that case
 	if(!isset($image)) return(-1);
 	
-	$existing=imagecolorexact($image, $red, $green, $blue);
+	$existing=imagecolorexact($image, round($red), round($green), round($blue));
 
 	if ($existing > -1)
 		return $existing;
@@ -1875,7 +1875,7 @@ function wimagefilledrectangle( $image ,$x1, $y1, $x2, $y2, $color )
 	$r = $r/255; $g=$g/255; $b=$b/255; $a=(127-$a)/127;
 
 	metadump("FRECT $x1 $y1 $x2 $y2 $r $g $b $a");
-	return(imagefilledrectangle( $image ,$x1, $y1, $x2, $y2, $color ));
+	return(imagefilledrectangle( $image, round($x1), round($y1), round($x2), round($y2), $color ));
 }
 
 function wimagerectangle( $image ,$x1, $y1, $x2, $y2, $color )
@@ -1887,7 +1887,7 @@ function wimagerectangle( $image ,$x1, $y1, $x2, $y2, $color )
 	$r = $r/255; $g=$g/255; $b=$b/255; $a=(127-$a)/127;
 
 	metadump("RECT $x1 $y1 $x2 $y2 $r $g $b $a");
-	return(imagerectangle( $image ,$x1, $y1, $x2, $y2, $color ));
+	return(imagerectangle( $image, round($x1), round($y1), round($x2), round($y2), $color ));
 }
 
 function wimagepolygon($image, $points, $num_points, $color)
@@ -1907,7 +1907,13 @@ function wimagepolygon($image, $points, $num_points, $color)
 	
 	metadump("POLY $num_points ".$pts." $r $g $b $a");
 
-	return(imagepolygon($image, $points, $num_points, $color));
+	// Removing $num_points creates weird boxes. This needs a better fix.
+	// Likely count($points) is sometimes not equal to $num_points*2
+	//assert(count($points) == ($num_points*2));
+	if (count($points) != ($num_points*2)) {
+		return @imagepolygon($image, $points, $num_points, $color);
+	}
+	return imagepolygon($image, $points, $color);
 }
 
 function wimagefilledpolygon($image, $points, $num_points, $color)
@@ -1927,7 +1933,13 @@ function wimagefilledpolygon($image, $points, $num_points, $color)
 	
 	metadump("FPOLY $num_points ".$pts." $r $g $b $a");
 
-	return(imagefilledpolygon($image, $points, $num_points, $color));
+	// Removing $num_points creates weird boxes. This needs a better fix.
+	// Likely count($points) is sometimes not equal to $num_points*2
+	//assert(count($points) == ($num_points*2));
+	if (count($points) != ($num_points*2)) {
+		return @imagefilledpolygon($image, $points, $num_points, $color);
+	}
+	return imagefilledpolygon($image, $points, $color);
 }
 
 function wimagecreatetruecolor($width, $height)
diff --git a/lib/WeatherMapNode.class.php b/lib/WeatherMapNode.class.php
index 55fa40d..81fb15e 100644
--- a/lib/WeatherMapNode.class.php
+++ b/lib/WeatherMapNode.class.php
@@ -615,7 +615,7 @@ class WeatherMapNode extends WeatherMapItem
 		// Draw the icon, if any
 		if(isset($icon_im))
 		{
-			imagecopy($node_im, $icon_im, $icon_x1, $icon_y1, 0, 0, imagesx($icon_im), imagesy($icon_im));
+			imagecopy($node_im, $icon_im, round($icon_x1), round($icon_y1), 0, 0, imagesx($icon_im), imagesy($icon_im));
 			imagedestroy($icon_im);
 		}
 
@@ -632,7 +632,7 @@ class WeatherMapNode extends WeatherMapItem
 			// if there's an icon, then you can choose to have no background
 			if(! $col->is_none() )
 			{
-			    imagefilledrectangle($node_im, $label_x1, $label_y1, $label_x2, $label_y2, $col->gdallocate($node_im));
+			    imagefilledrectangle($node_im, round($label_x1), round($label_y1), round($label_x2), round($label_y2), $col->gdallocate($node_im));
 			}
 
 			if ($this->selected)
@@ -646,7 +646,7 @@ class WeatherMapNode extends WeatherMapItem
 				$olcol = new Colour($this->labeloutlinecolour);
 				if ($olcol->is_real())
 				{
-					imagerectangle($node_im, $label_x1, $label_y1, $label_x2, $label_y2, $olcol->gdallocate($node_im));
+					imagerectangle($node_im, round($label_x1), round($label_y1), round($label_x2), round($label_y2), $olcol->gdallocate($node_im));
 				}
 			}
 			#}
@@ -716,7 +716,7 @@ class WeatherMapNode extends WeatherMapItem
 		if(isset($this->image))
 		{
 			imagealphablending($im, true);
-			imagecopy ( $im, $this->image, $this->x - $this->centre_x, $this->y - $this->centre_y, 0, 0, imagesx($this->image), imagesy($this->image) );
+			imagecopy ( $im, $this->image, round($this->x - $this->centre_x), round($this->y - $this->centre_y), 0, 0, imagesx($this->image), imagesy($this->image) );
 		}
 
 	}
diff --git a/lib/Weathermap.class.php b/lib/Weathermap.class.php
index f575fd2..4c17948 100644
--- a/lib/Weathermap.class.php
+++ b/lib/Weathermap.class.php
@@ -503,7 +503,7 @@ class WeatherMap extends WeatherMapBase
         }
 
         if (($fontnumber > 0) && ($fontnumber < 6)) {
-            imagestring($image, $fontnumber, $x, $y - imagefontheight($fontnumber), $string, $colour);
+            imagestring($image, $fontnumber, round($x), round($y - imagefontheight($fontnumber)), $string, $colour);
             if ($angle != 0) {
                 wm_warn("Angled text doesn't work with non-FreeType fonts [WMWARN02]\n");
             }
@@ -1609,7 +1609,7 @@ class WeatherMap extends WeatherMapBase
                 $boxy += $this->height;
             }
 
-            $scale_im = imagecreatetruecolor($boxwidth + 1, $boxheight + 1);
+            $scale_im = imagecreatetruecolor(round($boxwidth + 1), round($boxheight + 1));
             $scale_ref = 'gdref_legend_' . $scalename;
 
             // Start with a transparent box, in case the fill or outline colour is 'none'
@@ -1717,12 +1717,12 @@ class WeatherMap extends WeatherMapBase
 
         switch ($which) {
             case "MIN":
-                $stamp = strftime($this->minstamptext, $this->min_data_time);
+                $stamp = @strftime($this->minstamptext, $this->min_data_time);
                 $pos_x = $this->mintimex;
                 $pos_y = $this->mintimey;
                 break;
             case "MAX":
-                $stamp = strftime($this->maxstamptext, $this->max_data_time);
+                $stamp = @strftime($this->maxstamptext, $this->max_data_time);
                 $pos_x = $this->maxtimex;
                 $pos_y = $this->maxtimey;
                 break;
@@ -3284,7 +3284,7 @@ class WeatherMap extends WeatherMapBase
         } else {
             $maptime = time();
         }
-        $this->datestamp = strftime($this->stamptext, $maptime);
+        $this->datestamp = @strftime($this->stamptext, $maptime);
 
         // do the basic prep work
         if ($this->background != '') {

Plugin Fails Looking for includes/init.php

After installing and activating plugin, clicking on the link for the editor results in a broken page and the following in /opt/librenms/error_log

PHP Fatal error: require(): Failed opening required '/opt/librenms/includes/init.php' (include_path='.:/usr/share/php') in /opt/librenms/html/plugins/Weathermap/editor.php on line 50

The init.php file does not exist in the librenms install.

Failure with PHP 8.1

After updating to PHP 8.1 & Weathermap 697ac3c, Weathermap seems to still be incompatible.

From the logs:

[2022-09-06T23:37:04.865562-05:00] production.ERROR: call_user_func(): Argument #1 ($callback) must be a valid callback, non-static method LibreNMS\Plugins\Weathermapper::menu() cannot be called statically (View: /opt/librenms/resources/views/layouts/librenmsv1.blade.php) (View: /opt/librenms/resources/views/layouts/librenmsv1.blade.php) {"userId":2,"exception":"[object] (Illuminate\\View\\ViewException(code: 0): call_user_func(): Argument #1 ($callback) must be a valid callback, non-static method LibreNMS\\Plugins\\Weathermapper::menu() cannot be called statically (View: /opt/librenms/resources/views/layouts/librenmsv1.blade.php) (View: /opt/librenms/resources/views/layouts/librenmsv1.blade.php) at /opt/librenms/LibreNMS/Plugins.php:189) [previous exception] [object] (Illuminate\\View\\ViewException(code: 0): call_user_func(): Argument #1 ($callback) must be a valid callback, non-static method LibreNMS\\Plugins\\Weathermapper::menu() cannot be called statically (View: /opt/librenms/resources/views/layouts/librenmsv1.blade.php) at /opt/librenms/LibreNMS/Plugins.php:189) [previous exception] [object] (TypeError(code: 0): call_user_func(): Argument #1 ($callback) must be a valid callback, non-static method LibreNMS\\Plugins\\Weathermapper::menu() cannot be called statically at /opt/librenms/LibreNMS/Plugins.php:189)"}

Current setup

`librenms@nms01:~> ./validate.php

Component Version
LibreNMS 22.8.0
DB Schema 2022_07_03_1947_add_app_data (244)
PHP 8.1.10
Python 3.6.15
Database MariaDB 10.6.8-MariaDB
RRDTool 1.7.0
SNMP 5.7.3
====================================

[OK] Composer Version: 2.4.1
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database Schema is current
[OK] SQL Server meets minimum requirements
[OK] lower_case_table_names is enabled
[OK] MySQL engine is optimal
[OK]
[OK] Database schema correct
[OK] MySQl and PHP time match
[OK] Active pollers found
[OK] Dispatcher Service not detected
[OK] Locks are functional
[OK] Python poller wrapper is polling
[WARN] Using database for locking, you should set CACHE_DRIVER=redis
[OK] rrd_dir is writable
[OK] rrdtool version ok`

Error When Update php8.1

hello to all a few days ago I updated the php version from 7.4 to 8.1 and when I install the Weathermaps plugin this error is skipped,
ksort(): Argument #1 ($array) must be of type array, null given

Someone can help me ?

No data on graphs when RRDCached is enabled

Hello

I have an issue when RRDCached is enabled.
If enabled there is no data on graphs or graphs are partially filled.

Here is why.
By default path in TARGET is something like this (configs/*.conf):

TARGET ./10.0.0.1/port-id42.rrd:INOCTETS:OUTOCTETS

When rrdtool fetch command is executed, RRDCached returns this:

flush ./10.0.0.1/port-id42.rrd
Nothing to flush: /opt/librenms/rrd/./10.0.0.1/port-id42.rrd.

This means that data from cache is not written to disk.
So data is outside time window, no recent values.

When I removed ./ from all TARGET then Weathermap works as expected (data shown):

flush 110.0.0.1/port-id42.rrd
0 Successfully flushed /opt/librenms/rrd/10.0.0.1/port-id42.rrd.

I think you should change this line.
Add exception if RRDCached is enabled.

My RRDCached configuration is from docs page.

Navigation Bar Menu

I'm a subscriber of the Observium platform, and am looking at moving over to LibreNMS. One thing I like is that the Weathermap plugin for Observium has an entry in the navbar along the top. I've installed the weathermap plugin in my LibreNMS instance, but was wondering if there was something similar to allow quick access to my maps.

executing map-poller.php from UI

Hi!
I want to make custom link to file map-poller.php (to refresh map every time I want, not even from cron).
So, i added this link, but during execution, I get error

#!/usr/bin/env php ERROR: map-poller.php should ONLY be run as a CGI script!

I'm using nginx with php-fpm. How can i execute this file from interface?

Feature Request: Label color change depending on node UP/DOWN status

Hello!
I don't know if anyone is actively maintaining this plugin, but I have (what I believe is) a small feature request.

It would be cool having the labels changing color depending on the node being up or down on in LibreNMS, similar to how it looks in Mikrotik The Dude.

I believe it is the LABELBGCOLOR option mentioned in the Weathermap's documentation (https://network-weathermap.com/manual/0.97b/pages/config-reference.html#NODE_COLORS) which needs to be intergrated with the LibreNMS macros.device_up/down macro.

IPv6 Source not possible

When setting a data source for a port, if the device hostname/ip is an IPv6, the html file will show the graph but not the values on the links (they show 0 and down).

This way of doing sources with IP's instead of hostnames work in IPv4.

Does not work with rrdcached

rrdcached requires relative paths from the perspective of $config['rrd_dir']. Weathermap attempts to use relative paths from the perspective of /opt/librenms/html/plugins/Weathermap.

rrdcached integration don't work

poller-map.php fails to create maps don't have --base-href and also lib/datasources/WeatherMapDataSource_rrd.php cant read rrds.

Edit config is available for non admin librenms user

I noticed today that when logged in as a non-admin user in librenms, the edit config HREF is available on the weathermap landing page. It appears to be fully functional and I can load the map editor as an unprivileged user.

Q: How to display maps inside LibreNMS?

Hi,

I´ve setup weathermap and so far the maps are created. But how can I display the maps inside librenms-gui? Right now I have to access the maps like: https:///plugins/Weathermap/map.html?
Also the hover images doesn´t display. Thank you for your support.

LibreNMS with php8.1 crash at Weathermap installation

Hello,

It is the same issue than #76 but it was closed without solution given by the user.
I'm using CentOS Stream 8 with php8.1.5 from remi repo, nginx 1.14.1, MariaDB 10.3.28, Laravel 8.80.0, RRDTool 1.7.0, and LibreNMS 22.4.0-18-g70bae6605 with 2022_04_08_085504_isis_adjacencies_table_add_index (236) database schema.
If I install weathermap with LibreNMS documentation, LibreNMS fall in error state with error 500 and ksort(): Argument #1 ($array) must be of type array, null given log.
At the moment I delete Weathermap folder, LibreNMS is working again.
@cabello123 says to solved the issue by "adding missing arrays to the function".

Does someone know where does it come from?

No input b/w for aggregate graph: first input line skipped erroneously

I'm trying to use this to give a "max traffic of last 24 hours" map:

SET rrd_start now-1day
SET rrd_period 86400
SET rrd_aggregate_function MAXIMUM

At least with rrdtool 1.5.5 this is only showing traffic in one direction, the other is 0. This is because WeatherMapDataSource_rrd.php is skipping the first (supposedly blank) line. Removing the skip fixes it for me and doesn't seem to cause additional problems (it's checking for IN/OUT strings anyway and skipping other lines).

--- lib/datasources/WeatherMapDataSource_rrd.php.orig   Wed Mar 30 11:26:34 2016
+++ lib/datasources/WeatherMapDataSource_rrd.php    Wed Mar 30 11:26:42 2016
@@ -281,7 +281,6 @@ class WeatherMapDataSource_rrd extends WeatherMapDataS

        if (isset($pipe))
        {
-           fgets($pipe, 4096); // skip the blank line
            $buffer='';
            $data_ok = FALSE;

index.php not found

Hi there

We've noticed that the index.php (https://github.com/librenms-plugins/Weathermap/blob/master/index.php) references "../index.php". But looking at our plugins folder (and the one in upstream https://github.com/librenms/librenms/tree/master/html/plugins) There isn't any "index.php".

If we want to open a config (Overview -> Plugins -> Weathermap configname.conf) It then throws en error 404 trying to access said index.php.

What are we doing wrong?

libreNMS version: 1.64.1-26-g300645388
Weathermap version: 0.97c

PHP Depricated

Hi! During refreshing the maps (map-poller.php), i get PHP Warnings like this:

PHP Deprecated:  The each() function is deprecated. This message will be suppressed on further calls in /usr/share/pear/Console/Getopt.php on line 136
PHP Deprecated:  Non-static method PEAR::isError() should not be called statically in /usr/share/pear/Console/Getopt.php on line 154
PHP Deprecated:  Non-static method PEAR::isError() should not be called statically in /usr/share/pear/Console/Getopt.php on line 154
PHP Deprecated:  Non-static method PEAR::isError() should not be called statically in /usr/share/pear/Console/Getopt.php on line 154
PHP Deprecated:  Non-static method PEAR::isError() should not be called statically in /usr/share/pear/Console/Getopt.php on line 154
PHP Deprecated:  Non-static method PEAR::isError() should not be called statically in /opt/librenms/html/plugins/Weathermap/weathermap.php on line 64
PHP Deprecated:  Non-static method PEAR::isError() should not be called statically in /usr/share/pear/Console/Getopt.php on line 109
PHP Deprecated:  The each() function is deprecated. This message will be suppressed on further calls in /usr/share/pear/Console/Getopt.php on line 136
PHP Deprecated:  Non-static method PEAR::isError() should not be called statically in /usr/share/pear/Console/Getopt.php on line 154
PHP Deprecated:  Non-static method PEAR::isError() should not be called statically in /usr/share/pear/Console/Getopt.php on line 154
PHP Deprecated:  Non-static method PEAR::isError() should not be called statically in /usr/share/pear/Console/Getopt.php on line 154
PHP Deprecated:  Non-static method PEAR::isError() should not be called statically in /usr/share/pear/Console/Getopt.php on line 154
PHP Deprecated:  Non-static method PEAR::isError() should not be called statically in /opt/librenms/html/plugins/Weathermap/weathermap.php on line 64

Is it to you?

HTTP ERROR 500 / Weathermap Editor

When clicking "Edit" receive HTTP 500

VALIDATE

Component Version
LibreNMS d67d62eacb880163768588fb0c1b879cbcfa77d5
DB Schema 187
PHP 7.0.18
MySQL 5.5.52-MariaDB
RRDTool 1.4.8
SNMP NET-SNMP 5.7.2
==========================================================

Error Log
2017/04/27 23:03:33 [error] 12180#0: *1377 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Call to undefined function dbDelete() in /opt/librenms/html/includes/authenticate.inc.php:24 Stack trace: #0 /opt/librenms/html/plugins/Weathermap/editor.php(54): require_once() #1 {main} thrown in /opt/librenms/html/includes/authenticate.inc.php on line 24" while reading response header from upstream, client:

Unable to access editor page

I use Weathermap as a Librenms plugin and haven't lauch it for a while (about 1 year ago). But it was working. I recently decided to get back into it but i'm unable to access the editor page.
As soon as I click on the link, I'm redirected to Librenms home page.
I checked all the installation process and I've even removed it and clone it again with the same result. My Apache directives the one recommended in Librenms install instructions and the install validate. I can't figure out what I'm missing.
Thank U for any help.

Weathermap is not building the png and html files needed in output folder

I have done a fresh install of LibreNMS 22.8.0 in Alma linux 8.6 and working fine. Then i am trying to include Weathermap with LibreNMS following docs (Weathermap - LibreNMS Docs).
I have created Weathermap but when I click on plugins > weathermaps > *.conf I get a 404 error from the index. I have also checked and found didn’t generated .html file in “/opt/librenms/html/plugins/Weathermap/output/”.

I have also checked by latest version ubuntu and also found same issue.

Is anyone else having this problem with the weathermap plugin?. Plese help me.

More problem details here https://community.librenms.org/t/html-pages-not-being-automated-created-in-output-folder-opt-librenms-html-plugins-weathermap-output/19480

No links are drawn, only values are visible

When adding nodes and links, only the values of the links are visible, graphs are working, nodes are ok.
In the debug I see "skipping 4 of 4 points".

##DEBUG##

DEBUG: [[email protected]:3367] /opt/librenms/html/plugins/Weathermap/configs/dc-interconnects-test.conf: Drawing layer 0
DEBUG: [[email protected]:3367] /opt/librenms/html/plugins/Weathermap/configs/dc-interconnects-test.conf: Drawing layer 300
DEBUG: [[email protected]:3408] /opt/librenms/html/plugins/Weathermap/configs/dc-interconnects-test.conf: Drawing LINK 7-8
DEBUG: [[email protected]:1411] /opt/librenms/html/plugins/Weathermap/configs/dc-interconnects-test.conf: Numeric Offset found
DEBUG: [[email protected]:1411] /opt/librenms/html/plugins/Weathermap/configs/dc-interconnects-test.conf: Numeric Offset found
DEBUG: [[email protected]:1376] /opt/librenms/html/plugins/Weathermap/configs/dc-interconnects-test.conf: Skipped 4 points of 4
DEBUG: [[email protected]:1171] /opt/librenms/html/plugins/Weathermap/configs/dc-interconnects-test.conf: Adding Poly imagemap for LINK:L106:1
DEBUG: [[email protected]:1376] /opt/librenms/html/plugins/Weathermap/configs/dc-interconnects-test.conf: Skipped 4 points of 4
DEBUG: [[email protected]:1171] /opt/librenms/html/plugins/Weathermap/configs/dc-interconnects-test.conf: Adding Poly imagemap for LINK:L106:0

And this as basic config:

#########CONFIG

Automatically generated by php-weathermap v0.98b

KEYPOS DEFAULT -1 -1 Traffic Load
KEYTEXTCOLOR 0 0 0
KEYOUTLINECOLOR 0 0 0
KEYBGCOLOR 255 255 255
BGCOLOR 255 255 255
TITLECOLOR 0 0 0
TIMECOLOR 0 0 0
SCALE DEFAULT 0 0 192 192 192
SCALE DEFAULT 0 1 255 255 255
SCALE DEFAULT 1 10 140 0 255
SCALE DEFAULT 10 25 32 32 255
SCALE DEFAULT 25 40 0 192 255
SCALE DEFAULT 40 55 0 240 0
SCALE DEFAULT 55 70 240 240 0
SCALE DEFAULT 70 85 255 192 0
SCALE DEFAULT 85 100 255 0 0

SET key_hidezero_DEFAULT 1

End of global section

TEMPLATE-only NODEs:

NODE DEFAULT
MAXVALUE 100

TEMPLATE-only LINKs:

LINK DEFAULT
BANDWIDTH 100M

regular NODEs:

NODE 7
LABEL jp03.man.asxyz.net
INFOURL /device/device=7/
OVERLIBGRAPH /graph.php?height=100&width=512&device=7&type=device_bits&legend=no
POSITION 167 136

NODE 8
LABEL jp04.man.asxyz.net
INFOURL /device/device=8/
OVERLIBGRAPH /graph.php?height=100&width=512&device=8&type=device_bits&legend=no
POSITION 800 128

regular LINKs:

LINK 7-8
WIDTH 10
INFOURL /graphs/type=port_bits/id=7238/
OVERLIBGRAPH /graph.php?height=100&width=512&id=7238&type=port_bits&legend=no
TARGET ./jp03.mon.as62167.net/port-id7238.rrd:INOCTETS:OUTOCTETS
NODES 7:72:-4 8:-72:4
SET _tidied 1

That's All Folks!

Link Utilisation does not work for one particular link

Hello,

We run the weather map plugin for librenms and it works great, except for one link always shows 0% despite having traffic on it.

We can use and monitor other links from this device just fine, and we've tried recreating the link in the weather map. I also tried a rediscover of the entire device in LibreNMS but that did not help either.

Any suggestions on where I could look?

Thank you!

missing "/" between server url and graph, device overlib path

I just installed librenms on 16.04 with nginx following the instructions on
http://docs.librenms.org/Installation/Installation-Ubuntu-1604-Nginx/.

After cloning this repo and following its instructions, I created a map and everything works until I try to mouse over the nodes or links. The url that it is trying to access which is the url also shown in the .conf file is missing a / between the host and the path. Example:

NODE 1
        LABEL localhost
        INFOURL http://librenms.home.localdevice/device=1/
        OVERLIBGRAPH http://librenms.home.localgraph.php?height=100&width=512&device=1&type=device_bits&legend=no
        POSITION 336 289

Should be

NODE 1
        LABEL localhost
        INFOURL http://librenms.home.local/device/device=1/
        OVERLIBGRAPH http://librenms.home.local/graph.php?height=100&width=512&device=1&type=device_bits&legend=no
        POSITION 336 289

Manually fixing it solves the issue. Haven't been able to figure out yet what is causing it. Never had this problem using it with cacti for a decade or so. Not sure if nginx is stripping too much using the given virtual server template maybe (http://docs.librenms.org/Installation/Installation-Ubuntu-1604-Nginx/)?

Everything else works great ;)

Newbie question on map refreshing

I'm new to weathermap in Librenms so please be gentle. I have build a map and it is working pretty well, however, the links I created between network devices often show no traffic even though hovering over them shows significant traffic flow. I am assuming that I have a configure item that needs to be updated by I haven't been able to find it. Can anyone point me in the right direction?

isNotEmpty on null error

Hello,

When clicking on "Pick from LibreNMS" in link properties, I get the properties window, but with an error. The following is logged:

production.ERROR: Call to a member function isNotEmpty() on null {"userId":5,"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Call to a member function isNotEmpty() on null at /opt/librenms/html/plugins/Weathermap/data-pick.php:329)
[stacktrace]
#0 {main}
"}

weathermap 0.98 version

hello ,

i want to know if is it possibleto update the weathermap from 0.97c to 0.98 in librenms

and i yes how please

Problems with device link

The map link produced on the weathermap plugin page looks wrong:
output/backbone.png.html

Looks like the $overlib['basename'] is the wrong one to use on line 27 in Weathermap/Weathermap.inc.php

Since that produces output/backbone.png

Plugin should display maps

This plugin should display the maps it generates on the plugin page (or provide navigation to reach the maps).

Integrate weathermap with rrdcached librenms installations

To allow weathermap use rrdcached only two lines at:
/html/plugins/Weathermap/lib/datasources/WeatherMapDataSource_rrd.php

But the interesting thing is that plugin detects
$config['rrdcached'] from config.php

--- a/WeatherMapDataSource_rrd.php
+++ b/html/plugins/Weathermap/lib/datasources/WeatherMapDataSource_rrd.php
@@ -337,6 +337,8 @@ class WeatherMapDataSource_rrd extends WeatherMapDataSource {
#### $command = '"'.$map->rrdtool . '" fetch "'.$rrdfile.'" AVERAGE --start '.$start.' --end '.$end;
#$command=$map->rrdtool . " fetch $rrdfile $cf --start $start --end $end $extra_options";
$args[] = "fetch";

  •           $args[] = "--daemon";
    
  •           $args[] = "unix:/var/run/rrdcached.sock";
            $args[] = $rrdfile;
            $args[] = $cf;
            $args[] = "--start";
    

Nothing works when set to auto populate :-/

WeatherMapper
Automatically generate weathermaps from a LibreNMS database using WeatherMapper Link

I have done this several times now to the letter - and nothing generates. So I added a few devices/links - and when I try to load the page:
http://usmlbnetmon.percepta.com/plugins/Weathermap/output/mymap.html

My regular dashboard pops up. I am betting my bottom dollar that I am missing something highly obvious - but thought I would throw this up here anyway.

PHP Fatal Error - failed opening required '/opt/librenms/includes/init.php'

PHP Fatal error: require(): Failed opening required '/opt/librenms/includes/init.php' (include_path='.:/usr/share/php:/usr/share/pear') in /opt/librenms/html/plugins/Weathermap/editor.php on line 50, referer: http://[librenmsIP]/plugin/p=Weathermap

fresh install, no "init.php" file anywhere on box... do i need to manually create this file or should it be included w/ the installation of Weathermap?

Standalone support without LibreNMS

Discovered this fork after realizing the 'classic' php weathermap does not work with php 8.x and above. This appears to be forked as related to the LibreNMS project.

Is it possible to run this standalone WITHOUT LibreNMS? Ie like the traditional non plug in version.

This would imply that there is no 'picker' but only hand editing of config files, as is with the original version, which is fine.

"SET rrd_cf" is ignored

When adding option "SET rrd_cf MAX" (or any other rrdtool CF), it is disregarded.

./lib/datasources/WeatherMapDataSource_rrd.php:

545                 $cfname = intval($map->get_hint('rrd_cf'));
546                 if($cfname=='') $cfname='AVERAGE';

Given that the value of rrd_cf will be a text string and not an integer, this check on line 545 is problematic.

Simply changing it to:
$cfname = $map->get_hint('rrd_cf');
resolves the problems.

Sorry, I can't fork / clone / edit / commit / push and submit a PR from here, but thought I should report this anyway given the simple nature of the fix.

rrdcached local socket issue

Weathermap seemed to not be reading RRDs properly when using rrdached on a socket such as unix:/run/rrdcached.sock

Stepping through the cmd as built in map-poller.php got me:

php ./weathermap.php --config /opt/librenms/html/plugins/Weathermap/configs/myconf.conf --base-href /plugins/Weathermap/ --daemon unix:/var/run/rrdcached.sock --chdir '' --debug

This threw:

DEBUG: [wmrrd_read_from_real_rrdtool@WeatherMapDataSource_rrd.php:245] /opt/librenms/html/plugins/Weathermap/configs/myconf.conf: RRD ReadData: Running: /usr/bin/rrdtool fetch myswitch/port-id5044.rrd AVERAGE --start now-800 --end now --daemon unix:/var/run/rrdcached.sock 
ERROR: realpath(myswitch/port-id5044.rrd): No such file or directory

So it's looking for the rrd file on an incomplete path. Running:

 /usr/bin/rrdtool fetch /opt/librenms/rrd/myswitch/port-id5044.rrd AVERAGE --start now-800 --end now --daemon unix:/var/run/rrdcached.sock 

Confirmed it worked, so for my issue to be fixed I had to modify map-poller.php line 71 to read:

if (!empty($config['rrdcached']))
{
    $cmd = $cmd." --daemon ".$config['rrdcached']." --chdir ".$config['rrd_dir'];
}

I then had to comment out two instances of the following in lib/datasources/WeatherMapDataSource_rrd.php:

// rrdcached Support: strip "./" from Data Source
if ($map->daemon)
{
    $rrdfile = trim($rrdfile,"^./"); 
}

Reading through previous pulls / commits I see that plenty of logic has been added recently by @LoveSkylark for their use case which I think uses rrdcached exposed via an ip:port as oppsed to a socket, so I would imagine some extra logic needs to be written around to account for when rrdcached references a socket......unless someone wnats to tell me I'm way off the mark!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.