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    


[SOLVED] Cron out of sync with Poller Interval cacti 0.8.7a

 
Post new topic   Reply to topic    Cacti Forum Index -> Help: Linux/Unix Specific
Author Message
tomines



Joined: 03 Dec 2007
Posts: 4

PostPosted: Mon Dec 03, 2007 5:13 pm    Post subject: [SOLVED] Cron out of sync with Poller Interval cacti 0.8.7a Reply with quote

Hi I am new to cacti and I just installed version 0.8.7a last week. I'm having problems with my poller running. When I run it manually as the cacti user I get the following.

--begin cut

#php /var/www/html/cacti/poller.php

12/03/2007 01:23:26 PM - POLLER: Poller[0] WARNING: Cron is out of sync with the Poller Interval! The Poller Interval is '300' seconds, with a maximum of a '300' second Cron, but 489 seconds have passed since the last poll!

OK u:0.00 s:0.00 r:1.01
OK u:0.00 s:0.00 r:1.01
OK u:0.00 s:0.00 r:1.01
OK u:0.00 s:0.00 r:1.01
OK u:0.00 s:0.00 r:1.01
OK u:0.00 s:0.00 r:1.01
OK u:0.00 s:0.00 r:1.01

12/03/2007 01:23:27 PM - SYSTEM STATS: Time:1.1161 Method:cmd.php Processes:1 Threads:N/A Hosts:41 HostsPerProcess:41 DataSources:15 RRDsProcessed:13

OK u:0.00 s:0.00 r:1.01
OK u:0.00 s:0.00 r:1.01
OK u:0.00 s:0.00 r:1.01
OK u:0.00 s:0.00 r:1.01
OK u:0.00 s:0.00 r:1.01
OK u:0.00 s:0.00 r:1.01

--end cut

I've read all the posts in regards to this and here are my notes.

- The poller interval and cron interval are both set to 5 minutes

- This was compiled and not installed from a package and only one instance of the cron is running at a time

- made sure poller.php variable $cron_interval is set to 300

- rrd files time stamps are NOT getting updated

- there was a suggest to install a new <functions.php>. This was done

- I get the following from mysql

- select count(*) from poller_output;

+----------+

| count(*) |

+----------+
| 0 |
+----------+

1 row in set (0.00 sec)

- also did this in mysql

truncate poller_output;

- memory settings in my php.ini is set to 128M

Please help
Back to top
tomines



Joined: 03 Dec 2007
Posts: 4

PostPosted: Mon Dec 03, 2007 8:03 pm    Post subject: my os is.... Reply with quote

BTW My OS is Fedora Core 7
Back to top
fmangeant
Cacti Guru User


Joined: 19 Sep 2003
Posts: 2325
Location: Sophia-Antipolis, France

PostPosted: Tue Dec 04, 2007 10:50 am    Post subject: Reply with quote

Hi

did you add a cron job to run the poller every 5 minutes ?
Code:
*/5 * * * * /bin/php /path/to/cactipoller.php
Back to top
tomines



Joined: 03 Dec 2007
Posts: 4

PostPosted: Tue Dec 04, 2007 12:59 pm    Post subject: Reply with quote

Yeah I actually got this fixed last night. The problem was actually with my crontab. For whatever reason when I set this up to run as cacti in roots crontab the poller did not work

*/5 * * * * cacti php /var/www/html/cacti/poller.php > /dev/null 2>&1

The following below worked when I ran it directly from the cacti user's crontab.

*/5 * * * * php /var/www/html/cacti/poller.php > /dev/null 2>&1

The is on Fedora 7
Back to top
Maestro_Ba



Joined: 06 Jun 2006
Posts: 34

PostPosted: Tue Dec 11, 2007 10:45 am    Post subject: Reply with quote

tomines wrote:

*/5 * * * * cacti php /var/www/html/cacti/poller.php > /dev/null 2>&1

This is the format for /etc/crontab

tomines wrote:

*/5 * * * * php /var/www/html/cacti/poller.php > /dev/null 2>&1

This is the format for each user's crontab (crontab -e)

Either way should do it.
Back to top
brokentongue



Joined: 26 Jan 2008
Posts: 5

PostPosted: Thu Jan 31, 2008 8:19 pm    Post subject: Reply with quote

I can't get a cron job to run. When I run it in Webmin no errors are outputted.

*/5 * * * * root /usr/bin/php /usr/share/cacti/cactipoller.php >/dev/null 2>&1

I'm really stuck. I've also tried everything in this thread.
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12295
Location: Muenster, Germany

PostPosted: Fri Feb 01, 2008 7:16 am    Post subject: Reply with quote

brokentongue wrote:
I can't get a cron job to run. When I run it in Webmin no errors are outputted.

*/5 * * * * root /usr/bin/php /usr/share/cacti/cactipoller.php >/dev/null 2>&1

I'm really stuck. I've also tried everything in this thread.
The poller is named poller.php. You should not rename it.
Reinhard
Back to top
brokentongue



Joined: 26 Jan 2008
Posts: 5

PostPosted: Fri Feb 01, 2008 6:26 pm    Post subject: Reply with quote

That was a mistake, sorry. This is what it's suppose to be but it's not working.

Code:
*/5 * * * * root /usr/bin/php /usr/share/cacti/poller.php >/dev/null 2>&1


When I run

Code:
php -q /usr/share/cacti/poller.php --force --debug


I get

