TCP & HTTP Server Response Time: Script & Templates

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

Moderators: Developers, Moderators

Maher457
Cacti User
Posts: 54
Joined: Thu Jul 29, 2010 3:07 am
Location: Paris France

Post by Maher457 »

I tried ur scripts nrpe but it doen't graph i have this error messahe see photo:

what should i do?
Attachments
cacti.JPG
cacti.JPG (49.36 KiB) Viewed 9145 times
ridhoyp
Posts: 4
Joined: Mon Jul 26, 2010 10:34 pm
Location: indonesia
Contact:

Post by ridhoyp »

/usr/local/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-60 \
--title="WebIntra [172.16.0.4] - HTTP Response Time" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="milliseconds" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="/usr/local/share/cacti/rra/webintra_172_16_0_4_avg_723.rrd":avg:LAST \
DEF:b="/usr/local/share/cacti/rra/webintra_172_16_0_4_avg_723.rrd":avg:AVERAGE \
LINE1:a#4668E4FF:"" \
COMMENT:"Latency\:" \
GPRINT:a:LAST:"%8.2lf %s" \
COMMENT:"ms"

RRDTool Says:

ERROR: the RRD does not contain an RRA matching the chosen CF
Got this too :( anyone can solve please.. i need it too.. thnx so much..
cmonz
Posts: 1
Joined: Sat Aug 21, 2010 10:51 pm

Post by cmonz »

ridhoyp wrote:
/usr/local/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-60 \
--title="WebIntra [172.16.0.4] - HTTP Response Time" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="milliseconds" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="/usr/local/share/cacti/rra/webintra_172_16_0_4_avg_723.rrd":avg:LAST \
DEF:b="/usr/local/share/cacti/rra/webintra_172_16_0_4_avg_723.rrd":avg:AVERAGE \
LINE1:a#4668E4FF:"" \
COMMENT:"Latency\:" \
GPRINT:a:LAST:"%8.2lf %s" \
COMMENT:"ms"

RRDTool Says:

ERROR: the RRD does not contain an RRA matching the chosen CF
Got this too :( anyone can solve please.. i need it too.. thnx so much..

consle > Graph Templates > HTTP Response Time (nrpe) > Item # 1 > Change "Consolidation Function" from LAST to Everage
Maher457
Cacti User
Posts: 54
Joined: Thu Jul 29, 2010 3:07 am
Location: Paris France

Post by Maher457 »

Thank you very much that solve my problem! :D
fozzy
Cacti User
Posts: 54
Joined: Mon Jan 09, 2006 11:33 am
Location: SE of LIML
Contact:

Re: new script & tempate

Post by fozzy »

guy2006 wrote: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.
I got all this almost to work under 0.8.7g
paths, libraries, all well, i even see in the lgos that the scritp is in fact returning a result and it's going into the RRA.. i just don't get a graph at all not even an empty one.

Any ideas?

Thanks.
fozzy
Cacti User
Posts: 54
Joined: Mon Jan 09, 2006 11:33 am
Location: SE of LIML
Contact:

Re: TCP & HTTP Server Response Time: Script & Templates

Post by fozzy »

console > Graph Templates > HTTP Response Time (nrpe) > Item # 1 > Change "Consolidation Function" from LAST to Average
this one was missing.. :) hadn't tried to run the graph creation command.

Thanks to everybody in this thread!!! :)
toiletbowl
Posts: 8
Joined: Thu Feb 23, 2012 3:51 am
Contact:

Re: TCP & HTTP Server Response Time: Script & Templates

Post by toiletbowl »

kayalinux wrote: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.

Hi there

After uploading perl scripts and xml i have an error of this and the graph is empty :D , or i need to restart cacti?

06/12/2012 10:45:02 PM - SPINE: Poller[0] Host[2] ERROR: Empty result [122.xx.xxx.xxx: 'perl /usr/share/cacti/site/scripts/tcp_response_time.pl 122.xx.xxx.xxx'
06/12/2012 10:45:02 PM - SPINE: Poller[0] Host[2] ERROR: Empty result [122.xx.xxx.xxx]: 'perl /usr/share/cacti/site/scripts/http_response_time.pl 122.xx.xxx.xxx'

in debug its shows only this:

Data Source Debug
/usr/bin/rrdtool create \
/var/lib/cacti/rra/mikrotik_gateway_router_avg_13.rrd \
--step 300 \
DS:avg:GAUGE:600:0:500 \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:288:797 \

Thanks
Attachments
no graph.png
no graph.png (173.91 KiB) Viewed 7855 times
The more i know, The more i don't know...
regdone
Posts: 6
Joined: Thu Jan 06, 2011 1:51 am

Re: TCP & HTTP Server Response Time: Script & Templates

Post by regdone »

Hello,
How can I create https graph instead of http?
Rgds,
rgonzalez87
Posts: 1
Joined: Mon Apr 29, 2013 2:25 pm

Re: TCP & HTTP Server Response Time: Script & Templates

Post by rgonzalez87 »

Hi everynone,

can you help me with this problem?

when i executing the script i´ll return the above :


perl http_response_time.pl www.google.cl
Net::HTTP: connect: Connection refused at http_response_time.pl line 70.


because why this happend?

please help

Regards.-
minhtriluunguyen
Posts: 20
Joined: Tue May 07, 2013 2:51 am

Re: TCP & HTTP Server Response Time: Script & Templates

Post by minhtriluunguyen »

Hi everyone!
Can you help me with this problem ?
I install cacti on both CentOS 6 and Ubuntu 12.04.

+ With Ubuntu, i copy the script file "tcp_response_time.pl" to "/usr/share/cacti/site/scripts" then on Cacti i import the template "cacti_graph_template_tcp_response_time.xml" and it's graph perfectly.

+ With CentOS, i do the same, copy the script file to "/var/www/html/cacti/scripts" and of course on Cacti i import the template but the graph don't show anything but "-nan"

Image

I don't know what i do wrong, please help.

Regards.
minhtriluunguyen
Posts: 20
Joined: Tue May 07, 2013 2:51 am

Re: TCP & HTTP Server Response Time: Script & Templates

Post by minhtriluunguyen »

-Any help here ? Please :(
desscartes
Cacti User
Posts: 96
Joined: Fri Mar 14, 2014 1:16 am

Re: TCP & HTTP Server Response Time: Script & Templates

Post by desscartes »

Hi Everyone!

Responce Time ok . How can I graph how many http connection do I have? I have oid for this. How can create this temp?

Thanks!

Cenk
danpez
Posts: 4
Joined: Mon Aug 01, 2016 1:14 am

Re: TCP & HTTP Server Response Time: Script & Templates

Post by danpez »

Guys, I'm a bit stuck. I've downloaded and set up both TCP Response and HTTP npre but don't get the data on the graphs. I've been through the troubleshooting URL as well as fixes seen above but no joy. The other graphs I have using a HP device template work fine, but these data source ones with HTTP / TCP aren't working. I'm getting these in particular:

Code: Select all

PM - CMDPHP: Poller[0] Host[23] DS[118] WARNING: Result from CMD not valid.  Partial Result: U
and

Code: Select all

connect: Connection timed out at /usr/share/cacti/site/scripts/tcp_response_time.pl line 69.
Here is an extract of a tail I have running. You can see a few graph requests when I look at the page in between the warnings.
I've spent a few days on this now, so really have tried everything I could find before posting...

Code: Select all

08/01/2016 04:10:03 PM - CMDPHP: Poller[0] Host[23] PING: ICMP Ping Success (28.777 ms)
08/01/2016 04:11:03 PM - CMDPHP: Poller[0] Host[23] DS[118] WARNING: Result from CMD not valid.  Partial Result: U
08/01/2016 04:11:03 PM - CMDPHP: Poller[0] Host[23] DS[118] CMD: perl /usr/share/cacti/site/scripts/nrpe_http.pl vrl.kronos.net, output: U
08/01/2016 04:11:03 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/lib/cacti/rra/kronos_workforce_live_avg_118.rrd --template avg 1470031802:U
08/01/2016 04:11:19 PM - CMDPHP: Poller[0] Host[24] DS[123] WARNING: Result from CMD not valid.  Partial Result: U
08/01/2016 04:11:19 PM - CMDPHP: Poller[0] Host[24] DS[123] CMD: perl /usr/share/cacti/site/scripts/tcp_response_time.pl vrl.kronos.net.t1.re 443, output: U
08/01/2016 04:11:19 PM - CMDPHP: Poller[0] Time: 376.9980 s, Theads: N/A, Hosts: 17
08/01/2016 04:11:19 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/lib/cacti/rra/kronos_workforce_test_avg_123.rrd --template avg 1470031691:U
08/01/2016 04:12:23 PM - WEBLOG: Poller[0] CACTI2RRD: /usr/bin/rrdtool graph -  --imgformat=PNG  --start='1469945543'  --end='1470031943'  --title='Kronos WorkForce Live - HTTP Response Time'  --base='1000'  --height='120'  --width='500'  --alt-autoscale-max  --lower-limit='0'  COMMENT:"From 2016/07/31 16\:12\:23 To 2016/08/01 16\:12\:23\c"  COMMENT:"  \n"  --vertical-label='seconds'  --slope-mode  --font TITLE:10:  --font AXIS:7:  --font LEGEND:8:  --font UNIT:7:  DEF:a='/var/lib/cacti/rra/kronos_workforce_live_avg_118.rrd':'avg':AVERAGE  AREA:a#4668E4FF:''   GPRINT:a:LAST:'Current\:%8.2lf %s'   COMMENT:'sec'   GPRINT:a:AVERAGE:'Average\:%8.2lf %s'   COMMENT:'sec\n'   GPRINT:a:MIN:'Minimum\:%8.2lf %s'   COMMENT:'sec'   GPRINT:a:MAX:'Maximum\:%8.2lf %s'   COMMENT:'sec\n' 
08/01/2016 04:12:23 PM - WEBLOG: Poller[0] CACTI2RRD: /usr/bin/rrdtool info /var/lib/cacti/rra/kronos_workforce_live_avg_119.rrd
08/01/2016 04:12:23 PM - WEBLOG: Poller[0] CACTI2RRD: /usr/bin/rrdtool graph -  --imgformat=PNG  --start='1469945543'  --end='1470031943'  --title='Kronos WorkForce Live - TCP Response Time'  --base='1000'  --height='120'  --width='500'  --alt-autoscale-max  --lower-limit='0'  COMMENT:"From 2016/07/31 16\:12\:23 To 2016/08/01 16\:12\:23\c"  COMMENT:"  \n"  --vertical-label='milliseconds'  --slope-mode  --font TITLE:10:  --font AXIS:7:  --font LEGEND:8:  --font UNIT:7:  DEF:a='/var/lib/cacti/rra/kronos_workforce_live_avg_119.rrd':'avg':LAST  LINE1:a#4668E4FF:''   COMMENT:'Latency\:'   GPRINT:a:LAST:'%8.2lf %s' 
08/01/2016 04:12:25 PM - WEBLOG: Poller[0] CACTI2RRD: /usr/bin/rrdtool info /var/lib/cacti/rra/kronos_workforce_test_avg_122.rrd
08/01/2016 04:12:25 PM - WEBLOG: Poller[0] CACTI2RRD: /usr/bin/rrdtool graph -  --imgformat=PNG  --start='1469945544'  --end='1470031944'  --title='Kronos WorkForce Test - HTTP Response Time'  --base='1000'  --height='120'  --width='500'  --alt-autoscale-max  --lower-limit='0'  COMMENT:"From 2016/07/31 16\:12\:24 To 2016/08/01 16\:12\:24\c"  COMMENT:"  \n"  --vertical-label='seconds'  --slope-mode  --font TITLE:10:  --font AXIS:7:  --font LEGEND:8:  --font UNIT:7:  DEF:a='/var/lib/cacti/rra/kronos_workforce_test_avg_122.rrd':'avg':AVERAGE  AREA:a#4668E4FF:''   GPRINT:a:LAST:'Current\:%8.2lf %s'   COMMENT:'sec'   GPRINT:a:AVERAGE:'Average\:%8.2lf %s'   COMMENT:'sec\n'   GPRINT:a:MIN:'Minimum\:%8.2lf %s'   COMMENT:'sec'   GPRINT:a:MAX:'Maximum\:%8.2lf %s'   COMMENT:'sec\n' 
08/01/2016 04:12:25 PM - WEBLOG: Poller[0] CACTI2RRD: /usr/bin/rrdtool info /var/lib/cacti/rra/kronos_workforce_test_avg_123.rrd
08/01/2016 04:12:25 PM - WEBLOG: Poller[0] CACTI2RRD: /usr/bin/rrdtool graph -  --imgformat=PNG  --start='1469945544'  --end='1470031944'  --title='Kronos WorkForce Test - TCP Response Time'  --base='1000'  --height='120'  --width='500'  --alt-autoscale-max  --lower-limit='0'  COMMENT:"From 2016/07/31 16\:12\:24 To 2016/08/01 16\:12\:24\c"  COMMENT:"  \n"  --vertical-label='milliseconds'  --slope-mode  --font TITLE:10:  --font AXIS:7:  --font LEGEND:8:  --font UNIT:7:  DEF:a='/var/lib/cacti/rra/kronos_workforce_test_avg_123.rrd':'avg':LAST  LINE1:a#4668E4FF:''   COMMENT:'Latency\:'   GPRINT:a:LAST:'%8.2lf %s' 
08/01/2016 04:12:26 PM - WEBLOG: Poller[0] CACTI2RRD: /usr/bin/rrdtool graph -  --imgformat=PNG  --start='1469945546'  --end='1470031946'  --title='Kronos WorkForce Live - HTTP Response Time'  --base='1000'  --height='120'  --width='500'  --alt-autoscale-max  --lower-limit='0'  COMMENT:"From 2016/07/31 16\:12\:26 To 2016/08/01 16\:12\:26\c"  COMMENT:"  \n"  --vertical-label='seconds'  --slope-mode  --font TITLE:10:  --font AXIS:7:  --font LEGEND:8:  --font UNIT:7:  DEF:a='/var/lib/cacti/rra/kronos_workforce_live_avg_118.rrd':'avg':AVERAGE  AREA:a#4668E4FF:''   GPRINT:a:LAST:'Current\:%8.2lf %s'   COMMENT:'sec'   GPRINT:a:AVERAGE:'Average\:%8.2lf %s'   COMMENT:'sec\n'   GPRINT:a:MIN:'Minimum\:%8.2lf %s'   COMMENT:'sec'   GPRINT:a:MAX:'Maximum\:%8.2lf %s'   COMMENT:'sec\n' 
08/01/2016 04:12:26 PM - WEBLOG: Poller[0] CACTI2RRD: /usr/bin/rrdtool info /var/lib/cacti/rra/kronos_workforce_live_avg_119.rrd
08/01/2016 04:12:26 PM - WEBLOG: Poller[0] CACTI2RRD: /usr/bin/rrdtool graph -  --imgformat=PNG  --start='1469945546'  --end='1470031946'  --title='Kronos WorkForce Live - TCP Response Time'  --base='1000'  --height='120'  --width='500'  --alt-autoscale-max  --lower-limit='0'  COMMENT:"From 2016/07/31 16\:12\:26 To 2016/08/01 16\:12\:26\c"  COMMENT:"  \n"  --vertical-label='milliseconds'  --slope-mode  --font TITLE:10:  --font AXIS:7:  --font LEGEND:8:  --font UNIT:7:  DEF:a='/var/lib/cacti/rra/kronos_workforce_live_avg_119.rrd':'avg':LAST  LINE1:a#4668E4FF:''   COMMENT:'Latency\:'   GPRINT:a:LAST:'%8.2lf %s' 
08/01/2016 04:13:10 PM - CMDPHP: Poller[0] Host[23] DS[119] WARNING: Result from CMD not valid.  Partial Result: U
08/01/2016 04:13:10 PM - CMDPHP: Poller[0] Host[23] DS[119] CMD: perl /usr/share/cacti/site/scripts/tcp_response_time.pl vrl.kronos.net 443, output: U
08/01/2016 04:13:10 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/lib/cacti/rra/kronos_workforce_live_avg_119.rrd --template avg 1470031802:U
08/01/2016 04:13:11 PM - CMDPHP: Poller[0] Host[24] PING: ICMP Ping Success (305.728 ms)
danpez
Posts: 4
Joined: Mon Aug 01, 2016 1:14 am

Re: TCP & HTTP Server Response Time: Script & Templates

Post by danpez »

I'm getting closer. I got the DNS response time scripts working, and the internal Ping ones, but I'm getting flashes of data from the HTTP/TCP graphs but they don't always show something. These blips are when I rebooted the VM yesterday evening.
Attachments
graphs.png
graphs.png (73.44 KiB) Viewed 4329 times
stokkeland
Posts: 1
Joined: Tue Apr 16, 2019 6:43 am

Re: TCP & HTTP Server Response Time: Script & Templates

Post by stokkeland »

I know this is a very old thread with lots of stuff, but it showed up in my google search for http response time checks - and I agree with guy2006 that one should measure after GET request completes, so I grabbed his template and nrpe script - then changed it up to take a single URL line instead, so that it will request check with a path, and also SSL/TLS if that is used - figure i post if it helps others

The attached file is the xml template (system did not let me attach the xml directly).

Then you need the check check_http binary from Nagios - on my ubuntu system I just installed monitoring-plugins-basic and added a symlink from /usr/lib/nagios/plugins/check_http in my scripts directory.

here is the altered nrpe_http.pl

Code: Select all

#!/usr/bin/perl

use URI;

my $uri = URI->new( $ARGV[0] );

# Change the path for check_http - or perhaps we can use a variable here
my $checkcmd = "/var/www/html/cacti/scripts/check_http -H '".$uri->host."' -u '".$ARGV[0]."' -p ".$uri->port." -f follow -t 30";

if ($uri->scheme eq 'https') { $checkcmd .= " -S"; }
my $response = `$checkcmd`;

chomp $response;
(my $load) = ($response =~ /time=(\d+\.\d+|\d+\.|\.\d+|\d+)/);
print "$load\n";
usage of this is very disconnected - the device you attach the graph to is irrelevant as the check uses purely the url
Attachments
cacti_graph_template_http_response_time_nrpe.zip
Cacti Graph Template with dependencies
(2.54 KiB) Downloaded 171 times
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests