Ad blocker detected: Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker on our website.
Post general support questions here that do not specifically fall into the Linux or Windows categories.
Moderators: Developers , Moderators
lorell
Posts: 20 Joined: Wed Nov 23, 2005 1:40 pm
Post
by lorell » Wed Nov 23, 2005 5:46 pm
crontab simulation:
[root@mpc ~]# su cactiuser
[cactiuser@mpc root]$ php /var/www/html/cacti/poller.php
OK u:0.00 s:0.01 r:1.03
OK u:0.00 s:0.01 r:1.03
OK u:0.00 s:0.01 r:1.03
OK u:0.00 s:0.01 r:1.03
OK u:0.00 s:0.01 r:1.03
OK u:0.00 s:0.01 r:1.03
OK u:0.00 s:0.01 r:1.03
OK u:0.00 s:0.01 r:1.03
OK u:0.00 s:0.01 r:1.03
OK u:0.00 s:0.01 r:1.04
OK u:0.00 s:0.01 r:1.04
OK u:0.00 s:0.01 r:1.04
OK u:0.00 s:0.01 r:1.04
OK u:0.00 s:0.01 r:2.06
OK u:0.00 s:0.01 r:2.06
OK u:0.00 s:0.01 r:2.06
OK u:0.00 s:0.01 r:2.06
OK u:0.00 s:0.01 r:2.06
OK u:0.00 s:0.01 r:2.06
Content-type: text/html
X-Powered-By: PHP/4.3.9
11/23/2005 04:39:51 PM - SYSTEM STATS: Time:2.1109 Method:cmd.php Processes:1 Threads:N/A Hosts:8 HostsPerProcess:8 DataSources:29 RRDsProcessed:19
[cactiuser@mpc root]$
Here's the line in crontab -u root -e:
*/1 * * * * cactiuser php /var/www/html/cacti/poller.php >> /tmp/polleroutput.txt
I set it to 1 minute instead of 5 minutes so I wouldn't have to wait as long.
The /tmp/polleroutput.txt is created but is empty.
[root@mpc tmp]# ls -l /tmp/polleroutput.txt
-rw-r--r-- 1 root root 0 Nov 23 16:44 /tmp/polleroutput.txt
TheWitness
Developer
Posts: 17047 Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:
Post
by TheWitness » Wed Nov 23, 2005 6:49 pm
Provide the full path to PHP in your cron job. Instead of ">>", use ">".
TheWtiness
lorell
Posts: 20 Joined: Wed Nov 23, 2005 1:40 pm
Post
by lorell » Mon Dec 05, 2005 5:17 pm
Done. Now we play the waiting game!
This is what is output when run from command line as root:
OK u:0.01 s:0.00 r:1.05
OK u:0.02 s:0.01 r:1.07
OK u:0.03 s:0.01 r:1.09
OK u:0.06 s:0.01 r:1.12
OK u:0.07 s:0.01 r:1.13
OK u:0.08 s:0.01 r:1.14
OK u:0.10 s:0.01 r:1.16
OK u:0.12 s:0.01 r:1.25
OK u:0.13 s:0.01 r:1.26
OK u:0.14 s:0.01 r:1.30
OK u:0.15 s:0.01 r:1.34
OK u:0.16 s:0.01 r:2.07
OK u:0.18 s:0.01 r:2.10
OK u:0.20 s:0.02 r:2.13
OK u:0.22 s:0.02 r:2.16
Content-type: text/html^M
X-Powered-By: PHP/4.3.9^M
^M
12/05/2005 04:15:46 PM - SYSTEM STATS: Time:3.2253 Method:cmd.php Processes:1 Threads:N/A Hosts:8 HostsPerProcess:8 DataSources:29 RRDsProcessed:19
OK u:0.24 s:0.02 r:3.09
OK u:0.26 s:0.02 r:3.11
OK u:0.28 s:0.02 r:3.17
OK u:0.30 s:0.02 r:3.21
I'll upload when crontab runs it as well.
lorell
Posts: 20 Joined: Wed Nov 23, 2005 1:40 pm
Post
by lorell » Mon Dec 05, 2005 5:18 pm
crontab posts a completely blank file!
Aargh! Back to the drawing board.
[root@mpc tmp]# ls -l | grep poller
-rw-r--r-- 1 root root 0 Dec 5 16:18 polleroutput.txt
lorell
Posts: 20 Joined: Wed Nov 23, 2005 1:40 pm
Post
by lorell » Mon Dec 05, 2005 5:41 pm
Well, as the savvy reader can tell, I created my own permissions problem. After I got that figured out, the polleroutput.txt file was still 0 bytes:
-rw-r--r-- 1 cactiuser cactiuser 0 Dec 5 16:40 polleroutput.txt
Each minute (as per my crontab file) it re-creates a zero byte /tmp/polleroutput.txt file.
lorell
Posts: 20 Joined: Wed Nov 23, 2005 1:40 pm
Post
by lorell » Mon Dec 05, 2005 5:43 pm
When I su'ed to cactiuser, and ran the script manually, the /tmp/polleroutput.txt file was created. It contained this:
OK u:0.00 s:0.00 r:1.03
OK u:0.00 s:0.00 r:1.06
OK u:0.00 s:0.00 r:1.06
OK u:0.00 s:0.00 r:1.07
OK u:0.00 s:0.00 r:1.07
OK u:0.00 s:0.00 r:1.07
OK u:0.00 s:0.01 r:1.08
OK u:0.00 s:0.01 r:1.14
OK u:0.00 s:0.01 r:1.15
OK u:0.00 s:0.01 r:1.15
OK u:0.00 s:0.01 r:1.15
OK u:0.00 s:0.01 r:2.04
OK u:0.00 s:0.01 r:2.04
OK u:0.00 s:0.01 r:2.05
OK u:0.00 s:0.02 r:2.06
Content-type: text/html^M
X-Powered-By: PHP/4.3.9^M
^M
12/05/2005 04:42:35 PM - SYSTEM STATS: Time:3.1465 Method:cmd.php Processes:1 Threads:N/A Hosts:8 HostsPerProcess:8 DataSources:29 RRDsProcessed:19
OK u:0.01 s:0.02 r:3.05
OK u:0.01 s:0.02 r:3.06
OK u:0.01 s:0.02 r:3.06
OK u:0.01 s:0.02 r:3.06
What is this supposed to look like?
lorell
Posts: 20 Joined: Wed Nov 23, 2005 1:40 pm
Post
by lorell » Mon Dec 05, 2005 5:45 pm
This is what my line in crontab -u root -e looks like:
*/1 * * * * cactiuser /usr/bin/php /var/www/html/cacti/poller.php > /tmp/polleroutput.txt
The proceeding */1 says to run every minute instead of every five minutes like cacti should run. I did this to decrease the amount of time I have to spend troubleshooting the problem.
lorell
Posts: 20 Joined: Wed Nov 23, 2005 1:40 pm
Post
by lorell » Tue Dec 20, 2005 1:51 pm
ping - anyone out there?
gandalf
Developer
Posts: 22383 Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:
Post
by gandalf » Tue Dec 20, 2005 1:56 pm
Please set logging level to DEBUG (Settings!). And redirect error output to same file (2>&1)
Reinhard
lorell
Posts: 20 Joined: Wed Nov 23, 2005 1:40 pm
Post
by lorell » Thu Dec 29, 2005 4:56 pm
Here's the line in crontab to execute poller.php:
crontab -u root -e
* * * * * cactiuser /usr/bin/php /var/www/html/cacti/poller.php > /tmp/polleroutput.txt
But it does not seem to be running
Every minute it is running (for testing purposes.) Here's the listing of /tmp/polleroutput.txt:
ls -l /tmp/poller*
-rw-r--r-- 1 root root 0 Dec 29 15:53 /tmp/polleroutput.txt
BUT when I run it as root from the command line, I get this:
-rw-r--r-- 1 root root 3911 Dec 29 15:54 polleroutput.txt
and the contents look normal:
# cat polleroutput.txt
Content-type: text/html
X-Powered-By: PHP/4.3.9
12/29/2005 03:55:19 PM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: /usr/bin/php, ARGS: -q /var/www/html/cacti/cmd.php 0 9]
Waiting on 1/1 pollers.
Waiting on 1/1 pollers.
12/29/2005 03:55:20 PM - POLLER: Poller[0] Parsed MULTI output field '1min:0.10' [map 1min->load_1min]
12/29/2005 03:55:20 PM - POLLER: Poller[0] Parsed MULTI output field '5min:0.27' [map 5min->load_5min]
12/29/2005 03:55:20 PM - POLLER: Poller[0] Parsed MULTI output field '10min:0.23' [map 10min->load_15min]
12/29/2005 03:55:20 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/cacti/rra/random_number_48.rrd --template random_number 1135893320:0
OK u:0.00 s:0.01 r:1.02
12/29/2005 03:55:20 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/cacti/rra/localhost_mem_buffers_3.rrd --template mem_buffers 1135893320:5912
OK u:0.00 s:0.01 r:1.02
12/29/2005 03:55:20 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/cacti/rra/localhost_mem_swap_4.rrd --template mem_swap 1135893320:917488
OK u:0.00 s:0.01 r:1.02
12/29/2005 03:55:20 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/cacti/rra/localhost_load_1min_5.rrd --template load_1min:load_5min:load_15min 1135893320:0.10:0.27:0.23
OK u:0.00 s:0.01 r:1.02
12/29/2005 03:55:20 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/cacti/rra/localhost_users_6.rrd --template users 1135893320:5
OK u:0.00 s:0.01 r:1.02
12/29/2005 03:55:20 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/cacti/rra/localhost_proc_7.rrd --template proc 1135893320:131
OK u:0.00 s:0.01 r:1.02
Waiting on 1/1 pollers.
Waiting on 1/1 pollers.
12/29/2005 03:55:22 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/cacti/rra/wireless_ap_traffic_in_37.rrd --template traffic_out:traffic_in 1135893320:294626950:30296030
12/29/2005 03:55:22 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/cacti/rra/wireless_ap_traffic_in_38.rrd --template traffic_out:traffic_in 1135893320:31301247:294499999
OK u:0.00 s:0.01 r:3.04
OK u:0.00 s:0.01 r:3.04
12/29/2005 03:55:23 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/cacti/rra/wireless_sm_traffic_in_40.rrd --template traffic_out:traffic_in 1135893320:294399422:30405610
OK u:0.00 s:0.01 r:4.06
12/29/2005 03:55:23 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/cacti/rra/wireless_sm_traffic_in_39.rrd --template traffic_in:traffic_out 1135893320:399120591:28124536
OK u:0.00 s:0.01 r:4.06
12/29/2005 03:55:23 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/cacti/rra/encoder_traffic_in_41.rrd --template traffic_in:traffic_out 1135893320:0:0
OK u:0.00 s:0.01 r:4.06
12/29/2005 03:55:23 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/cacti/rra/encoder_traffic_in_42.rrd --template traffic_in:traffic_out 1135893320:2098158:137177624
OK u:0.00 s:0.01 r:4.06
12/29/2005 03:55:23 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/cacti/rra/decoder_traffic_in_43.rrd --template traffic_in:traffic_out 1135893320:0:0
OK u:0.00 s:0.01 r:4.06
12/29/2005 03:55:23 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/cacti/rra/decoder_traffic_in_44.rrd --template traffic_in:traffic_out 1135893320:4077936907:6370647
OK u:0.00 s:0.01 r:4.06
12/29/2005 03:55:23 PM - SYSTEM STATS: Time:4.0961 Method:cmd.php Processes:1 Threads:N/A Hosts:8 HostsPerProcess:8 DataSources:29 RRDsProcessed:14
12/29/2005 03:55:23 PM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: /usr/bin/php, ARGS: -q /var/www/html/cacti/poller_commands.php]
12/29/2005 03:55:24 PM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: /usr/bin/php, ARGS: -q /var/www/html/cacti/poller_export.php]
For some reason crontab is not executing properly. Right? Thoughts?
gandalf
Developer
Posts: 22383 Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:
Post
by gandalf » Fri Dec 30, 2005 10:21 am
lorell wrote: Here's the line in crontab to execute poller.php:
crontab -u root -e
* * * * * cactiuser /usr/bin/php /var/www/html/cacti/poller.php > /tmp/polleroutput.txt
Please have again a precise look at your crontab and compare to mine
Code: Select all
*/5 * * * * cactiuser /usr/bin/php /var/www/html/cacti/poller.php > /var/www/html/cacti/log/poller.log 2>&1
Reinhard
Users browsing this forum: No registered users and 3 guests