Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


PHP Network Weathermap 0.8 (now 0.9)
Goto page Previous  1, 2, 3 ... 21, 22, 23, 24, 25  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Plugin: (Network Weather Map)
Author Message
Howie
Cacti Guru User


Joined: 16 Sep 2004
Posts: 2247
Location: United Kingdom

PostPosted: Fri Jun 23, 2006 3:01 pm    Post subject: Reply with quote

_JPL_ wrote:
I don't see maps at all after the poller runs. I chmod 777 the output folder to make sure there were sufficient perms (will undo once I get it working). I have the conf file in the configs folder.

In the poller at the very end I see the error:
PHP Fatal error: Cannot redeclare class html_imagemap_area_polygon in /usr/share/pear/HTML_ImageMap.class.php on line 140



Which version of PHP, and which platform is this? I haven't seen this one before...

[please don't crosspost the same query...]
Back to top
tadavis



Joined: 06 Apr 2006
Posts: 16

PostPosted: Tue Jun 27, 2006 5:05 pm    Post subject: Using this with no authentication.. Reply with quote

The webserver where I run cacti on already has a user account/password setup in front of it, so having to login in twice to get to Cacti was being a PITA.

Turning off authentication in Cacti (see cacti/settings.php?tab=authentication, or the Authentication Tab in Configuration/Settings) means the weathermap would emit some weird messages and not work.

I found two files so far that needed to be fixed to make it work with no Cacti authentication

weathermap-cacti-plugin.php

Code:

weathermap # diff -u weathermap-cacti-plugin.php /var/srv/www/cacti/plugins/weathermap/weathermap-cacti-plugin.php
--- weathermap-cacti-plugin.php 2006-06-27 14:51:47.273243112 -0700
+++ /var/srv/www/cacti/plugins/weathermap/weathermap-cacti-plugin.php   2006-06-27 12:29:04.178031456 -0700
@@ -74,7 +74,12 @@
   $confdir = dirname(__FILE__).'/configs/';

   # $map = db_fetch_assoc("select * from weathermap_maps where id=".$mapid);
-  $map = db_fetch_assoc("select weathermap_maps.* from weathermap_auth,weathermap_maps where weathermap_maps.id=weathermap_auth.mapid and active='on' and (userid=".$_SESSION["sess_user_id"]." or userid=0) and weathermap_maps.id=".$mapid);
+
+  if (read_config_option("global_auth") == "on") {
+     $map = db_fetch_assoc("select weathermap_maps.* from weathermap_auth,weathermap_maps where weathermap_maps.id=weathermap_auth.mapid and active='on' and (userid=".$_SESSION["sess_user_id"]." or userid=0) and weathermap_maps.id=".$mapid);
+   } else {
+      $map = db_fetch_assoc("select weathermap_maps.* from weathermap_auth,weathermap_maps where weathermap_maps.id=weathermap_auth.mapid and active='on' and weathermap_maps.id=".$mapid);
+   }

     if(sizeof($map))
     {
@@ -118,8 +123,8 @@

         if (isset($user_auth_realm_filenames['weathermap-cacti-plugin-mgmt.php'])) {
                 $realm_id2 = $user_auth_realm_filenames['weathermap-cacti-plugin-mgmt.php'];
-        }
-        if ((db_fetch_assoc("select user_auth_realm.realm_id from user_auth_realm where user_auth_realm.user_id='" . $_SESSION["sess_user_id"] . "' and user_auth_realm.realm_id='$realm_id2'")) || (empty($realm_id2))) {
+        }
+        if ((read_config_option("global_auth") == "off") || (db_fetch_assoc("select user_auth_realm.realm_id from user_auth_realm where user_auth_realm.user_id='" . $_SESSION["sess_user_id"] . "' and user_auth_realm.realm_id='$realm_id2'")) || (empty($realm_id2))) {

                 print '<a href="' . $config['url_path'] . 'plugins/weathermap/weathermap-cacti-plugin-mgmt.php">Manage Maps</a>';
         }
@@ -129,7 +134,12 @@
 {
   global $colors;

- $maplist = db_fetch_assoc( "select distinct weathermap_maps.* from weathermap_auth,weathermap_maps where weathermap_maps.id=weathermap_auth.mapid and active='on' and (userid=".$_SESSION["sess_user_id"]." or userid=0) order by sortorder, id");
+
+  if (read_config_option("global_auth") == "on") {
+     $maplist = db_fetch_assoc( "select distinct weathermap_maps.* from weathermap_auth,weathermap_maps where weathermap_maps.id=weathermap_auth.mapid and active='on' and (userid=".$_SESSION["sess_user_id"]." or userid=0) order by sortorder, id");
+  } else {
+     $maplist = db_fetch_assoc( "select distinct weathermap_maps.* from weathermap_auth,weathermap_maps where weathermap_maps.id=weathermap_auth.mapid and active='on' order by sortorder, id");
+  }


   if(sizeof($maplist) == 1)
@@ -204,7 +214,11 @@

   $_SESSION['custom']=false;

-  $maplist = db_fetch_assoc( "select distinct weathermap_maps.* from weathermap_auth,weathermap_maps where weathermap_maps.id=weathermap_auth.mapid and active='on' and (userid=".$_SESSION["sess_user_id"]." or userid=0) order by sortorder, id");
+  if (read_config_option("global_auth") == "on") {
+     $maplist = db_fetch_assoc( "select distinct weathermap_maps.* from weathermap_auth,weathermap_maps where weathermap_maps.id=weathermap_auth.mapid and active='on' and (userid=".$_SESSION["sess_user_id"]." or userid=0) order by sortorder, id");
+  } else {
+     $maplist = db_fetch_assoc( "select distinct weathermap_maps.* from weathermap_auth,weathermap_maps where weathermap_maps.id=weathermap_auth.mapid and active='on' and order by sortorder, id");
+  }
   html_graph_start_box(2,true);

   if(sizeof($maplist) == 1)


setup.php, function weathermap_show_tab()

Code:

function weathermap_show_tab () {
        global $config, $user_auth_realms, $user_auth_realm_filenames;
        $realm_id2 = 0;

        if (isset($user_auth_realm_filenames[basename('weathermap-cacti-plugin.php')])) {
                $realm_id2 = $user_auth_realm_filenames[basename('weathermap-cacti-plugin.php')];
        }

         if (read_config_option("global_auth") == "on") {
                if ((db_fetch_assoc("select user_auth_realm.realm_id from user_auth_realm where user_auth_realm.user_id='" . $_SESSION["sess_user_id"] . "' and user_auth_realm.realm_id='$realm_id2'")) || (empty($realm_id2))) {

                        print '<a href="' . $config['url_path'] . 'plugins/weathermap/weathermap-cacti-plugin.php"><img src="' . $config['url_path'] . 'plugins/weathermap/images/tab_weathermap.png" alt="Weathermap" align="absmiddle" border="0"></a>';

                }
        } else {
                        print '<a href="' . $config['url_path'] . 'plugins/weathermap/weathermap-cacti-plugin.php"><img src="' . $config['url_path'] . 'plugins/weathermap/images/tab_weathermap.png" alt="Weathermap" align="absmiddle" border="0"></a>';
        }



basically, where-ever sess_user_id is used, if the config_option global_auth is off we just ignore any userid and pull all information.

I also had to change cacti/include/top_graph_header.php:

Code:

diff -u top_graph_header.php /var/srv/www/cacti/include/top_graph_header.php
--- top_graph_header.php        2006-06-27 14:34:55.012130192 -0700
+++ /var/srv/www/cacti/include/top_graph_header.php     2006-06-27 15:07:22.573055928 -0700
@@ -41,6 +41,8 @@
        if (sizeof(db_fetch_assoc("select realm_id from user_auth_realm where realm_id=8 and user_id=" . $_SESSION["sess_user_id"])) == 0) {
                $show_console_tab = false;
        }
+} else {
+       $current_user = db_fetch_row("select * from user_auth where id='admin'");
 }

 /* use cached url if available and applicable */



These changes do give full admin access to everything; that is the way we currently run Cacti (everyone is trusted who has access to the server)
Back to top
_JPL_
Cacti User


Joined: 29 Nov 2004
Posts: 58

PostPosted: Wed Jun 28, 2006 9:02 am    Post subject: Reply with quote

Howie wrote:
_JPL_ wrote:
I don't see maps at all after the poller runs. I chmod 777 the output folder to make sure there were sufficient perms (will undo once I get it working). I have the conf file in the configs folder.

In the poller at the very end I see the error:
PHP Fatal error: Cannot redeclare class html_imagemap_area_polygon in /usr/share/pear/HTML_ImageMap.class.php on line 140



Which version of PHP, and which platform is this? I haven't seen this one before...

[please don't crosspost the same query...]


PHP 5.0.4 on Fedora Core 4, apache 2.0.54, cacti 0.8.6h
Back to top
andrew2
Cacti User


Joined: 26 Jul 2004
Posts: 64
Location: Cincinnati, OH

PostPosted: Thu Jun 29, 2006 3:44 pm    Post subject: Weathermap doesn't seem to work out of cron Reply with quote

Odd problem here. If I run poller.php from the commandline, weathermap executes and runs properly. When I let poller.php run as a cron job, I get this:

06/29/2006 04:35:13 PM - WEATHERMAP: Poller[0] Weathermap 0.82 in da house
06/29/2006 04:35:13 PM - WEATHERMAP: Poller[0] Engaging Weathermap DEBUG mode
06/29/2006 04:35:13 PM - WEATHERMAP: Poller[0] Iterating all maps.
06/29/2006 04:35:13 PM - WEATHERMAP: Poller[0] Map: /root/cacti-0.8.5/plugins/weathermap/configs/weathermap.conf -> /root/cacti-0.8.5/plugins/weathermap/output/weathermap_1.html & /root/cacti-0.8.5/plugins/weathermap/output/weathermap_1.png
06/29/2006 04:35:13 PM - WEATHERMAP: Poller[0] Adding default map colour set.
06/29/2006 04:35:13 PM - WEATHERMAP: Poller[0] Saving Node: node1
06/29/2006 04:35:13 PM - WEATHERMAP: Poller[0] Saving Node: node2
06/29/2006 04:35:13 PM - WEATHERMAP: Poller[0] Setting bandwidth (155M, 155M)

For what it's worth, I'm using cactid 0.8.6e with Cacti 0.8.6f

I'm running poller.php from the commandline as the same user with poller.php in its crontab, so permissions/paths/etc. should all be the same.

Any thoughts?

Thanks,

Andrew
Back to top
Howie
Cacti Guru User


Joined: 16 Sep 2004
Posts: 2247
Location: United Kingdom

PostPosted: Thu Jun 29, 2006 3:48 pm    Post subject: Re: Weathermap doesn't seem to work out of cron Reply with quote

andrew2 wrote:
Odd problem here. If I run poller.php from the commandline, weathermap executes and runs properly. When I let poller.php run as a cron job, I get this:

06/29/2006 04:35:13 PM - WEATHERMAP: Poller[0] Weathermap 0.82 in da house
06/29/2006 04:35:13 PM - WEATHERMAP: Poller[0] Engaging Weathermap DEBUG mode
06/29/2006 04:35:13 PM - WEATHERMAP: Poller[0] Iterating all maps.
06/29/2006 04:35:13 PM - WEATHERMAP: Poller[0] Map: /root/cacti-0.8.5/plugins/weathermap/configs/weathermap.conf -> /root/cacti-0.8.5/plugins/weathermap/output/weathermap_1.html & /root/cacti-0.8.5/plugins/weathermap/output/weathermap_1.png
06/29/2006 04:35:13 PM - WEATHERMAP: Poller[0] Adding default map colour set.
06/29/2006 04:35:13 PM - WEATHERMAP: Poller[0] Saving Node: node1
06/29/2006 04:35:13 PM - WEATHERMAP: Poller[0] Saving Node: node2
06/29/2006 04:35:13 PM - WEATHERMAP: Poller[0] Setting bandwidth (155M, 155M)

For what it's worth, I'm using cactid 0.8.6e with Cacti 0.8.6f

I'm running poller.php from the commandline as the same user with poller.php in its crontab, so permissions/paths/etc. should all be the same.

Any thoughts?

Thanks,

Andrew


Ummmm. I don't see any error. That's exactly what you should get, assuming that DEBUG is on, and there is some more after that in the logs, too...
Back to top
andrew2
Cacti User


Joined: 26 Jul 2004
Posts: 64
Location: Cincinnati, OH

PostPosted: Thu Jun 29, 2006 3:50 pm    Post subject: Re: Weathermap doesn't seem to work out of cron Reply with quote

Howie wrote:

Ummmm. I don't see any error. That's exactly what you should get, assuming that DEBUG is on, and there is some more after that in the logs, too...


Well, that's the problem. DEBUG is on, and that's the last line in the log.

Andrew
Back to top
Howie
Cacti Guru User


Joined: 16 Sep 2004
Posts: 2247
Location: United Kingdom

PostPosted: Thu Jun 29, 2006 3:52 pm    Post subject: Reply with quote

_JPL_ wrote:
Howie wrote:
_JPL_ wrote:
I don't see maps at all after the poller runs. I chmod 777 the output folder to make sure there were sufficient perms (will undo once I get it working). I have the conf file in the configs folder.

In the poller at the very end I see the error:
PHP Fatal error: Cannot redeclare class html_imagemap_area_polygon in /usr/share/pear/HTML_ImageMap.class.php on line 140



Which version of PHP, and which platform is this? I haven't seen this one before...

[please don't crosspost the same query...]


PHP 5.0.4 on Fedora Core 4, apache 2.0.54, cacti 0.8.6h


Aaah.. I see the problem now. It looks like someone else has written an HTML_ImageMap class, and submitted it to PEAR. If you don't need it for anything else, then the quick fix would be to uninstall the PEAR HTML_Imagemap class:
Code:

pear uninstall HTML_ImageMap

I'll have to change that classname in a new version, I guess.

Either that, or did you copy that class file from the weathermap folder in your /usr/share/pear? I don't actually see HTML_ImageMap on the PEAR site...
Back to top
Howie
Cacti Guru User


Joined: 16 Sep 2004
Posts: 2247
Location: United Kingdom

PostPosted: Thu Jun 29, 2006 4:32 pm    Post subject: Re: Weathermap doesn't seem to work out of cron Reply with quote

andrew2 wrote:
I'm running poller.php from the commandline as the same user with poller.php in its crontab, so permissions/paths/etc. should all be the same.

That's not always true. On my FreeBSD systems, cron runs with a more restricted path than the regular shell. I think that's fairly common, too - man 5 crontab will confirm for you.

That said, there's only one external program that weathermap uses, and that's rrdtool, for which it gets the full path from Cacti.
Back to top
_JPL_
Cacti User


Joined: 29 Nov 2004
Posts: 58

PostPosted: Fri Jun 30, 2006 8:37 am    Post subject: Reply with quote

Howie wrote:
_JPL_ wrote:
Howie wrote:
_JPL_ wrote:
I don't see maps at all after the poller runs. I chmod 777 the output folder to make sure there were sufficient perms (will undo once I get it working). I have the conf file in the configs folder.

In the poller at the very end I see the error:
PHP Fatal error: Cannot redeclare class html_imagemap_area_polygon in /usr/share/pear/HTML_ImageMap.class.php on line 140



Which version of PHP, and which platform is this? I haven't seen this one before...

[please don't crosspost the same query...]


PHP 5.0.4 on Fedora Core 4, apache 2.0.54, cacti 0.8.6h


Aaah.. I see the problem now. It looks like someone else has written an HTML_ImageMap class, and submitted it to PEAR. If you don't need it for anything else, then the quick fix would be to uninstall the PEAR HTML_Imagemap class:
Code:

pear uninstall HTML_ImageMap

I'll have to change that classname in a new version, I guess.

Either that, or did you copy that class file from the weathermap folder in your /usr/share/pear? I don't actually see HTML_ImageMap on the PEAR site...


Once I noticed the error I copied the weathermap HTML_Imagemap class over the pear one but still error for some reason. There are no other weathermap references in a debug run of the cacti log either for some reason. I'll try moving the pear file and see what happens.

EDIT: That was the problem. I removed the class file from the pear folder and it works now. Thanks.
Back to top
Howie
Cacti Guru User


Joined: 16 Sep 2004
Posts: 2247
Location: United Kingdom

PostPosted: Fri Jun 30, 2006 10:59 am    Post subject: Reply with quote

_JPL_ wrote:

EDIT: That was the problem. I removed the class file from the pear folder and it works now. Thanks.


I think the reason is that in some parts of Weathermap it uses require_once to load a class file only once. However, in some places (in the cacti-specific files) it uses the full path to the classes, but in others it uses the class name only, which would choose the PEAR copy. At that stage PHP can't tell that the two 'different' files should be treated as one for the require_once process.
Back to top
jga



Joined: 01 Jul 2002
Posts: 13
Location: Santiago de Chile

PostPosted: Tue Jul 04, 2006 7:16 pm    Post subject: problems with weathermap v 0.82 Reply with quote

problems with weathermap v 0.82

Hi
I have installed Weathermap 0.82 , first the number associated with "Configure Weathermap" in setup.php, crashes with other plugin, I
Back to top
jga



Joined: 01 Jul 2002
Posts: 13
Location: Santiago de Chile

PostPosted: Tue Jul 04, 2006 7:16 pm    Post subject: problems with weathermap v 0.82 Reply with quote

"problems with weathermap v 0.82

Hi
I have installed Weathermap 0.82 , first the number associated with "Configure Weathermap" in setup.php, crashes with other plugin, I
Back to top
stelaras1
Cacti User


Joined: 03 Nov 2004
Posts: 57

PostPosted: Thu Jul 06, 2006 9:49 am    Post subject: unable to read data from rrd Reply with quote

Hello!
I have installed 0.82 version and seems to run smoothly.
The only problem i have is that link status does not change.
Maybe it can't read from the corresponding rrd file.

Here is the output of debug in cacti.log file.

ReadData for Link node1152168863-node1152110831:
07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0] New Target: /www/htdocs/cacti/rra/2118.rrd (/www/htdocs/cacti/rra/2118.rrd)
07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0] ReadData: Updating link node1152168863-node1152110831 from RRD Target /www/htdocs/cacti/rra/2118.rrd
07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0] ReadFromRRD: Target DS names are traffic_in and traffic_out
07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0] ReadFromRRD: Running: /usr/local/rrdtool/bin/rrdtool fetch /www/htdocs/cacti/rra/2118.rrd AVERAGE --star
t now-800
07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0] > 1152186000: 0.0000000000e+00 8.3074505917e+03
07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0] > 1152186300: 0.0000000000e+00 8.5968652777e+03
07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0] > 1152186600: 0.0000000000e+00 8.4315453866e+03
07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0] > 1152186900: 0.0000000000e+00 8.5097513333e+03
07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0] > 1152187200: NaN NaN
07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0] >
07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0] --
07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0] --1152187200: NaN NaN
07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0] ReadFromRRD: 1: This isn't a number: [NaN]
07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0] ReadFromRRD: 2: This isn't a number: [NaN]
07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0] --1152186900: 0.0000000000e+00 8.5097513333e+03
07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0] ReadFromRRD: Found a good line: 1152186900: 0.0000000000e+00 8.5097513333e+03
(timestamp out in
)
07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0] --1152186600: 0.0000000000e+00 8.4315453866e+03
07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0] --1152186300: 0.0000000000e+00 8.5968652777e+03
07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0] --1152186000: 0.0000000000e+00 8.3074505917e+03
07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0] ReadFromRRD: Our line is 1152186900: 0.0000000000e+00 8.5097513333e+03
07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0] ReadFromRRD: Returning (0,0)
07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0] ReadData: Setting 0,0
07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0]
ReadData Completed.

