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

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

tomines
Posts: 4
Joined: Mon Dec 03, 2007 4:21 pm

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

Post by tomines »

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
tomines
Posts: 4
Joined: Mon Dec 03, 2007 4:21 pm

my os is....

Post by tomines »

BTW My OS is Fedora Core 7
User avatar
fmangeant
Cacti Guru User
Posts: 2345
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

Post by fmangeant »

Hi

did you add a cron job to run the poller every 5 minutes ?

Code: Select all

*/5 * * * * /bin/php /path/to/cactipoller.php
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
tomines
Posts: 4
Joined: Mon Dec 03, 2007 4:21 pm

Post by tomines »

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
Maestro_Ba
Posts: 36
Joined: Tue Jun 06, 2006 10:53 am

Post by Maestro_Ba »

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.
brokentongue
Posts: 5
Joined: Sat Jan 26, 2008 5:14 pm

Post by brokentongue »

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.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

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
brokentongue
Posts: 5
Joined: Sat Jan 26, 2008 5:14 pm

Post by brokentongue »

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

Code: Select all

*/5 * * * * root /usr/bin/php /usr/share/cacti/poller.php >/dev/null 2>&1
When I run

Code: Select all

php -q /usr/share/cacti/poller.php --force --debug
I get
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
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Please read the second link of my signature. There's a chapter on crontab problems that may help
Reinhard
brokentongue
Posts: 5
Joined: Sat Jan 26, 2008 5:14 pm

Post by brokentongue »

Thanks

I checked your link and added a new crontab entry

Code: Select all

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: Select all

ln -s /usr/share/cacti /var/www/html/cacti
Then I ran it again and got
<br><strong>This script is only meant to run at the command line.</strong>
I changed the crontab entry to
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
<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]
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

brokentongue wrote:Thanks

I checked your link and added a new crontab entry

Code: Select all

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
brokentongue
Posts: 5
Joined: Sat Jan 26, 2008 5:14 pm

Post by brokentongue »

Thank you. It's working now. :D

Maybe this will help someone.

I didn't have cron running. To check to see if cron is running enter the command

Code: Select all

ps aux | grep crond
You should get 2 lines
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: Select all

/etc/rc.d/init.d/crond start 
Last edited by brokentongue on Sat Feb 02, 2008 6:13 pm, edited 1 time in total.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

I've added this hint to the HowTo
Reinhard
lipos
Posts: 31
Joined: Thu Jul 24, 2008 3:47 am

Post by lipos »

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: Select all

*/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??
lipos
Posts: 31
Joined: Thu Jul 24, 2008 3:47 am

Post by lipos »

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...
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest