TCP & HTTP Server Response Time: Script & Templates

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

Moderators: Moderators, Developers

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

TCP & HTTP Server Response Time: Script & Templates

#1 Post by kayalinux » Mon Dec 19, 2005 9:57 am

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 8733 times
cacti_graph_template_tcp_response_time.xml
TCP Response Time XML Template
(7.41 KiB) Downloaded 10983 times
Response_time.png
Sample of TCP and HTTP Response Time.
Response_time.png (14.67 KiB) Viewed 93173 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 11050 times

macindy
Posts: 8
Joined: Sat Feb 11, 2006 11:50 am

#2 Post by macindy » Wed Feb 15, 2006 8:57 am

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 92642 times

User avatar
nahun
Cacti User
Posts: 92
Joined: Wed Feb 15, 2006 11:27 pm
Location: Idaho
Contact:

#3 Post by nahun » Thu Feb 16, 2006 12:18 am

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: 2780
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

#4 Post by cigamit » Thu Feb 16, 2006 12:59 am

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 [email protected];

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

and see if that fixes it for you (no promises!!).

indee
Posts: 6
Joined: Mon Feb 27, 2006 9:19 am

#5 Post by indee » Sun Apr 09, 2006 10:22 am

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

#6 Post by ahardman » Tue May 09, 2006 11:51 am

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: 22375
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

#7 Post by gandalf » Tue May 09, 2006 3:00 pm

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

#8 Post by ahardman » Tue May 09, 2006 3:49 pm

The perl script was the problem Thanks

morrowd
Posts: 9
Joined: Wed Feb 16, 2005 11:49 am
Location: London, Ontario, Canada

#9 Post by morrowd » Tue May 23, 2006 10:35 am

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: 22375
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

#10 Post by gandalf » Wed May 24, 2006 11:27 am

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

#11 Post by fla_roadkill » Thu Aug 10, 2006 1:31 pm

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

#12 Post by parkynz » Wed May 09, 2007 10:29 am

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

#13 Post by guy2006 » Tue Jun 10, 2008 4:46 am

my template with min, max,last & avg
Attachments
graph_image.png
graph_image.png (40.99 KiB) Viewed 78272 times
cacti_graph_template_http_response_time12.xml
(10.37 KiB) Downloaded 2744 times

rwhittaker
Posts: 4
Joined: Tue May 06, 2008 6:13 pm

Proxy servers

#14 Post by rwhittaker » Tue Jun 10, 2008 1:12 pm

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

#15 Post by guy2006 » Wed Jun 11, 2008 7:24 am

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 77994 times
scripts.zip
(44.54 KiB) Downloaded 4600 times
cacti_graph_template_http_response_time_nrpe.xml
(10.07 KiB) Downloaded 4384 times

Post Reply