Cacti: Using Cacti to monitor web page loading - Part 3
Welcome to Part 3 on using Cacti for monitoring of web page loading time. In the previous 2 parts, I walked you through how to install a custom script which will query for the loading time of a web page (Part 1), and how to configure Cacti to start collecting data (Part 2).
In this, and final part, I will cover how to start graphing your data collected within Cacti.
A quick recap
At this stage you should have created a Data Input Method (Step 1):

And, you should have created a Data Source (Step 2):

You should also have left Cacti a bit of time to collect the data so that you have some data points you can use to draw your graph.
Step 3: Creating a Graph
From the menu, choose Graph Management and click ‘Add’ to create a new graph.

At the Graph Template Selection webform, just leave both as ‘None’ and click the ‘Create’ button. You’ll be show a new webform called Graph Configuration. You can pretty much leave all the configuration setting as it is, except the Title field. Just key in a name for this graph you can recognize. Once done, go to the bottom of the page and click ‘Create’.

A new Graph Items table will appear where you can define what will appear in the graph.

Click the ‘Add’ button on the top-right of this table. At this form, you can define which parameter you want to plot onto the graph.

For this example, choose the ‘ttl’ parameter as the data source to plot into the graph. Pick yourself a color to use, and choose the ‘Area’ option to plot an area graph. (You can of course choose to use line graph, or stack graph etc - I’ll leave you to play with it once you get the basics). Lastly, give a title to this plot at the Text Format field.
Once done, click ‘Save’ and you should have a graph showing up (hopefully) as so:

And that’s it! The only thing left now is to get your graph included into the Graph Tree so that it will appear in Cacti’s Graphs tab.
Improving your graphs
If you want, you can go back to Graph Management, and improve your graph with other plots and legends etc. Just keep adding Graph Items for your graph and maybe create a graph such as this:

How to read the graph?
If you look at my graph above, there are a few useful pieces of information you can derive from this.
- It takes on average 391.2ms to complete the whole transaction, from receiving a request for my blog’s homepage until receiving the last byte.
- If I subtract 234.1ms (start transfer) from 391.2ms (total time), I will get 157.1ms, which is the time it takes for the monitoring agent to receive the webpage data. Of course if your monitor is logically far away from your webserver, this number will be larger.
- If I subtract 64.67ms from 234.1ms, I will get 169.43ms. This tells me on average it take 169.43ms for wordpress (which is my ‘CMS’) to compose and build my page.
Although I didn’t plot the ’spd’ parameter, this parameter would be quite useful if you want to monitor the transfer rate between the monitor location and your website hosting location. Plotting this will give you a sense of whether your bandwidth is congested at any point in time. (I’m sure you can get that from monitoring your network device bandwidth too).
There are other things you can do too, like create CDEFs, your own Data, Host, Graph templates to make it easier to create more data sources and graphs. But I’m leaving that for another day.
That’s all folks!
Well, that bring me to the end of this long 3 part tutorial. Thanks for your patience and please feel free to leave comments or questions. Hopefully, this article has been of use to someone.
- Cacti: Using Cacti to monitor web page loading - Part 2
- Cacti: Using Cacti to monitor web page loading - Part 1
- Cacti: Ubuntu 8.04 Cacti Plugin - Invalid PHP_SELF Path problem
- A look at the Google Graph class
- Using XAMPP Lite for PHP scripting






Hoping you have a part 4. I would like to know how to make this templated, so I can add graphs and data per device.
Hi Joe
You may want to check out the Cacti docs on how to create your own templates.
http://docs.cacti.net/node/80
Hello,
I m trying to use this script, I have been followed the tutorial step by step, and the script works fine on prompt line, it allway give me back a result, but in Cacti the graph isnt perfectly, on Cacti it give me some gaps with some parameters (almost all) just the parameter DNS is being graphted, the others some times get a gap… There are no way to increase the perfomance of this graph?
Hi Anderson
Not sure what could be the problem. Have you read these suggestions on debugging Cacti?
http://docs.cacti.net/?q=node/283
The very first thing I would do is to look at the logs. The logs normally will show me the result of the execution of the external script. If the log entries shows proper numbers output from the script, then it’s Cacti being a bit unrealiable.
Hope this helps.
Look, sometimes the poller work perfect.
“11/21/2008 09:57:02 AM - CACTID: Poller[0] Host[0] DS[20] SCRIPT: /usr/bin/php -q /var/www/html/scripts/https/pageload-agent.php http://www.itau.com.br, output: dns:0.015233 con:0.065969 pre:0.197159 str:0.255121 ttl:0.29715 sze:1249 spd:4203″
And other times (where cause the gap) it doesnt work perfect:
“11/21/2008 10:00:02 AM - CACTID: Poller[0] Host[0] DS[20] SCRIPT: /usr/bin/php -q /var/www/html/scripts/https/pageload-agent.php http://www.itau.com.br, output: dns:0.018203″
As you can check, the poller just return the DNS output. Its very strange…
Hi again, I have made some modifications in your script to get a better performance and to return all parameters that I need, I think its working now perfectly.
Add me on msn messenger to discuss about these modifications, I sent you the modifications to post on blog.
I have a question I did Size Download and Speed Download work too, I think Size Download is bytes valor, right?
And Speed Download? Is Byte per second? Kb per second? Mb per second? How can I define it on graph?
My msn (apereira_multirede@yahoo.com)
Thx,
Anderson Pereira.
Hi again, I have a question, when this script load the page, it load all contet page in HTML and all images and other aplications that this page has been running? Its very importante to know, because the total size page that it show for me… is very very little, like 1KB from https://www.itau.com.br
And I think this page is more larger… maybe it load just the HTML content, and not the images.
So? What you think?
Hi admin,
Excellent Tutorial, Is there any tutorial like this for monitoring web page hits, online user’s etc..
Hi Anderson
Sorry, for the late reply. My script only loads the HTML part of the webpage. It doesn’t load all the components. You probably need to modify script to also download all the page components.
Hi Vineeth
Thanks for your feedback. There won’t be such tutorials you mentioned. You can already monitor web page hits by using tools like Google Analytics or any other web stats reporting tool.
awsome !
Hi there,
I followed these instructions step by step, and I am able to generate a graph of repsonse times.
However my Start Transfer time is longer than my Total Time. Any ideas around this oddity?
Hi Travis
This is the first I’ve heard of this. Is it consistently longer than your total time or just the occasional blip?
Anyone else have any ideas?
Webbie.
Hi there,
It seems that the Start Time is longer by about 60% of the time. Is there any where I should start to debug this?
Travis