Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


TCP & HTTP Server Response Time: Script & Templates
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
kayalinux



Joined: 31 Oct 2005
Posts: 23

PostPosted: Mon Dec 19, 2005 9:57 am    Post subject: TCP & HTTP Server Response Time: Script & Templates Reply with quote

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.



Response_time.png
 Description:
Sample of TCP and HTTP Response Time.
 Filesize:  14.67 KB
 Viewed:  23118 Time(s)

Response_time.png



scripts.zip
 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)


cacti_graph_template_tcp_response_time.xml
 Description:
TCP Response Time XML Template

Download
 Filename:  cacti_graph_template_tcp_response_time.xml
 Filesize:  7.41 KB
 Downloaded:  3563 Time(s)


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

PostPosted: Wed Feb 15, 2006 8:57 am    Post subject: Reply with quote

Thank you for your scripts! Great stuff.

In my stats are often gaps - can I do something against it?



graph_image.php.gif
 Description:
 Filesize:  16.03 KB
 Viewed:  22587 Time(s)

graph_image.php.gif


Back to top
nahun
Cacti User


Joined: 15 Feb 2006
Posts: 92
Location: Idaho

PostPosted: Thu Feb 16, 2006 12:18 am    Post subject: Reply with quote

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

PostPosted: Thu Feb 16, 2006 12:59 am    Post subject: Reply with quote

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

PostPosted: Sun Apr 09, 2006 10:22 am    Post subject: Reply with quote

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

PostPosted: Tue May 09, 2006 11:51 am    Post subject: Getting error in script Reply with quote

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

PostPosted: Tue May 09, 2006 3:00 pm    Post subject: Reply with quote

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

PostPosted: Tue May 09, 2006 3:49 pm    Post subject: That was it Reply with quote

The perl script was the problem Thanks
Back to top
morrowd



Joined: 16 Feb 2005
Posts: 9
Location: London, Ontario, Canada

PostPosted: Tue May 23, 2006 10:35 am    Post subject: Reply with quote

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

ex. http://www.mydomain.com/folder/mytest.htm
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12604
Location: Muenster, Germany

PostPosted: Wed May 24, 2006 11:27 am    Post subject: Reply with quote

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

PostPosted: Thu Aug 10, 2006 1:31 pm    Post subject: Reply with quote

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

PostPosted: Wed May 09, 2007 10:29 am    Post subject: DNS resolution time included... Reply with quote

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

PostPosted: Tue Jun 10, 2008 4:46 am    Post subject: My graph template for this data source Reply with quote

my template with min, max,last & avg


graph_image.png
 Description:
 Filesize:  40.99 KB
 Viewed:  8216 Time(s)

graph_image.png



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

PostPosted: Tue Jun 10, 2008 1:12 pm    Post subject: Proxy servers Reply with quote

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

PostPosted: Wed Jun 11, 2008 7:24 am    Post subject: new script & tempate Reply with quote

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.



graph_image2.png
 Description:
 Filesize:  31.26 KB
 Viewed:  7938 Time(s)

graph_image2.png



cacti_graph_template_http_response_time_nrpe.xml
 Description:

Download
 Filename:  cacti_graph_template_http_response_time_nrpe.xml
 Filesize:  10.07 KB
 Downloaded:  506 Time(s)


scripts.zip
 Description:

Download
 Filename:  scripts.zip
 Filesize:  44.54 KB
 Downloaded:  456 Time(s)

Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 



Powered by phpBB © 2001, 2005 phpBB Group