DHCP, Task: Capture service performance statistics

Task: Capture service performance statistics in DHCP Operations Guide

Task: Capture service performance statistics

Purpose

The following activity captures empirical data on DHCP service performance. This data, which is collected daily (or multiple times a day) will be reviewed weekly. It will also be used to create monthly reports that are reviewed quarterly for service level agreement (SLA) compliance. Service performance statistics are different from system performance in that they measure the characteristics of the DHCP service, not the underlying infrastructure, such as disk, memory, or processor.

 

Procedure 1: Configure DHCP performance logging using performance logs and alerts console

  1. On the Start menu, click Run, and type perfmon.msc
  2. In the left tree view, expand the Performance Logs and Alerts branch, and click Counter Logs. The right pane will display all log settings.
  3. Right-click Counter Logs, and select New Log Settings.
  4. Enter a name such as “DHCP Service Performance” and click OK.
  5. Click the Add Objects button, which brings up the Add Objects dialog box.
  6. Click the Select Counter objects from computer radio button, and select or enter the appropriate DHCP server in the pull-down box.
  7. In the Performance objects: selector, click DHCP Server, click Add, and then click Close. A new counter should be added to the DHCP Service Performance window.
  8. In the Sample data every: area, specify an appropriate interval, such as 10 minutes.
  9. Select the Log Files tab on this window.
  10. In Log file type: select Text File (Comma delimited), and click Configure.
  11. Specify the appropriate location for the log file. Ideally, this should be a remote directory from a reliable file server with ample disk space to store three to five months' worth of DHCP service performance logs.
  12. In the File name: enter an appropriate name, such as “DhcpSvcPerf” and verify that the log file size is set to Maximum limit. Click OK.
  13. Enable End File names with: and select [yyyymmdd] in the pull-down selector.
  14. Add an appropriate comment, such as “DHCP Service Perf Log v1.”
  15. Click Apply, and then OK.

Procedure 2: Capture DHCP performance logging via custom WMI VBScript

  1. Right-click the newly created counter log from Procedure 1, and select Start.
  2. Copy and paste the script below to Notepad.exe and save to a file such as “DhcpServicePerf.vbs.” The script illustrates the collection of performance information similar to Procedure 1 above. This script does not continuously collect and store formatted performance information, but serves as a sample base for writing an operations script that may be integrated with an enterprise Management Pack.
  3. Run the script by typing the following command:
    cscript //nologo DHCPServicePerf.vbs

Script Listing:

rem – DHCP Service Performance Basic Collector ---------------------

On Error Resume Next 

rem ---------------------------------------------------------------------------------
rem -- List all DHCP Servers in the strDHCPServer array in quotes
rem -- and separated by commas. use "." for localsystem.
rem --
rem -- Example:
rem -- strDHCPServer=array("dhcpsvr01","dchpsvr02","192.168.23.21")
rem --

arrDHCPSvr = array( ".","dhcpsvr01")

rem ---------------------------------------------------------------------------------

For Each strComputer in arrDHCPsvr 

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_PerfRawData_DHCPServer_DHCPServer",,48)
For Each objItem in colItems
rem -- Timing Objects---------------------------------------------
Wscript.Echo "Name: " & objItem.Name
Wscript.Echo "Timestamp_Object: " & objItem.Timestamp_Object
Wscript.Echo "Timestamp_PerfTime: " & objItem.Timestamp_PerfTime
Wscript.Echo "Timestamp_Sys100NS: " & objItem.Timestamp_Sys100NS

rem --Log Events Similar to What is Captured in Performance Logs and Alerts Console -------
Wscript.Echo "AcksPersec: " & objItem.AcksPersec
Wscript.Echo "ActiveQueueLength: " & objItem.ActiveQueueLength
Wscript.Echo "ConflictCheckQueueLength: " & objItem.ConflictCheckQueueLength
Wscript.Echo "DeclinesPersec: " & objItem.DeclinesPersec
Wscript.Echo "DiscoversPersec: " & objItem.DiscoversPersec
Wscript.Echo "DuplicatesDroppedPersec: " & objItem.DuplicatesDroppedPersec
Wscript.Echo "InformsPersec: " & objItem.InformsPersec
Wscript.Echo "MillisecondsperpacketAvg: " & objItem.MillisecondsperpacketAvg
Wscript.Echo "NacksPersec: " & objItem.NacksPersec
Wscript.Echo "OffersPersec: " & objItem.OffersPersec
Wscript.Echo "RequestsPersec: " & objItem.RequestsPersec

rem --Additional Events -------
Wscript.Echo "Frequency_Object: " & objItem.Frequency_Object
Wscript.Echo "Frequency_PerfTime: " & objItem.Frequency_PerfTime
Wscript.Echo "Frequency_Sys100NS: " & objItem.Frequency_Sys100NS
Wscript.Echo "PacketsExpiredPersec: " & objItem.PacketsExpiredPersec
Wscript.Echo "PacketsReceivedPersec: " & objItem.PacketsReceivedPersec
Wscript.Echo "ReleasesPersec: " & objItem.ReleasesPersec

Next 

Next
rem – END OF SCRIPT --

  1. To format the script similar to the PerfMon format:

a. At the top of the script add the following lines:

m=Month(Now)
d=Day(Now)
s=Second(Now)
If (m<10) Then
m="0" & m
End If
If (d<10) Then
d="0" & d
End If
If (s<10) Then
s="0" & s
End If
strFormattedDate = chr(34) & m & "/" & d & "/" & Year(Now) & " " & Hour(Now) & ":" & Minute(Now) & ":" & s & ".000" & chr(34)

b. After the line “For Each objItem in colItems” all the way to “Next” are the output commands to echo the results to screen. Select the objects you would like to log and replace the “Wscript.Echo …” lines with one concatenated and formatted output including formatting such as “ (quotes) represented by chr(34) and , (commas).

For example, to create a PerfMon-style output for DHCP Nacks/sec, Offers/sec, and Requests/sec, the result would be:


For Each objItem in colItems
Wscript.Echo strFormattedDate & “,” & chr(34) & objItem.NacksPersec & chr(34) &“,” & chr(34) & objItem.OffersPersec & chr(34) & “,” & chr(34) &objItem.RequestsPersec & chr(34)
Next

Dependencies

None

Technology Required

  • Base DHCP Windows Server 2003
  • WMI infrastructure
  • Windows Script Host