no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | monitors:aspnethealth [2010/06/22 08:36] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== ASP.NET Performance Counter Pack ====== | ||
+ | |||
+ | ^ Author | [[ neil_franken@yahoo.com | Neil Franken]] | | ||
+ | ^ Compatibility | Xymon 4.2 | | ||
+ | ^ Requirements | IIS, ASP.NET, VBS | | ||
+ | ^ Download | None | | ||
+ | ^ Last Update | 2010-06-22 | | ||
+ | |||
+ | ===== Description ===== | ||
+ | This script will monitor some basic performance counters for the overall ASP.NET Health on a server. | ||
+ | The counters monitored are: | ||
+ | * Applications Restarts | ||
+ | * Applications Running | ||
+ | * Requests Current | ||
+ | * Requests Queued | ||
+ | |||
+ | ===== Installation ===== | ||
+ | === Client side === | ||
+ | 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 aspnethealth 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 aspnethealth=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. | ||
+ | |||
+ | < | ||
+ | |||
+ | * Restart Xymon | ||
+ | |||
+ | == 2) Adding Graph Definition to the hobbitgraph.cfg file == | ||
+ | * Add the following to the file | ||
+ | <hidden onHidden=" | ||
+ | < | ||
+ | [aspnethealth] | ||
+ | |||
+ | TITLE ASP Overall Health | ||
+ | YAXIS Number | ||
+ | DEF: | ||
+ | DEF: | ||
+ | LINE2: | ||
+ | LINE2: | ||
+ | COMMENT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | ===== Source ===== | ||
+ | ==== aspnethealth.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 overall ASP health i.e. the server. | ||
+ | ' | ||
+ | ' 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. | ||
+ | |||
+ | ' 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: 22/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 | ||
+ | extPath = " | ||
+ | |||
+ | ' 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 Check Starts Here | ||
+ | strOutput = strOutput & vbCrLf & " | ||
+ | Set objWMIService = GetObject(" | ||
+ | Set colItems = objWMIService.ExecQuery(" | ||
+ | For Each objItem in colItems | ||
+ | AppRestarts =objItem.ApplicationRestarts | ||
+ | AppRunning | ||
+ | ReqCurrent =objItem.RequestsCurrent | ||
+ | ReqQueued =objItem.RequestsQueued | ||
+ | Exit For | ||
+ | Next | ||
+ | strOutput = strOutput & CheckValue(AppRestarts," | ||
+ | strOutput = strOutput & CheckValue(AppRunning," | ||
+ | strOutput = strOutput & CheckValue(ReqQueued," | ||
+ | strOutput = strOutput & CheckValue(ReqCurrent," | ||
+ | |||
+ | |||
+ | ' 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\aspnethealth.vbs(103, | ||
+ | |||
+ | |||
+ | ===== To Do ===== | ||
+ | * I am not a IIS/ASP.NET expert so these performance counters are just what I used to monitor a problematic server. I am sure they can be improved. Let me know and I can help. | ||
+ | |||
+ | ===== Credits ===== | ||
+ | * Neil Franken | ||
+ | * Chris Walker, Liberty Enterprises for his original IISHealth script. | ||
+ | |||
+ | ===== Changelog ===== | ||
+ | |||
+ | * **2010-06-22** | ||
+ | * Initial release | ||