Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Sun May 19, 2019 10:37 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 45 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: TCP & HTTP Server Response Time: Script & Templates
PostPosted: Mon Dec 19, 2005 9:57 am 
Offline

Joined: Mon Oct 31, 2005 4:38 am
Posts: 23
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:
File comment: Perl Scripts to put in your cacti's scripts directory:
http_response_time.pl
tcp_response_time.pl

scripts.zip [2.32 KiB]
Downloaded 10980 times
File comment: Sample of TCP and HTTP Response Time.
Response_time.png
Response_time.png [ 14.67 KiB | Viewed 91883 times ]
File comment: TCP Response Time XML Template
cacti_graph_template_tcp_response_time.xml [7.41 KiB]
Downloaded 10883 times
File comment: HTTP Response Time XML Template
cacti_graph_template_http_response_time.xml [7.3 KiB]
Downloaded 8620 times
Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 8:57 am 
Offline

Joined: Sat Feb 11, 2006 11:50 am
Posts: 8
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 91352 times ]
Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 16, 2006 12:18 am 
Offline
Cacti User
User avatar

Joined: Wed Feb 15, 2006 11:27 pm
Posts: 92
Location: Idaho
is the latency being reported the average latency or the current latency from the latest poll on both the TCP and HTTP scripts?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 16, 2006 12:59 am 
Offline
Developer

Joined: Thu Apr 07, 2005 3:29 pm
Posts: 2750
Location: B/CS Texas
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!!).

_________________
Report a bug
Download Releases
1.X Compatible Plugins


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 09, 2006 10:22 am 
Offline

Joined: Mon Feb 27, 2006 9:19 am
Posts: 6
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


Top
 Profile  
 
 Post subject: Getting error in script
PostPosted: Tue May 09, 2006 11:51 am 
Offline

Joined: Mon Apr 10, 2006 2:54 pm
Posts: 41
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


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 09, 2006 3:00 pm 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22376
Location: Muenster, Germany
Latest cactid requires /full/path/to/perl for the Data Input Methods. Please try this and Clear Poller Cache afterwards
Reinhard

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject: That was it
PostPosted: Tue May 09, 2006 3:49 pm 
Offline

Joined: Mon Apr 10, 2006 2:54 pm
Posts: 41
The perl script was the problem Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 23, 2006 10:35 am 
Offline

Joined: Wed Feb 16, 2005 11:49 am
Posts: 9
Location: London, Ontario, Canada
How would I use this script to monitor something other than the root of the website?

ex. http://www.mydomain.com/folder/mytest.htm


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 24, 2006 11:27 am 
Offline
Developer
User avatar

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

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 10, 2006 1:31 pm 
Offline

Joined: Wed Jan 19, 2005 2:34 pm
Posts: 31
Could someone post a modified script that show's how to use the URL and PORT? Thanks!


Top
 Profile  
 
 Post subject: DNS resolution time included...
PostPosted: Wed May 09, 2007 10:29 am 
Offline

Joined: Thu May 03, 2007 12:06 am
Posts: 6
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.


Top
 Profile  
 
 Post subject: My graph template for this data source
PostPosted: Tue Jun 10, 2008 4:46 am 
Offline

Joined: Tue Jun 10, 2008 4:25 am
Posts: 3
my template with min, max,last & avg


Attachments:
graph_image.png
graph_image.png [ 40.99 KiB | Viewed 76982 times ]
cacti_graph_template_http_response_time12.xml [10.37 KiB]
Downloaded 2652 times
Top
 Profile  
 
 Post subject: Proxy servers
PostPosted: Tue Jun 10, 2008 1:12 pm 
Offline

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

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

Thanks,
Richard.


Top
 Profile  
 
 Post subject: new script & tempate
PostPosted: Wed Jun 11, 2008 7:24 am 
Offline

Joined: Tue Jun 10, 2008 4:25 am
Posts: 3
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 76704 times ]
cacti_graph_template_http_response_time_nrpe.xml [10.07 KiB]
Downloaded 4308 times
scripts.zip [44.54 KiB]
Downloaded 4560 times
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 45 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group