TCP & HTTP Server Response Time: Script & Templates
Moderators: Developers, Moderators
TCP & HTTP Server Response Time: Script & Templates
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.
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 9171 times
-
- cacti_graph_template_tcp_response_time.xml
- TCP Response Time XML Template
- (7.41 KiB) Downloaded 11365 times
-
- Sample of TCP and HTTP Response Time.
- Response_time.png (14.67 KiB) Viewed 100187 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 11591 times
Seems that it has a default timeout of 500ms. I haven't tested this, but I ran acroos a note on google about it.macindy wrote:Thank you for your scripts! Great stuff.
In my stats are often gaps - can I do something against 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!!).
Getting error in script
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
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
That was it
The perl script was the problem Thanks
How would I use this script to monitor something other than the root of the website?
ex. http://www.mydomain.com/folder/mytest.htm
ex. http://www.mydomain.com/folder/mytest.htm
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
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
Reinhard
-
- Posts: 31
- Joined: Wed Jan 19, 2005 2:34 pm
DNS resolution time included...
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.
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.
My graph template for this data source
my template with min, max,last & avg
- Attachments
-
- graph_image.png (40.99 KiB) Viewed 85286 times
-
- cacti_graph_template_http_response_time12.xml
- (10.37 KiB) Downloaded 3015 times
-
- Posts: 4
- Joined: Tue May 06, 2008 6:13 pm
Proxy servers
Question:
How will this script behave with relation to proxy servers?... Is there any way to "force" the script to use one?...
Thanks,
Richard.
How will this script behave with relation to proxy servers?... Is there any way to "force" the script to use one?...
Thanks,
Richard.
new script & tempate
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.
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 (31.26 KiB) Viewed 85008 times
-
- scripts.zip
- (44.54 KiB) Downloaded 4853 times
-
- cacti_graph_template_http_response_time_nrpe.xml
- (10.07 KiB) Downloaded 4786 times
Who is online
Users browsing this forum: No registered users and 10 guests