Quote:
02/01/2008 11:24:08 PM - POLLER: Poller[0] WARNING: Cron is out of sync with the Poller Interval! The Poller Interval is '300' seconds, with a maximum of a '300' second Cron, but 76726 seconds have passed since the last poll!
02/01/2008 11:24:09 PM - SYSTEM STATS: Time:1.1448 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:2 DataSources:5 RRDsProcessed:5
OK u:0.00 s:0.00 r:1.02
OK u:0.00 s:0.00 r:1.02
OK u:0.00 s:0.00 r:1.03
OK u:0.00 s:0.00 r:1.03
OK u:0.00 s:0.00 r:1.03


I'm not sure how to change the cron job to get it to work.

PS

I used yum to install cacti and it generated a file with the cron job in cron.d . That wasn't working so I deleted the file and added the cron job to crontab. It still isn't working though.

I'm not sure what else to try. Thanks
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12295
Location: Muenster, Germany

PostPosted: Sat Feb 02, 2008 1:12 pm    Post subject: Reply with quote

Please read the second link of my signature. There's a chapter on crontab problems that may help
Reinhard
Back to top
brokentongue



Joined: 26 Jan 2008
Posts: 5

PostPosted: Sat Feb 02, 2008 3:29 pm    Post subject: Reply with quote

Thanks

I checked your link and added a new crontab entry
Code:

prompt> vi /etc/cron.d/cacti
*/5 * * * *     cactiuser       /usr/bin/php -q /var/www/html/cacti/poller.php > /var/local/log/poller.log 2>&1


When I ran it the log said that it didn't exist so I created a link

Code:
ln -s /usr/share/cacti /var/www/html/cacti


Then I ran it again and got
Quote:
<br><strong>This script is only meant to run at the command line.</strong>


I changed the crontab entry to

Quote:
prompt> vi /etc/cron.d/cacti
*/5 * * * * cactiuser /usr/bin/php -q /usr/share/cacti/poller.php > /var/local/log/poller.log 2>&1


but I'm still getting
Quote:
<br><strong>This script is only meant to run at the command line.</strong>


So what I figured out is that my personal IP is reported ($_SERVER['REMOTE_ADDR']) when running the cron job in Webmin and I'm not sure why.

I found this guide about cron.
http://www.linuxhelp.net/guides/cron/

I ran the command "crontab -e" and the poller wasn't there so I added it. That still didn't do the trick.[/code]
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12295
Location: Muenster, Germany

PostPosted: Sat Feb 02, 2008 4:19 pm    Post subject: Reply with quote

brokentongue wrote:
Thanks

I checked your link and added a new crontab entry
Code:

prompt> vi /etc/cron.d/cacti
*/5 * * * *     cactiuser       /usr/bin/php -q /var/www/html/cacti/poller.php > /var/local/log/poller.log 2>&1
Sorry if this was misleading. It was not meant to add another crontab but to warn users to use only one. RPM installations often bring /etc/cron.d/cacti. If you then add cacti /etc/crontab, that will fail.
To sum up, make sure to only use one crontab. It doesn't matter which one, as long as your syntax is correct (crontab of user "cactiuser" does not require the userid to be added to the command!).
Please tell us, which crontab you use and which line you added for cacti.
Then tell us, if cron is run succesfully (e.g. see /var/log/crontab or the like).
Last, verify that ./log/cacti.log shows some data.
Reinhard
Back to top
brokentongue



Joined: 26 Jan 2008
Posts: 5

PostPosted: Sat Feb 02, 2008 5:18 pm    Post subject: Reply with quote

Thank you. It's working now.

Maybe this will help someone.

I didn't have cron running. To check to see if cron is running enter the command
Code:
ps aux | grep crond


You should get 2 lines
Quote:
root 14833 0.0 0.1 5240 1108 ? Ss 21:59 0:00 crond
root 14856 0.0 0.0 3900 664 pts/0 S+ 21:59 0:00 grep crond


If you only have grep then cron isn't running. Then start it using the command
Code:
/etc/rc.d/init.d/crond start


Last edited by brokentongue on Sat Feb 02, 2008 6:13 pm; edited 1 time in total
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12295
Location: Muenster, Germany

PostPosted: Sat Feb 02, 2008 6:02 pm    Post subject: Reply with quote

I've added this hint to the HowTo
Reinhard
Back to top
lipos



Joined: 24 Jul 2008
Posts: 24

PostPosted: Wed Jul 30, 2008 10:12 am    Post subject: Reply with quote

it's nt solved for all....
I use RH5.2 and your way of configurating cron was not working for me.
Here's whet I did though:

- I logged to root (I'm running this cron job form root account)

- run crontab -e

- add (you migh want to update the paths with yours)

Code:

*/5 * * * * root php /var/www/html/cacti/poller.php > /dev/null 2>&1


Save it and enjoy.
You job will be save under /var/spool/cron/root

EnjoY!

More info http://www.linuxhelp.net/guides/cron/


Later on....

OK It's still not working like it should be!
Any ideas anyone??
Back to top
lipos



Joined: 24 Jul 2008
Posts: 24

PostPosted: Thu Jul 31, 2008 4:08 am    Post subject: Reply with quote

OK!

It's working for me now.. Overall here's my configuration

crontab -e

and put

Code:


*/5 * * * * php -q /var/www/html/cacti/poller.php --force --debug >> /var/local/log/poller.log 2>&1



Check the cron command that I gave you above. It's should show some more logs that your command does. Let me know.

My problem was cause by cron command. I added root before php -q.
I didn't get any logs before I pointed it to a file ..soooo check it!

Cheers...
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Help: Linux/Unix Specific All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group