Main function:
For use with Whatsup Gold to monitor web sites.
The script can be used in four diffrent ways
#1-As an Active monitor controling a webpage or a web service
#2-As an Performance Monitor reporting responsetime of a webpage or a web service
#3-As an Performance Monitor extracting values from a webpage or a web service
#4-As an Active script action
The differens between a webpage and web service (SOAP) are the "content-type" when making a HTTP POST.
The script have a log file function that can be used to logg entrys to specific file.
If the folders (PATH) to the log file does not exist the script creates it.
If you have same name on a scripts running as Active Monitor and Performance monitor
on the same object they will use the same log file.
It is possible to make several HTTP GET and POST to simulate a user that
runs a webapplication.
Note that it have to be a "true" web application in that sense that it have to be
pure HTTP, no support for webpages that requires JavaScript,VBscript,Java applets,
Active X,Flash or any other plug-in.
The script uses WinHTTP 5.1
Version history
V1.0 First public release
V1.1 Added SOAP11 and SOAP12 as URLMethods to be able to make POST to webservices.
You can use the same MonitorURL parameters as in V1.0 but you have to replace the script.
V1.2
-Change the timeout to calculated connectiontime.
V1.3 New feature
-Added support to configure WinHttp 5.1 timeouts in the script or calculate connectiontime, Now there are two diffrent timeout modes.
-Added support to use a status file so that the script can run outside whatsup and not be affected of whatsup timeout of max 60 seconds on active script.The status file can only be used on active monitors.
This also includes possibility to logg status to windows eventlog (works only in windows prompt mode).
-Addes exitcode in windows prompt mode.0 = OK, 1 = Fail.
-Moved scriptname config to global parameter for windows prompt
-Updated the LogToFile() function
You can use the same MonitorURL parameters (function call) as in V1.0 and 1.1 but you have to replace the script.
Comments
Hi,
I am trying to understand this script and see how i can use this to monitor some of the external websites?
I am new to this and wanted to know if there is a inbuilt feature where we can monitor external website for RTT
We have the latest version of WUG 14.0 Build 511 remote side edition and Central site edition
Thanks
C
Reply to this Comment
Be the first to rate this
|
Sign in to rate this
Hi Chandru K.
There is a built-in feature in whatsup to monitor web sites (active monitor), the "old" way with TCP/IP active monitor using send and expext commands, I have used it for several years but you have to make your own HTTP syntax, It can be done and there are several examples in the forum, the other way is to use the new HTTP content active monitor that basicly makes the same thing as when you run URLMonitor as an active monitor and makes one MonitorURL() function call.
But if you need to test a "web"-application doing serveral URL checks, measure resonsetime,extract values from a web page and log that in a performance monitor or log the actual error/receive text string from a URL check (in a simple way) then I do not know any other way then using a active script (as Active or performance monitor), that was the driver for me to develop the URLMonitor script.
This information is a abstract of the documentation in the script.
Copy the script to you local computer and name it .vbs, in the example below I named it example.vbs and placed it in C: and
started the script with cscript
C:\>cscript example.vbs
Microsoft (R) Windows Script Host version 5.7
Copyright (C) Microsoft Corporation 1996-2001.
Checking URL(ver 1.3)=http://www.whatsupgold.com with string=<title>Network Management with Network Monitoring | Know Your Network
with WhatsUp Gold</title> POSTdata:
Script=URL Monitor 1.3 example strURLToCheck=http://www.whatsupgold.com received a webpage that exceeds sintMaxPageLengthKB, the check will only be within the first 10 Kbytes, actual received length was 28421 bytes.
Success, http://www.whatsupgold.com returns the text=<title>Network Management with Network Monitoring | Know Your Network with Wh
atsUp Gold</title>
URLCheck for script=URL Monitor 1.3 example took 688 ms to complete
Completed with success for script=URL Monitor 1.3 example,All URL checks have responded correctly
C:\>
The MonitorURL() function call have the following parameters
MonitorURL "http://www.whatsupgold.com","<title>Network Management with Network Monitoring | Know Your Network with WhatsUp Gold</title>" ,"GET","","","","","",0
This means:
Use HTTP GET to receive the URL www.whatsupgold.com
If the received textstring consist of "<title>Network Management with Network Monitoring | Know Your Network with WhatsUp Gold</title>" then the URL check have completed successfully.
Change the parameters to MonitorURL() according to your own needs, you can make several MonitorURL calls in one script.
The setup in the example.vbs script are:
Windows prompt mode (not whatsup mode), sintScriptMode = 1
Responsetime monitor (reports response time to a whatsup performance monitor), sintTypOfMonitor = 1
If the script received a text string that dosent consist of the expexted then logg to a logfile. sintLogMode = 1
The script uses default timeouts of 59 seconds for the timeouts in winHTTP 5.1, sintTimeoutMode = 0
If you change sintScriptMode = 0 you can use it in whatsup as a performance monitor showing the responsetime
If you change sintTypOfMonitor = 0 you can use it in whatsup as a Active monitor (or action)
If you change sintLogMode = 0 no log file will be created and you can ignore sstrLogFilePath.
Summary
Test the script in windows prompt mode sintScriptMode = 1.
Choose sintTypOfMonitor = 0 or 1 depending on your need
Configure the MonitorURL() function call with the URL and expected response.
When you are finish developing your script, in other words you have configure the MonitorURL() calls change the sintScriptMode = 0 and create it in whatsup as a active or performance monitor (sintTypOfMonitor).
Please note that if you want to monitor and measure the response time on the same URL you have to use the same script as both a active and a performance monitor.
Do this by simply change the sintTypOfMonitor.
Hope that helps.
/R
Reply to this Comment
Be the first to rate this
|
Sign in to rate this
Hi There,
I am currently trying to implement this script as a performance monitor, but having some issues.
I managed to get the script working with command prompt, but when I try to directly implement the script into WhatsUp Gold as a performance monitor I get the following error:
Checking URL(ver 1.3)=http://www.whatsupgold.com with string=<title>Network & Server Management System with Network Monitoring | Know Your Network with WhatsUp Gold</title> POSTdata:
Script=-156.21.1.169 strURLToCheck=http://www.whatsupgold.com received a webpage that exceeds sintMaxPageLengthKB, the check will only be within the first 10 Kbytes, actual received length was 56557 bytes.
Success, http://www.whatsupgold.com returns the text=<title>Network & Server Management System with Network Monitoring | Know Your Network with WhatsUp Gold</title>
Error: Source:'Microsoft VBScript runtime error'Line:157 Char:12Error:0 'Object doesn't support this property or method: 'Context.SetValue''-----------v(null)
any ideas what causes this error and how to fix it? please?
Many Thanks
*text document with altered script attached
Reply to this Comment
Be the first to rate this
|
Sign in to rate this
Hi, I tested your script and it works as a Performance Monitor.
I get the same error when I test your script as an active monitor.
The sintTypOfMonitor controls when the script should use Context.SetValue or not (sintTypOfMonitor = 1 or 2).
The reason for the error is that Context.SetValue isnt supported in an Active monitor.
Unfortunately Whatsup only have a "test" function for active monitor and not for performance monitor (and only in the console, not in web)
The only "tools" you have is the specific log file that the script create and the performance error log in whatsup.
Hope that helps!
/R
Reply to this Comment
Be the first to rate this
|
Sign in to rate this
Hi Robert,
Thanks for the Reply, was a great help.
I have now got the script working as a performance monitor...like you correctly pointed out I was adding it as an active monitor by mistake.
As an extra note: is there a way I can alter the script to cover all my devices apposed to duplicating the performance monitor over and over editing the url and title as needed ?
Many Thanks
Reply to this Comment
Be the first to rate this
|
Sign in to rate this
Hi Edward.
Yes you can, by configure the MonitorURL function call .
As the comment in the script say (I know that the script is a bit "overdocumented" with maybe to much information.)
'Use the Context.GetProperty("Address") if you have a monitor that can be used on 'several objects.
'Note that the Context.GetProperty("Address") only works in Whatsup mode.
This mean that you can use the same monitor on several devices, this will change the adress part.
Here are a example (for port 8080)
MonitorURL "http://" & Context.GetProperty("Address") & ":8080/your-URL/","Your expected content" ,"GET","","","","","",0
/R
Reply to this Comment
Be the first to rate this
|
Sign in to rate this