no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
| — | monitors:aspapplicationperfmon [2010/06/22 08:37] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== ASP.NET Application Specific Performance Counters ====== | ||
| + | ^ Neil Franken| [[ neil_franken@yahoo.com | Neil Franken]] | | ||
| + | ^ Compatibility | Xymon 4.2 | | ||
| + | ^ Requirements | IIS, VBS| | ||
| + | ^ Download | None | | ||
| + | ^ Last Update | 2010-06-21 | | ||
| + | |||
| + | ===== Description ===== | ||
| + | This script will monitor ASP.Net Application Specific Performance Counters. You will need to modify the script to point to a specific ASP application. For example you have a mission critical asp.net application called Warehouse you will need to change the script to monitor the application called Warehouse. You can also use the Total instance to get a specific overview. See the code for instructions on where to change the script to point to a specific application. | ||
| + | ===== Installation ===== | ||
| + | === Client side === | ||
| + | Edit the script to monitor the ASP Application of your choice. See Script for more instructions. | ||
| + | |||
| + | Place the script on the IIS Server you want to monitor and add a appropriate section to the BBWin.cfg externals section. | ||
| + | |||
| + | Typically it would be configured like this. <load value=“cscript c: | ||
| + | |||
| + | Once this is added to the cfg file it should create a sql file in the tmp directory of BBwin for upload. If this is the case it is working. | ||
| + | |||
| + | === Server side === | ||
| + | While the Xymon server does not require any installation you can add the following to the hobbitserver.cfg to create a graph with some of the more important values on. | ||
| + | |||
| + | == 1) Adding NCV Definition to the hobbitserver.cfg file == | ||
| + | |||
| + | |||
| + | * Add aspapplications=ncv to the TEST2RRD section of the hobbitserver.cfg file. Please note that the aspapplications name must reflect the name of the test. You will change this to monitor a specific application. | ||
| + | * Add the following definition to the hobbitserver.cfg. Once again remember to change the value aspapplications to reflect the name of the test. | ||
| + | < | ||
| + | , | ||
| + | , | ||
| + | , | ||
| + | , | ||
| + | , | ||
| + | , | ||
| + | </ | ||
| + | |||
| + | |||
| + | * Restart Xymon | ||
| + | == 2) Adding Graph Definition to the hobbitgraph.cfg file == | ||
| + | * Add the following to the file.Remember to chance the aspapplications name to reflect your test name | ||
| + | <hidden onHidden=" | ||
| + | < | ||
| + | [aspapplications] | ||
| + | TITLE YOUR ASP.NET Application Health | ||
| + | YAXIS Number | ||
| + | DEF: | ||
| + | VDEF: | ||
| + | VDEF: | ||
| + | VDEF: | ||
| + | VDEF: | ||
| + | |||
| + | DEF: | ||
| + | VDEF: | ||
| + | VDEF: | ||
| + | VDEF: | ||
| + | | ||
| + | |||
| + | DEF: | ||
| + | VDEF: | ||
| + | VDEF: | ||
| + | VDEF: | ||
| + | | ||
| + | |||
| + | DEF: | ||
| + | VDEF: | ||
| + | VDEF: | ||
| + | VDEF: | ||
| + | | ||
| + | |||
| + | DEF: | ||
| + | VDEF: | ||
| + | VDEF: | ||
| + | VDEF: | ||
| + | | ||
| + | |||
| + | DEF: | ||
| + | VDEF: | ||
| + | VDEF: | ||
| + | VDEF: | ||
| + | | ||
| + | |||
| + | DEF: | ||
| + | VDEF: | ||
| + | VDEF: | ||
| + | VDEF: | ||
| + | | ||
| + | |||
| + | |||
| + | COMMENT: | ||
| + | COMMENT: | ||
| + | COMMENT: | ||
| + | COMMENT: | ||
| + | COMMENT: | ||
| + | |||
| + | LINE2: | ||
| + | GPRINT: | ||
| + | GPRINT: | ||
| + | GPRINT: | ||
| + | GPRINT: | ||
| + | |||
| + | LINE2: | ||
| + | GPRINT: | ||
| + | GPRINT: | ||
| + | GPRINT: | ||
| + | GPRINT: | ||
| + | |||
| + | |||
| + | LINE2: | ||
| + | GPRINT: | ||
| + | GPRINT: | ||
| + | GPRINT: | ||
| + | GPRINT: | ||
| + | COMMENT: | ||
| + | |||
| + | # | ||
| + | COMMENT: | ||
| + | GPRINT: | ||
| + | GPRINT: | ||
| + | GPRINT: | ||
| + | GPRINT: | ||
| + | |||
| + | # | ||
| + | COMMENT: | ||
| + | GPRINT: | ||
| + | GPRINT: | ||
| + | GPRINT: | ||
| + | GPRINT: | ||
| + | |||
| + | # | ||
| + | COMMENT: | ||
| + | GPRINT: | ||
| + | GPRINT: | ||
| + | GPRINT: | ||
| + | GPRINT: | ||
| + | |||
| + | |||
| + | # | ||
| + | COMMENT: | ||
| + | GPRINT: | ||
| + | GPRINT: | ||
| + | GPRINT: | ||
| + | GPRINT: | ||
| + | |||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ===== Source ===== | ||
| + | ==== aspapplicationperfmon.vbs==== | ||
| + | |||
| + | <hidden onHidden=" | ||
| + | < | ||
| + | ' ASP.NET Applications Performancer Counters | ||
| + | ' Author: Neil Franken | ||
| + | ' email: neil_franken@yahoo.com | ||
| + | ' Description: | ||
| + | ' This script collects some performance counters related to a specific ASP Application. | ||
| + | ' | ||
| + | ' You are welcome to use, modify, mangle and do what you please with this script just please | ||
| + | ' keep me in the loop about bugs, | ||
| + | ' | ||
| + | ' IMPORTANT NOTES: | ||
| + | ' Before running this script please do the following. Open a command prompt on the SQL server where the script | ||
| + | ' runs. Run the following command wmiadap/f. | ||
| + | ' Open the services manager screen and restart/ | ||
| + | ' to read the performance counters via the WMI interface. | ||
| + | ' BEFORE RUNNING THIS SCRIPT: | ||
| + | ' 1) Change the following token << | ||
| + | ' 2) Change the str Name to something like applicationname_asp i.e. google_asp, sharepoint_asp etc. | ||
| + | ' 3) If you use the graph definition please change the name from aspapplications to the name you give the file. | ||
| + | ' KNOWN ISSUE: | ||
| + | ' I encountered a problem where the CPU was 64 Bit but the installed OS was 32Bit. This caused the registry read to fail. | ||
| + | ' If you have a 32 Bit OS running on a 64 bit system yuo will have to change the script to point to the BBWin\tmp folder | ||
| + | ' as the script will attempt to read the value from a registry key that dont exist. Also comment out the ProcessorCheck function. | ||
| + | ' | ||
| + | |||
| + | |||
| + | ' Version 0.5 Released: 18/06/2010 | ||
| + | ' | ||
| + | |||
| + | strAlarmState = " | ||
| + | strTestName = " | ||
| + | strOutput = "" | ||
| + | Const strComputer = " | ||
| + | Dim objWMIService, | ||
| + | Dim ErrorPerSec, | ||
| + | Set ws = WScript.CreateObject(" | ||
| + | |||
| + | ProcessorCheck | ||
| + | If Proc = " | ||
| + | ' | ||
| + | extPath = ws.RegRead(" | ||
| + | ' | ||
| + | Else | ||
| + | ' | ||
| + | extPath = ws.RegRead(" | ||
| + | ' | ||
| + | End If | ||
| + | |||
| + | |||
| + | ' Usage of the CheckValue, | ||
| + | ' CheckValue takes the Performance Counter value,a description which appears on Xymon,the warning value and the Alarm value and does a check for values above the warn and alarm thresholds. | ||
| + | ' CheckReverseValue takes the Performance Counter value,a description which appears on Xymon,the warning value and the Alarm value and does a check for values below the warn and alarm thresholds. | ||
| + | ' | ||
| + | |||
| + | ' ASP.NET Application Check Starts Here | ||
| + | strOutput = strOutput & vbCrLf & " | ||
| + | Set objWMIService = GetObject(" | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' Change the token << | ||
| + | ' To Check what name your application runs under you can use the peformance monitor | ||
| + | ' to add a ASP.NET application performance counter. The applications running on the | ||
| + | ' server will be listed under instance names. | ||
| + | ' | ||
| + | |||
| + | Set colItems = objWMIService.ExecQuery(" | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | For Each objItem In colItems | ||
| + | ErrorPerSec=objItem.ErrorsTotalPerSec | ||
| + | ReqExecuting= objItem.RequestsExecuting | ||
| + | ReqFailed=objItem.RequestsFailed | ||
| + | ReqNotAuthorized=objItem.RequestsNotAuthorized | ||
| + | ReqNotFound=objItem.RequestsNotFound | ||
| + | ReqPerSeq=objItem.RequestsPerSec | ||
| + | ReqTimedOut=objItem.RequestsTimedOut | ||
| + | Exit For | ||
| + | Next | ||
| + | strOutput = strOutput & CheckValue(ErrorPerSec," | ||
| + | strOutput = strOutput & CheckValue(ReqExecuting," | ||
| + | strOutput = strOutput & CheckValue(ReqFailed," | ||
| + | strOutput = strOutput & CheckValue(ReqNotAuthorized," | ||
| + | strOutput = strOutput & CheckValue(ReqNotFound," | ||
| + | strOutput = strOutput & CheckValue(ReqPerSeq," | ||
| + | strOutput = strOutput & CheckValue(ReqTimedOut," | ||
| + | |||
| + | |||
| + | ' Write the file for BB | ||
| + | WriteFile extPath, strTestName, | ||
| + | |||
| + | ' | ||
| + | ' FUNCTIONS and SUBS start here | ||
| + | |||
| + | |||
| + | |||
| + | Sub ProcessorCheck () | ||
| + | Dim WshShell, WshSysEnv | ||
| + | |||
| + | Set WshShell = WScript.CreateObject(" | ||
| + | Set WshSysEnv = WshShell.Environment(" | ||
| + | Proc = WshSysEnv(" | ||
| + | End Sub | ||
| + | |||
| + | |||
| + | |||
| + | ' This is used to check the actual value against the warning and alarm. | ||
| + | Function CheckValue(iObjectValue, | ||
| + | If iWarnValue > iAlarmValue Then | ||
| + | CheckValue = "& | ||
| + | If strAlarmState <> " | ||
| + | strAlarmState = " | ||
| + | End If | ||
| + | Else | ||
| + | If CDbl(iObjectValue) > CDbl(iWarnValue) Then | ||
| + | If CDbl(iObjectValue) > CDbl(iAlarmValue) Then | ||
| + | CheckValue = "& | ||
| + | SetAlarmStatus " | ||
| + | Else | ||
| + | CheckValue = "& | ||
| + | ' | ||
| + | SetAlarmStatus " | ||
| + | End If | ||
| + | Else | ||
| + | CheckValue = "& | ||
| + | ' | ||
| + | End If | ||
| + | End If | ||
| + | End Function | ||
| + | |||
| + | |||
| + | ' This is used to check the actual value against the warning and alarm. | ||
| + | ' This one the alarm will be a lower value than the warning. (Values Decrease rather than increase) | ||
| + | Function CheckReverseValue(iObjectValue, | ||
| + | If CDbl(iWarnValue) < CDbl(iAlarmValue) Then | ||
| + | CheckReverseValue = "& | ||
| + | If strAlarmState <> " | ||
| + | strAlarmState = " | ||
| + | End If | ||
| + | Else | ||
| + | If CDbl(iObjectValue) < CDbl(iWarnValue) Then | ||
| + | If CDbl(iObjectValue) < CDbl(iAlarmValue) Then | ||
| + | CheckReverseValue = "& | ||
| + | SetAlarmStatus " | ||
| + | Else | ||
| + | CheckReverseValue = "& | ||
| + | SetAlarmStatus " | ||
| + | End If | ||
| + | Else | ||
| + | CheckReverseValue = "& | ||
| + | End If | ||
| + | End If | ||
| + | End Function | ||
| + | |||
| + | |||
| + | ' This is called to set the overall alarm status. | ||
| + | Sub SetAlarmStatus(strnewAlarmState) | ||
| + | If strnewAlarmState = " | ||
| + | strAlarmState = strnewAlarmState | ||
| + | ElseIf strnewAlarmState = " | ||
| + | If strAlarmState <> " | ||
| + | strAlarmState = strnewAlarmState | ||
| + | End If | ||
| + | End If | ||
| + | End Sub | ||
| + | |||
| + | |||
| + | ' This SUB is used for outputting the file to the external' | ||
| + | Sub WriteFile(strExtPath, | ||
| + | Set fso = CreateObject(" | ||
| + | strOutput = strAlarmState & " " & Date & " " & Time & vbCrLf & vbCrLf & strOutput & vbCrLf | ||
| + | Set f = fso.OpenTextFile(strExtPath & " | ||
| + | f.Write strOutput | ||
| + | f.Close | ||
| + | Set fso = Nothing | ||
| + | End Sub | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ===== Known Bugs and Issues ===== | ||
| + | * Running a 32 Bit Windows on a 64 Bit CPU(It happens apparently). This causes the script to look for the HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\BBWin\tmppath registry key. This does not exist in a 32 windows version and the script will bomb. To fix comment out the Processor check and hard code(yuck) the bath to the BBwin\tmp folder. | ||
| + | |||
| + | * When running the script it throws a null exception which looks something like C:\Program Files (x86)\BBWin\ext\aspapplicationperfmon.vbs(103, | ||
| + | |||
| + | ===== To Do ===== | ||
| + | It would be nice to have this script retrieve a list of all ASP.NET applications and list all of the applications and their respective performance counters. The main problem then would be to generate a graph with all these values. I could create a script to read the result set and then create the appropriate graph definition. However this is sufficient for now. | ||
| + | ===== Credits ===== | ||
| + | * Neil Franken | ||
| + | * Chris Walker, Liberty Enterprises for his original IISHealth script. | ||
| + | ===== Changelog ===== | ||
| + | |||
| + | * **2010-06-21** | ||
| + | * Initial release | ||
| + | * **2010-06-22** | ||
| + | * Initial release had debug functionallity included which was removed. Thanks to Carlos Arroba for reporting the issue. Copy and Paste is a blessing and curse. | ||