Can you please help me with this issue?

THanks in advance.
Back to top
adrianmarsh
Cacti User


Joined: 17 Aug 2005
Posts: 417
Location: UK

PostPosted: Fri Jul 07, 2006 3:47 pm    Post subject: Reply with quote

stelaras1,

NaN means that the information from those datasources isn't being read correctly by cacti. Verify that you can view the actual graphs for those items first, from the normal Graphs view in Cacti.
Back to top
Howie
Cacti Guru User


Joined: 16 Sep 2004
Posts: 2247
Location: United Kingdom

PostPosted: Fri Jul 07, 2006 4:11 pm    Post subject: Reply with quote

adrianmarsh wrote:
stelaras1,

NaN means that the information from those datasources isn't being read correctly by cacti. Verify that you can view the actual graphs for those items first, from the normal Graphs view in Cacti.


That's true, but it also says
Code:

07/06/2006 02:57:03 PM - WEATHERMAP: Poller[0] ReadFromRRD: Our line is 1152186900: 0.0000000000e+00 8.5097513333e+03

which is means it should be returning (0,8.5K), not (0,0)

It's not that unusual to have the last line be a NaN, if the poller takes a long time to run, which is why it searches backwards for non-NaN lines.

That said, is it possible that your RRD uses DS names other than 'traffic_in' and 'traffic_out', stelaras1? It seems that your DS names are 'in' and 'out'. If they are, you'll need to change your TARGET line to TARGET blah.rrd:in:out.

There's already a fix in 0.9 to make this type of problem more obvious.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Plugin: (Network Weather Map) All times are GMT - 5 Hours
Goto page Previous  1, 2, 3 ... 21, 22, 23, 24, 25  Next
Page 22 of 25

 



Powered by phpBB © 2001, 2005 phpBB Group