TCP & HTTP Server Response Time: Script & Templates

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

Moderators: Developers, Moderators

kayalinux
Posts: 23
Joined: Mon Oct 31, 2005 4:38 am

TCP & HTTP Server Response Time: Script & Templates

Post by kayalinux »

Here is a another contribution.

I implemented TCPResponseTime and HTTPResponseTime to measure the response times of aTCP port and of HTTP web page. The Perl script launches queries repeatedly.

Upon import, the attached .XML file will create both a Data Template and a Graph Template called "TCP Response Time" "HTTP Response Time" for Data Source, as well as a Data Input Method with the same name.

The Graph Template as no special features see attached screenshot.

In order to install it:
1) import xml files
2) copy perl script to the cacti's scripts directory.
Attachments
cacti_graph_template_http_response_time.xml
HTTP Response Time XML Template
(7.3 KiB) Downloaded 9172 times
cacti_graph_template_tcp_response_time.xml
TCP Response Time XML Template
(7.41 KiB) Downloaded 11367 times
Sample of TCP and HTTP Response Time.
Sample of TCP and HTTP Response Time.
Response_time.png (14.67 KiB) Viewed 100193 times
scripts.zip
Perl Scripts to put in your cacti's scripts directory:
http_response_time.pl
tcp_response_time.pl
(2.32 KiB) Downloaded 11592 times
macindy
Posts: 8
Joined: Sat Feb 11, 2006 11:50 am

Post by macindy »

Thank you for your scripts! Great stuff.

In my stats are often gaps - can I do something against it?
Attachments
graph_image.php.gif
graph_image.php.gif (16.03 KiB) Viewed 99662 times
User avatar
nahun
Cacti User
Posts: 92
Joined: Wed Feb 15, 2006 11:27 pm
Location: Idaho
Contact:

Post by nahun »

is the latency being reported the average latency or the current latency from the latest poll on both the TCP and HTTP scripts?
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

macindy wrote:Thank you for your scripts! Great stuff.

In my stats are often gaps - can I do something against it?
Seems that it has a default timeout of 500ms. I haven't tested this, but I ran acroos a note on google about it.

Give this a try, open http_response_time.pl

find this line
my $s = Net::HTTP->new(Host => $host) || die $@;

and change it to this
my $s = Net::HTTP->new(Host => $host, timeout=>10) || die $@;

and see if that fixes it for you (no promises!!).
indee
Posts: 6
Joined: Mon Feb 27, 2006 9:19 am

Post by indee »

hi,

first of all thanks.

I got the graph for tcp response, bit problem is with the HTTP response, there is no output (line etc).

strange! here is my setup

cacti 0.8h with architecture plugins from (cactisusers.org) on FC 4.

thanks in advance.

Indee
ahardman
Posts: 41
Joined: Mon Apr 10, 2006 2:54 pm

Getting error in script

Post by ahardman »

I get the following when I use the script.

05/09/2006 12:47:03 PM - CACTID: Poller[0] Host[11] DS[2641] SCRIPT: perl /www/htdocs/cacti/scripts/tcp_response_time.pl 64.233.167.147 80, output: U
05/09/2006 12:47:03 PM - CACTID: Poller[0] Host[11] DS[2641] WARNING: Result from SCRIPT not valid. Partial Result: ...

I seems that the result is not in the right format.

Any ideas

The script returns a result in the form avg:### when run from the command line on the server
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Latest cactid requires /full/path/to/perl for the Data Input Methods. Please try this and Clear Poller Cache afterwards
Reinhard
ahardman
Posts: 41
Joined: Mon Apr 10, 2006 2:54 pm

That was it

Post by ahardman »

The perl script was the problem Thanks
morrowd
Posts: 9
Joined: Wed Feb 16, 2005 11:49 am
Location: London, Ontario, Canada

Post by morrowd »

How would I use this script to monitor something other than the root of the website?

ex. http://www.mydomain.com/folder/mytest.htm
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Take a look e.g. at the http script. You may provide 2 further parms, http_port and url (use them in the write_request statement). Then, you have to change the Data Input Method and add these two parms as input parms as well. Last, the Data Template should hold defaults for this new input parms, e.g. 80 as http_prort and "/" as url. Check the Use Per-Data Source Value (Ignore this Value) under Custom Data to be able to supply new input parms for each graph to be created.
Reinhard
fla_roadkill
Posts: 31
Joined: Wed Jan 19, 2005 2:34 pm

Post by fla_roadkill »

Could someone post a modified script that show's how to use the URL and PORT? Thanks!
parkynz
Posts: 6
Joined: Thu May 03, 2007 12:06 am

DNS resolution time included...

Post by parkynz »

Hi, nice template - thanks, but the latency reported includes the time taken for the client (perl script) to resolve the server's DNS name and is not really relevant when just looking at the response time of the http server itself. Can be worked around by using local hosts file (on windows) but I'm sure a perl DNS resolution of the host before capturing the start time would be smarter?

If you run a caching DNS client then no problem really but that's not always the case.

Or am I missing something here since I'm a newbie..?

cheers.
~Andy.
guy2006
Posts: 3
Joined: Tue Jun 10, 2008 4:25 am

My graph template for this data source

Post by guy2006 »

my template with min, max,last & avg
Attachments
graph_image.png
graph_image.png (40.99 KiB) Viewed 85292 times
cacti_graph_template_http_response_time12.xml
(10.37 KiB) Downloaded 3015 times
rwhittaker
Posts: 4
Joined: Tue May 06, 2008 6:13 pm

Proxy servers

Post by rwhittaker »

Question:

How will this script behave with relation to proxy servers?... Is there any way to "force" the script to use one?...

Thanks,
Richard.
guy2006
Posts: 3
Joined: Tue Jun 10, 2008 4:25 am

new script & tempate

Post by guy2006 »

I made new script & tempate because the first one is not realy mesure the time till the GET request is finished.

the new script is based on nagios plugin check_http with the follow option so the time reflaced in the graph is the time taken for the page to load

copy the scripts check_http & nrpe_http to the cacti scrips directory.
Import the graph templates.
Attachments
graph_image2.png
graph_image2.png (31.26 KiB) Viewed 85014 times
scripts.zip
(44.54 KiB) Downloaded 4854 times
cacti_graph_template_http_response_time_nrpe.xml
(10.07 KiB) Downloaded 4786 times
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests