#2089 - 02/19/09 02:22 PM
Extension: "Pinging" a web page.
|
Registered: 08/30/99
Posts: 1106
Loc: Boise, Idaho
|
Note: This extension is experimental, and has a number of shortcomings. Please read all of these instructions before trying it out.Extension Goal:This extension allows you to "ping" a remote server using an HTTP conversation. This times the entire conversation, and will depend partly on the size of the page that is being served, plus the server performance. This script is somewhat outside the core value proposition of PingPlotter Pro and has some limitations: - When using this script, the intermediate hops have no way of handling GET requests, so you only get latencies for the final destination. (If you want intermediate hops, then set up an configuration in PingPlotter Pro and monitor that target with route-supporting protocol, like the TCP type, in addition to this one).
- PingPlotter isn't designed to enter pages or URLs, so entry of the page name is pretty ugly (and a bit of a hack).
- Latencies can exceed 32 seconds with an HTTP GET, and PingPlotter only stores 32 seconds, so anything longer than 32 seconds either shows as a timeout, or shows as 32 seconds.
- A lost packet in the TCP conversation gets represented as additional latency, rather than lost packets since the TCP system is built to correct for any lost packets.
- The VBScript timer isn't all that accurate, and we're only that accurate (1ms on some systems, as high as 20ms on others).
- This script creates additional work on the remote web server, so please use with discretion!
Required PingPlotter Pro version: This extension requires PingPlotter Pro 3.30.0p or higher. Installation Instructions:- Download the attachment from this post (link near the title). The file will be named "HTTP GET.ppx"
- Save it in your "c:\Program Files\Pingplotter Pro\scripts" directory (or the appropriate path if you've not installed to that location).
- Close and restart PingPlotter Pro.
- Go to Edit -> Options, and create a new named configuration (see the manual for details), and pick "HTTP GET" for the Packet Type. Name the configuration something useful (like "HTTP Page Test", or similar).
- Go to the main trace screen, and pick your new configuration in the "Settings" dropdown below the target name.
- Now, here's the really important "killer" part (the part that's really a hack to get the address there). When entering your address, do it in the form of IPAddress (space) URL. Let's say your server is 192.168.1.1 and your URL is http://mytestserver/mytestpage/blah. Enter the URL in this form:
192.168.1.1 http://mytestserver/mytestpage/blah (There should only be one space - between the IP and the name.) - Start "Tracing". You'll get a single hop route showing the response time for that page.
Other Notes:For best results on the summary page, install this script, too (if you don't, the summary page will be not as meaningful as it could be). If you want to verify that you're properly accessing a page, enter a wrong URL - say, an invalid address or something that redirects. Any error response codes from the server will show up as an error in PingPlotter, and you'll be able to see the error code above the trace window. **Update (April 15, 2015): PingPlotter v4 requires an updated version of this script to work, which you'll find attached below.
Attachments
HTTP GET.ppx (2772 downloads)HTTP GET(v4).ppx (1849 downloads)
Edited by Gary (04/15/15 12:54 PM)
|
Top
|
|
|
#2556 - 09/11/14 01:41 PM
Re: Extension: "Pinging" a web page.
[Re: Pete Ness]
|
Registered: 09/11/14
Posts: 2
|
This Extension idea is just what's needed in my environment.
HTTP request appear to return a positive status however HTTPS requests indicate failure.
Can this Extension be modified to support HTTPS request?
Thank you.
|
Top
|
|
|
#2557 - 09/12/14 06:09 AM
Re: Extension: "Pinging" a web page.
[Re: Churbz]
|
Registered: 09/11/14
Posts: 2
|
In efforts to progress the request, I have reviewed the original extension "HTTP GET.ppx" (and some others) and have determined that it is possible to create system installed objects. With that in mind, I decided to try a well know system object "MSXML2.ServerXMLHTTP" to accomplish the HTTPS submission. The system object works as expected and seems to allow my requested functionality. There are unknowns as to the ppx framework so additional error checking and variable use could use some polish.
If there are more skilled forum members that can contribute error handling and variable understanding, it would be greatly appreciated.
I will be further experimenting with simple socket connections to check the availability of applications our organization must connect to regularly. It is understood that this functionality is "... somewhat outside the core value proposition of PingPlotter Pro" and will not be criticized if unsuccessful.
The following is the modified extension in text format as I was unable to attach it with File Manger (formatting is lost).
PingPlotter Script V1.00 ScriptType=Engine Language=VBScript DefaultEnabled=1 This script allows you to "ping" a remote server using an HTTP conversation. This times the entire conversation, and will depend partly on the size of the page that is being served, plus the server performance. This script is somewhat outside the core value proposition of PingPlotter Pro and has some limitations: * There is no way to enter a full URL, since the "Address to trace" strips off everything except for the base DNS Name or IP Address. * When using this script, the intermediate hops have no way of handling GET requests, so you only get latencies for the final destination. * Latencies can exceed 32 seconds with an HTTP GET, and PingPlotter only stores 32 seconds, so anything longer than 32 seconds either shows as a timeout, or shows as 32 seconds. * A lost packet in the TCP conversation gets represented as additional latency, rather than lost packets since the TCP system is built to correct for any lost packets. * The VBSCript timer isn't all that accurate, and we're only that accurate
---- Do not edit this line, or anything above it ----
option explicit
' Build the editor sub GetEditor(EditorForm)
EditorForm.Caption = "HTTP GET" EditorForm.Height = 10 end sub
dim gNewTrace private Response private re
sub InitializeEngine( ) set Response = CreateAppObject("TScriptedTraceResponse") end sub
Sub DoneEngine( ) set Response = Nothing end sub
'NewTrace Properties ' property IPAddress: ShortString read FIPAddress write FIPAddress; ' property TargetName: ShortString read FTargetName write FTargetName; ' property CurMaxHops: Integer read FCurMaxHops write FCurMaxHops; ' property SampleNum: Integer read FSampleNum write FSampleNum; ' property NeedName: Boolean read FNeedName write FNeedName; ' property StartDelay: Integer read FStartDelay write FStartDelay; ' property NotifyHandle: THandle read FNotifyHandle write FNotifyHandle; ' property TimeoutTime: Integer read FTimeoutTime write FTimeoutTime; ' property ToSByte: Byte read FToSByte write FToSByte; ' property PacketType: TPacketType read FPacketType write FPacketType; ' property EngineSettings: TEngineSettings read FEngineSettings write FEngineSettings;
sub ProcessRequest(NewTrace) dim HTTPRequest ' Don't supress error handling.. on error goto 0 Err.Clear set gNewTrace = NewTrace
' Read the target server! ' *** IMPORTANT *** All settings should be read-only. The engine settings ' are not - write-safe as there are multiple threads involved. dim TargetServer dim EngineSettings set EngineSettings = NewTrace.EngineSettings TargetServer = EngineSettings.AdditionalSettings("RemoteHTTPEngineTarget")
dim URL, URLParser set URLParser = CreateAppObject( "TidURI" ) URL = Trim(gNewTrace.TargetName) ' ' Check and see if :// was specified in the address. If not, we need to ' add it... if InStr(gNewTrace.TargetName, "://") = 0 then URL = "http://" & URL end if dim SpacePos SpacePos = InStr(URL, " ") if (SpacePos > 0) then URL = Left(URL, SpacePos-1) end if ' Parse it, try and reformat it as needed. URLParser.URI = URL ' ' Get it back out, reformatted. URL = URLParser.URI set URLParser = Nothing ' Get won't return until the request is complete. We'll get callbacks ' on "OnReadLine", though.
dim StartTime StartTime = Timer dim xHttp Set xHttp = CreateObject("MSXML2.ServerXMLHTTP") xHttp.Open "GET", URL, False URL = ""
' 2 stands for SXH_OPTION_IGNORE_SERVER_SSL_CERT_ERROR_FLAGS ' 13056 means ignore all server side cert error 'xHttp.setOption 2, 13056
xHttp.Send
' A 400+ means some kind of error - so let's call that a timeout. 'If ((Err.Number <> 0) or (HTTPRequest.ResponseCode >= 400)) then If ( (Err.Number <> 0) ) then Response.ElapsedTime = ppSAMPLETIMEOUT ' rtError = 0; ' rtReachedDestination = 1; ' rtUnreachable = 2; ' rtIntermediateHop = 3; Response.ResponseType = rtError 'Response.ResponseType = xHttp.status 'if HTTPRequest.ResponseCode >= 400 then ' 'Response.Message = HTTPRequest.ResponseText ' Response.Message = xHttp.statusText 'else ' Response.Message = Err.Description 'end if Err.Clear on error goto 0 else on error goto 0 ' It's a response of some kind. Response.ElapsedTime = (Timer - StartTime) * 1000 Response.ResponseType = rtReachedDestination Response.Message = "" end if
Response.Hop = 1 Response.ReachedAddress = gNewTrace.IPAddress Response.SampleNum = gNewTrace.SampleNum Response.TargetAddress = gNewTrace.IPAddress gNewTrace.Reply(Response)
set gNewTrace = Nothing Set xHttp = Nothing
end sub
|
Top
|
|
|
#2558 - 09/12/14 05:56 PM
Re: Extension: "Pinging" a web page.
[Re: Churbz]
|
Registered: 08/30/99
Posts: 1106
Loc: Boise, Idaho
|
Thanks for the post here, Churbz.
Although PingPlotter has a built-in implementation of a HTTPS client, there's no easy way to use it in an extension in the current build - we'll look to fix that for a future build.
Your solution is pretty good, though - a cursory review makes it look viable and interesting. We'll try and get it strapped into place and tested early next week and maybe have some comments / suggestions for you.
Best wishes, Pete
P.S. You have to .zip up any text attachments to keep formatting intact - then attach the .zip.
|
Top
|
|
|
#3896 - 10/13/21 02:31 PM
Re: Extension: "Pinging" a web page.
[Re: Pete Ness]
|
Registered: 10/13/21
Posts: 1
|
Is there a way to monitor http GET on a different port than port 80? I'm wanting to use this plugin to monitor http status codes over port 8010.
Thanks, Paul
|
Top
|
|
|
|
0 registered (),
56
Guests and
2
Spiders online. |
Key:
Admin,
Global Mod,
Mod
|
|