Page Load Time Script Woes

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
ghostmonk
Posts: 3
Joined: Mon Jan 10, 2011 5:22 pm

Page Load Time Script Woes

Post by ghostmonk »

Okay, so I've been working on this for several days and I just can't seem to figure out what I'm doing wrong. I'm attempting to use the following article's script to get an idea of page load times:
http://www.askaboutphp.com/44/cacti-usi ... art-1.html

This script takes a URL as input and outputs similar to the following as follows:
dns:0.130177 con:0.242694 pre:0.242797 str:1.129853 ttl:1.513351 sze:27398 spd:18104

Where each space-separated value is a different aspect of the loading of a web page that I'd like to capture. I know that the script works as I've run it myself using Perl with the following command:
sudo -u cacti /usr/bin/perl /var/www/cacti/scripts/pageload/pageload-agent.php www.URL-TO-TEST.com

and php:
sudo -u cacti php /var/www/cacti/scripts/pageload/pageload-agent.php www.URL-TO-TEST.com

Both commands complete successfully.

I've created the Data Input Method as both a Script/Command using:
/usr/bin/perl /var/www/cacti/scripts/pageload/pageload-agent.php <url>

and (when the above didn't work) as a Script Server using:
/var/www/cacti/scripts/pageload/pageload-agent.php <url>

The DS ID is 101. When running via the Script/Command I get the following in the Cacti log:
01/10/2011 10:50:03 PM - CMDPHP: Poller[0] Host[0] DS[101] WARNING: Result from CMD not valid. Partial Result: U

When running under Script Server I get the following in the Cacti log:
01/10/2011 10:35:01 PM - POLLER: Poller[0] WARNING: Poller Output Table not Empty. Issues Found: 1, Data Sources: (DS[101])

For the life of me I can't get this to graph. I've worked on this for several hours and I'm really not sure what else to try. Any help is much appreciated. I've followed the article to the letter (several times) and I've tried changing multiple parameters but to no avail. If I get this resolved I promise I'll write up a procedure so that others won't have to go through this.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Page Load Time Script Woes

Post by gandalf »

I'm wondering how you made perl execute php scripts.
Apart from that, please see 2nd link of my sig
R.
ghostmonk
Posts: 3
Joined: Mon Jan 10, 2011 5:22 pm

Re: Page Load Time Script Woes

Post by ghostmonk »

I must be as magical as your namesake. It absolutely does indeed work though:

Code: Select all

[root@babb ~]# sudo -u cacti /usr/bin/perl /var/www/cacti/scripts/pageload/pageload-agent.php www.google.com

dns:0.002254 con:0.003961 pre:0.004014 str:0.034697 ttl:0.036397 sze:6403 spd:175921
[root@babb ~]# 
I've now been able to get this working, using Perl. The problem was that I put this script outside of the scripts folder, which it say in the original instructions is just fine to do. Evidently not. Now it's working mostly okay. I've got gaps in my records but that's probably for another thread.

Long story short: use the above article and put the related scripts in the scripts directory and you're off to the races.
Aikidoka
Posts: 5
Joined: Mon Nov 21, 2011 9:28 am

Re: Page Load Time Script Woes

Post by Aikidoka »

Hi,
I've been having similar problems - but reducing the number of pollers to 1 fixed it for me.

I have a different problem:
using the details from:
http://www.askaboutphp.com/44/cacti-usi ... art-1.html

I have set up the data source with the 7 datasource items - here is the debug output for the datasource:

Code: Select all

/usr/bin/rrdtool create \
/var/lib/cacti/rra/47.rrd \
--step 60  \
DS:con:GAUGE:120:0:U \
DS:dns:GAUGE:120:0:U \
DS:pre:GAUGE:120:0:U \
DS:str:GAUGE:120:0:U \
DS:spd:GAUGE:120:0:U \
DS:sze:GAUGE:120:0:U \
DS:ttl:GAUGE:120:0:U \
RRA:AVERAGE:0.5:6:2000 \
RRA:AVERAGE:0.5:24:1000 \
RRA:AVERAGE:0.5:288:1000 \
RRA:AVERAGE:0.5:1:525600 \
RRA:AVERAGE:0.5:1:2628000 \
RRA:MAX:0.5:6:2000 \
RRA:MAX:0.5:24:1000 \
RRA:MAX:0.5:288:1000 \
RRA:MAX:0.5:1:525600 \
RRA:MAX:0.5:1:2628000 \
When I come to add the graph elements I am able to add "con" but not any of the other items.
Adding "dns" gives me the following debug info:

Code: Select all

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-525600 \
--end=-60 \
--title='Load time for WEBPAGEs' \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label='' \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="/var/lib/cacti/rra/47.rrd":con:AVERAGE \
DEF:b="/var/lib/cacti/rra/47.rrd":dns:AVERAGE \
AREA:a#FF7D00FF:"Connect time\:"  \
AREA:b#FFC3C0FF:"DNS time\:" 
RRDTool Says:

ERROR: No DS called 'dns' in '/var/lib/cacti/rra/47.rrd'
Any ideas why this would be happening?

Has anyone found a better template to use for collecting and graphing the load times for webpages?

Thanks,

Aikidoka
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Page Load Time Script Woes

Post by noname »

Aikidoka wrote:When I come to add the graph elements I am able to add "con" but not any of the other items.
Did you select proper output filed for each datasource items?
See also: http://www.askaboutphp.com/wp-post-images/45/cacti-step7.png
(You should click "Save" button at each tabs)

To see details, perform this:
% rrdtool info /var/lib/cacti/rra/47.rrd
Aikidoka
Posts: 5
Joined: Mon Nov 21, 2011 9:28 am

Re: Page Load Time Script Woes

Post by Aikidoka »

Hi,
Thanks for the reply.

I did set up all the entries as instructed and used save each time. (Attached)
Datasource - Page load
Datasource - Page load
cacti-DS-1.png (17.98 KiB) Viewed 2533 times
Thanks for the command: rrdtool info /var/lib/cacti/rra/47.rrd
This is the output from the command (I can see that there is only details for "con" in the output)

Code: Select all

filename = "/var/lib/cacti/rra/47.rrd"
rrd_version = "0003"
step = 60
last_update = 1321876141
ds[con].type = "GAUGE"
ds[con].minimal_heartbeat = 120
ds[con].min = 0.0000000000e+00
ds[con].max = NaN
ds[con].last_ds = "0.001993"
ds[con].value = 1.9930000000e-03
ds[con].unknown_sec = 0
rra[0].cf = "AVERAGE"
rra[0].rows = 2000
rra[0].cur_row = 1357
rra[0].pdp_per_row = 6
rra[0].xff = 5.0000000000e-01
rra[0].cdp_prep[0].value = 1.9847666667e-03
rra[0].cdp_prep[0].unknown_datapoints = 0
rra[1].cf = "AVERAGE"
rra[1].rows = 1000
rra[1].cur_row = 874
rra[1].pdp_per_row = 24
rra[1].xff = 5.0000000000e-01
rra[1].cdp_prep[0].value = 2.2541300000e-02
rra[1].cdp_prep[0].unknown_datapoints = 0
rra[2].cf = "AVERAGE"
rra[2].rows = 1000
rra[2].cur_row = 857
rra[2].pdp_per_row = 288
rra[2].xff = 5.0000000000e-01
rra[2].cdp_prep[0].value = 4.8064783333e-02
rra[2].cdp_prep[0].unknown_datapoints = 105
rra[3].cf = "AVERAGE"
rra[3].rows = 525600
rra[3].cur_row = 182956
rra[3].pdp_per_row = 1
rra[3].xff = 5.0000000000e-01
rra[3].cdp_prep[0].value = NaN
rra[3].cdp_prep[0].unknown_datapoints = 0
rra[4].cf = "AVERAGE"
rra[4].rows = 2628000
rra[4].cur_row = 1266848
rra[4].pdp_per_row = 1
rra[4].xff = 5.0000000000e-01
rra[4].cdp_prep[0].value = NaN
rra[4].cdp_prep[0].unknown_datapoints = 0
rra[5].cf = "MAX"
rra[5].rows = 2000
rra[5].cur_row = 953
rra[5].pdp_per_row = 6
rra[5].xff = 5.0000000000e-01
rra[5].cdp_prep[0].value = 1.9847666667e-03
rra[5].cdp_prep[0].unknown_datapoints = 0
rra[6].cf = "MAX"
rra[6].rows = 1000
rra[6].cur_row = 331
rra[6].pdp_per_row = 24
rra[6].xff = 5.0000000000e-01
rra[6].cdp_prep[0].value = 1.9847666667e-03
rra[6].cdp_prep[0].unknown_datapoints = 0
rra[7].cf = "MAX"
rra[7].rows = 1000
rra[7].cur_row = 472
rra[7].pdp_per_row = 288
rra[7].xff = 5.0000000000e-01
rra[7].cdp_prep[0].value = 2.2179666667e-03
rra[7].cdp_prep[0].unknown_datapoints = 105
rra[8].cf = "MAX"
rra[8].rows = 525600
rra[8].cur_row = 182500
rra[8].pdp_per_row = 1
rra[8].xff = 5.0000000000e-01
rra[8].cdp_prep[0].value = NaN
rra[8].cdp_prep[0].unknown_datapoints = 0
rra[9].cf = "MAX"
rra[9].rows = 2628000
rra[9].cur_row = 727209
rra[9].pdp_per_row = 1
rra[9].xff = 5.0000000000e-01
rra[9].cdp_prep[0].value = NaN
rra[9].cdp_prep[0].unknown_datapoints = 0
TBH I will probably wipe out all the settings for this and restart from scratch - although queued behind getting WMI working from Linux.

Thanks for the help,

Aikidoka
Aikidoka
Posts: 5
Joined: Mon Nov 21, 2011 9:28 am

Re: Page Load Time Script Woes

Post by Aikidoka »

I found out what the problem is.
In the instructions is doesn't say to use a value in "maximum Value" field.
So I left it as default - 0. :roll:

After using larger numbers everything started to work.
:-)

Sadly I can't get the Speed and size working yet - only get -NAN - but I'm working on it.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest