|
|
| Author |
Message |
kayalinux
Joined: 31 Oct 2005 Posts: 23
|
Posted: Mon Dec 19, 2005 9:57 am Post subject: 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.
| Description: |
| Sample of TCP and HTTP Response Time. |
|
| Filesize: |
14.67 KB |
| Viewed: |
23118 Time(s) |

|
| Description: |
Perl Scripts to put in your cacti's scripts directory:
http_response_time.pl
tcp_response_time.pl |
|
 Download |
| Filename: |
scripts.zip |
| Filesize: |
2.32 KB |
| Downloaded: |
3621 Time(s) |
| Description: |
| TCP Response Time XML Template |
|
 Download |
| Filename: |
cacti_graph_template_tcp_response_time.xml |
| Filesize: |
7.41 KB |
| Downloaded: |
3563 Time(s) |
| Description: |
| HTTP Response Time XML Template |
|
 Download |
| Filename: |
cacti_graph_template_http_response_time.xml |
| Filesize: |
7.3 KB |
| Downloaded: |
2879 Time(s) |
|
|
| Back to top |
|
 |
macindy
Joined: 11 Feb 2006 Posts: 8
|
Posted: Wed Feb 15, 2006 8:57 am Post subject: |
|
|
Thank you for your scripts! Great stuff.
In my stats are often gaps - can I do something against it?
| Description: |
|
| Filesize: |
16.03 KB |
| Viewed: |
22587 Time(s) |

|
|
|
| Back to top |
|
 |
nahun Cacti User
Joined: 15 Feb 2006 Posts: 92 Location: Idaho
|
Posted: Thu Feb 16, 2006 12:18 am Post subject: |
|
|
| is the latency being reported the average latency or the current latency from the latest poll on both the TCP and HTTP scripts?
|
|
| Back to top |
|
 |
cigamit Developer
Joined: 07 Apr 2005 Posts: 978 Location: B/CS Texas
|
Posted: Thu Feb 16, 2006 12:59 am Post subject: |
|
|
| 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!!).
|
|
| Back to top |
|
 |
indee
Joined: 27 Feb 2006 Posts: 6
|
Posted: Sun Apr 09, 2006 10:22 am Post subject: |
|
|
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
|
|
| Back to top |
|
 |
ahardman
Joined: 10 Apr 2006 Posts: 41
|
Posted: Tue May 09, 2006 11:51 am Post subject: 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
|
|
| Back to top |
|
 |
gandalf Developer
Joined: 02 Dec 2004 Posts: 12604 Location: Muenster, Germany
|
Posted: Tue May 09, 2006 3:00 pm Post subject: |
|
|
Latest cactid requires /full/path/to/perl for the Data Input Methods. Please try this and Clear Poller Cache afterwards
Reinhard
|
|
| Back to top |
|
 |
ahardman
Joined: 10 Apr 2006 Posts: 41
|
Posted: Tue May 09, 2006 3:49 pm Post subject: That was it |
|
|
| The perl script was the problem Thanks
|
|
| Back to top |
|
 |
morrowd
Joined: 16 Feb 2005 Posts: 9 Location: London, Ontario, Canada
|
|
| Back to top |
|
 |
gandalf Developer
Joined: 02 Dec 2004 Posts: 12604 Location: Muenster, Germany
|
Posted: Wed May 24, 2006 11:27 am Post subject: |
|
|
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
|
|
| Back to top |
|
 |
fla_roadkill
Joined: 19 Jan 2005 Posts: 31
|
Posted: Thu Aug 10, 2006 1:31 pm Post subject: |
|
|
| Could someone post a modified script that show's how to use the URL and PORT? Thanks!
|
|
| Back to top |
|
 |
parkynz
Joined: 03 May 2007 Posts: 6
|
Posted: Wed May 09, 2007 10:29 am Post subject: 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.
|
|
| Back to top |
|
 |
guy2006
Joined: 10 Jun 2008 Posts: 3
|
Posted: Tue Jun 10, 2008 4:46 am Post subject: My graph template for this data source |
|
|
my template with min, max,last & avg
| Description: |
|
| Filesize: |
40.99 KB |
| Viewed: |
8216 Time(s) |

|
| Description: |
|
 Download |
| Filename: |
cacti_graph_template_http_response_time12.xml |
| Filesize: |
10.37 KB |
| Downloaded: |
277 Time(s) |
|
|
| Back to top |
|
 |
rwhittaker
Joined: 06 May 2008 Posts: 4
|
Posted: Tue Jun 10, 2008 1:12 pm Post subject: 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.
|
|
| Back to top |
|
 |
guy2006
Joined: 10 Jun 2008 Posts: 3
|
Posted: Wed Jun 11, 2008 7:24 am Post subject: 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.
| Description: |
|
| Filesize: |
31.26 KB |
| Viewed: |
7938 Time(s) |

|
| Description: |
|
 Download |
| Filename: |
cacti_graph_template_http_response_time_nrpe.xml |
| Filesize: |
10.07 KB |
| Downloaded: |
506 Time(s) |
| Description: |
|
 Download |
| Filename: |
scripts.zip |
| Filesize: |
44.54 KB |
| Downloaded: |
456 Time(s) |
|
|
| Back to top |
|
 |
|