PHP Warning: Division by zero

Support questions about the Network Weather Map plugin

Moderators: Developers, Moderators

Post Reply
Conz
Posts: 19
Joined: Thu Apr 28, 2005 3:00 am

PHP Warning: Division by zero

Post by Conz »

I'm trying to get weathermap going on a new fedora 7 machine and its telling me: PHP Warning: Division by zero in /var/www/html/cacti/plugins/weathermap/setup.php on line 314

I have it running on FC5 with no problems, the map DOES get correctly rendered on F7 so it might be cosmetic.

Any ideas ?
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: PHP Warning: Division by zero

Post by Howie »

Conz wrote:I'm trying to get weathermap going on a new fedora 7 machine and its telling me: PHP Warning: Division by zero in /var/www/html/cacti/plugins/weathermap/setup.php on line 314

I have it running on FC5 with no problems, the map DOES get correctly rendered on F7 so it might be cosmetic.

Any ideas ?
Do you get this more than once? It looks like a default is not being set correctly. You should be able to fix it by going into the Settings..Misc in Cacti, and setting the Map Rendering Interval to Every Polling Cycle, which should re-write the setting.
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!)
Conz
Posts: 19
Joined: Thu Apr 28, 2005 3:00 am

Post by Conz »

Ok i tried that and that didn't help, i did find out after some experimenting that it has to do with the weathermap_render_period and weathermap_render_counter variables, when i change the update cycle to manual or anything but every update poller cycle causes the error.

fixed it by changing setup.php (around line 314):

Code: Select all

                if( ($rendercounter % $renderperiod) == 0)
                         {
                        weathermap_run_maps(dirname(__FILE__) );
                }
To:

Code: Select all

                if ($renderperiod == 0) {
                        weathermap_run_maps(dirname(__FILE__) );
                } else if( ($rendercounter % $renderperiod) == 0) {
                        weathermap_run_maps(dirname(__FILE__) );
                }
it seems that renderperiod 0 is every update and 1 is manual, allthough somehow i think it should be the other way around.
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

Hmm. There was some discussion of this once before. My understanding was that anything mod 0 is 0 but it seems that in at least some php versions, that's not the case.

I'll make the change as you suggest, I think.
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!)
Conz
Posts: 19
Joined: Thu Apr 28, 2005 3:00 am

Post by Conz »

It might be because i botched something else up of which i cant really remember what it would be though.
just fyi, F7 has php 5.2.2 on it, its the normal rpm version which came with it, and any current updates.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests