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    


Can't generate .png from poller.php

 
Post new topic   Reply to topic    Cacti Forum Index -> Plugin: (Network Weather Map)
Author Message
Jeb



Joined: 24 May 2005
Posts: 38

PostPosted: Thu May 24, 2007 2:27 am    Post subject: Can't generate .png from poller.php Reply with quote

Hello, i was using weathermap 0.82 and i upgraded to 0.91 today and since this time the generation from poller.php fail

PHP Warning: Division by zero in /.../cacti-0.8.6i/plugins/weathermap/setup.php on line 314
PHP Fatal error: Out of memory (allocated 131334144) (tried to allocate 1050 bytes) in /.../cacti-0.8.6i/plugins/
weathermap/Weathermap.class.php on line 176

I was using memory_limit = 64M, i tried with memory_limit = 256M but it still don't work.
If i use the "recalculate all maps now" button or if i run weathermap from cli (php weathermap --config configs/MPLS.conf) it works fine. (weathermap-cacti-rebuild.php also work)
So i think there is a bug somewhere (may be related to the division by zero warning ?)
Back to top
Howie
Cacti Guru User


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

PostPosted: Thu May 24, 2007 4:21 am    Post subject: Re: Can't generate .png from poller.php Reply with quote

Jeb wrote:
Hello, i was using weathermap 0.82 and i upgraded to 0.91 today and since this time the generation from poller.php fail

PHP Warning: Division by zero in /.../cacti-0.8.6i/plugins/weathermap/setup.php on line 314
PHP Fatal error: Out of memory (allocated 131334144) (tried to allocate 1050 bytes) in /.../cacti-0.8.6i/plugins/
weathermap/Weathermap.class.php on line 176

I was using memory_limit = 64M, i tried with memory_limit = 256M but it still don't work.
If i use the "recalculate all maps now" button or if i run weathermap from cli (php weathermap --config configs/MPLS.conf) it works fine. (weathermap-cacti-rebuild.php also work)
So i think there is a bug somewhere (may be related to the division by zero warning ?)


That's odd. It seems that some of the new settings in 0.9 weren't automatically created for you. You might like to try: Settings, Misc and then just Save (don't change anything). That ought to fill in any gaps, I think.

However, assuming that fixes the divide-by-zero, you might now have permissions problems as a result of using Recalc Now - just be aware...
Back to top
Jeb



Joined: 24 May 2005
Posts: 38

PostPosted: Thu May 24, 2007 5:24 am    Post subject: Reply with quote

Thanks for your quick answer. It doesn't solve my problem, i still get the same error :/
Back to top
Howie
Cacti Guru User


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

PostPosted: Thu May 24, 2007 5:34 am    Post subject: Reply with quote

Jeb wrote:
Thanks for your quick answer. It doesn't solve my problem, i still get the same error :/


If you are able to log into the mysql database for your cacti and run the following commands:
Code:

replace into settings values('weathermap_render_counter',0);
replace into settings values('weathermap_render_period',1);


That should take care of it then. I still don't know why it happened though.
Back to top
Jeb



Joined: 24 May 2005
Posts: 38

PostPosted: Thu May 24, 2007 5:37 am    Post subject: Reply with quote

Ok, in fact weathermap_render_period value is 0 in the database when i chose every poller cycle.
In the html code :
<option value="0" selected>Every Poller Cycle (default)</option>

I think it should be 1 instead of 0 !
Back to top
Jeb



Joined: 24 May 2005
Posts: 38

PostPosted: Thu May 24, 2007 5:41 am    Post subject: Reply with quote

Patch:

Change 0 to 1 in setup.php line 97

0 => "Every Poller Cycle (default)",
-> 1 => "Every Poller Cycle (default)",
Back to top
Howie
Cacti Guru User


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

PostPosted: Thu May 24, 2007 6:27 am    Post subject: Reply with quote

Jeb wrote:
Ok, in fact weathermap_render_period value is 0 in the database when i chose every poller cycle.
In the html code :
<option value="0" selected>Every Poller Cycle (default)</option>

I think it should be 1 instead of 0 !


No, it should be 0.
anything mod 0 == 0

It doesn't really make much difference if it's 1, but it was 0 for a reason (I don't recall the reason right now ). Besides which, it is working for several hundred other people.

I've just tried 0%0, 0%1, 1%0 and 1%1 and none of those give me a div-by-zero, in fact. Even NULL%0 didn't. So I'm a little puzzled.
Back to top
Jeb



Joined: 24 May 2005
Posts: 38

PostPosted: Thu May 24, 2007 7:19 am    Post subject: Reply with quote

<?
if ((1 % 0) == 0) {
echo "Ok";
}
?>
Give me "PHP Warning: Division by zero"
0%0 give me the same.

1%1 and 0%1 are ok

i'am using PHP 5.2.1, i've tested with a PHP 5.1.6 and with it %0 is Ok, on PHP 5.2.0-8+etch4 there is a warning...

But i may have said too fast that saving setting didn't solve my problem because i put back weathermap_render_period to 0 and it's working... may be there was the need to way for 2 cycle after saving data for the "bug" to go out...

Anyway thank you
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
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group