Skip to content

Instantly share code, notes, and snippets.

@wgv-zbonham
Last active June 4, 2016 15:38
Show Gist options
  • Save wgv-zbonham/b0cb9bb585bea453ed18a4e63cc4d8cb to your computer and use it in GitHub Desktop.
Save wgv-zbonham/b0cb9bb585bea453ed18a4e63cc4d8cb to your computer and use it in GitHub Desktop.
Managing Performance Counters

The attached counter set is just the ‘System Performance’ template with ‘Logical Disk’ counters added. The sample interval has been changed to 15 seconds. The counters are collected at c:\perflogs\admin\EL4. You need to be running under an account that is in the Administrator role for servers we are publishing counter sets to.

The perfmon template, el4perf.xml, is assumed to be in the current working directory.

From an administrator PowerShell command prompt:

To publish this counter set to a server:

logman import –n EL4 –xml .\el4perf.xml –s SERVERNAME

To Start collecting performance information:

logman start EL4 –s SERVERNAME

To Stop collecting performance information:

logman stop EL4 –s SERVERNAME

Put it all together when managing an environment:

$servers = “server1”, “server2”, “serverN”

Publish to all servers:

$servers | %{ logman import -n EL4 -xml .\el4perf.xml -s $_ }

Start collecting on all servers:

$servers | %{ logman start EL4 –s $_ }

Stop collecting on all servers:

$servers | %{ logman start EL4 –s $_ }

Collect data from all servers:

 $servers | %{ xcopy \\$_\C$\perflogs\admin\el4 d:\perflogs /s /i /y }

Delete all data from servers:

$servers | %{ RMDIR \\zachbonham\C$\perflogs\admin\el4 -recurse }

Remove all performance counter log from servers:

$servers | %{ logman delete EL4 -s $_ }
<?xml version="1.0" encoding="UTF-16"?>
<DataCollectorSet>
<Status>0</Status>
<Duration>0</Duration>
<Description>Generate a report detailing the status of local hardware resources, system response times, and processes on the local computer. Use this information to identify possible causes of performance issues. Membership in the local Administrators group, or equivalent, is the minimum required to run this Data Collector Set.</Description>
<DescriptionUnresolved>Generate a report detailing the status of local hardware resources, system response times, and processes on the local computer. Use this information to identify possible causes of performance issues. Membership in the local Administrators group, or equivalent, is the minimum required to run this Data Collector Set.</DescriptionUnresolved>
<DisplayName>
</DisplayName>
<DisplayNameUnresolved>
</DisplayNameUnresolved>
<SchedulesEnabled>-1</SchedulesEnabled>
<Keyword>CPU</Keyword>
<Keyword>Memory</Keyword>
<Keyword>Disk</Keyword>
<Keyword>Network</Keyword>
<Keyword>Performance</Keyword>
<LatestOutputLocation>C:\PerfLogs\Admin\EL4\ZACHBONHAM_20160604-000006</LatestOutputLocation>
<Name>EL4</Name>
<OutputLocation>C:\PerfLogs\Admin\EL4\ZACHBONHAM_20160604-000007</OutputLocation>
<RootPath>%systemdrive%\PerfLogs\Admin\EL4</RootPath>
<Segment>0</Segment>
<SegmentMaxDuration>0</SegmentMaxDuration>
<SegmentMaxSize>0</SegmentMaxSize>
<SerialNumber>7</SerialNumber>
<Server>
</Server>
<Subdirectory>
</Subdirectory>
<SubdirectoryFormat>3</SubdirectoryFormat>
<SubdirectoryFormatPattern>yyyyMMdd\-NNNNNN</SubdirectoryFormatPattern>
<Task>
</Task>
<TaskRunAsSelf>0</TaskRunAsSelf>
<TaskArguments>
</TaskArguments>
<TaskUserTextArguments>
</TaskUserTextArguments>
<UserAccount>SYSTEM</UserAccount>
<Security>O:BAG:DUD:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;FR;;;LU)(A;;0x1301ff;;;S-1-5-80-2661322625-712705077-2999183737-3043590567-590698655)(A;ID;0x1f019f;;;BA)(A;ID;0x1f019f;;;SY)(A;ID;FR;;;AU)(A;ID;FR;;;LS)(A;ID;FR;;;NS)(A;ID;FA;;;BA)</Security>
<StopOnCompletion>0</StopOnCompletion>
<TraceDataCollector>
<DataCollectorType>1</DataCollectorType>
<Name>NT Kernel</Name>
<FileName>NtKernel</FileName>
<FileNameFormat>0</FileNameFormat>
<FileNameFormatPattern>
</FileNameFormatPattern>
<LogAppend>0</LogAppend>
<LogCircular>0</LogCircular>
<LogOverwrite>0</LogOverwrite>
<LatestOutputLocation>C:\PerfLogs\Admin\EL4\ZACHBONHAM_20160604-000006\NtKernel.etl</LatestOutputLocation>
<Guid>{00000000-0000-0000-0000-000000000000}</Guid>
<BufferSize>64</BufferSize>
<BuffersLost>0</BuffersLost>
<BuffersWritten>0</BuffersWritten>
<ClockType>1</ClockType>
<EventsLost>0</EventsLost>
<ExtendedModes>0</ExtendedModes>
<FlushTimer>0</FlushTimer>
<FreeBuffers>0</FreeBuffers>
<MaximumBuffers>200</MaximumBuffers>
<MinimumBuffers>0</MinimumBuffers>
<NumberOfBuffers>0</NumberOfBuffers>
<PreallocateFile>0</PreallocateFile>
<ProcessMode>0</ProcessMode>
<RealTimeBuffersLost>0</RealTimeBuffersLost>
<SessionName>NT Kernel Logger</SessionName>
<SessionThreadId>0</SessionThreadId>
<StreamMode>1</StreamMode>
<TraceDataProvider>
<DisplayName>{9E814AAD-3204-11D2-9A82-006008A86939}</DisplayName>
<FilterEnabled>0</FilterEnabled>
<FilterType>0</FilterType>
<Level>
<Description>Events up to this level are enabled</Description>
<ValueMapType>1</ValueMapType>
<Value>0</Value>
<ValueMapItem>
<Key>
</Key>
<Description>
</Description>
<Enabled>-1</Enabled>
<Value>0x0</Value>
</ValueMapItem>
</Level>
<KeywordsAny>
<Description>Events with any of these keywords are enabled</Description>
<ValueMapType>2</ValueMapType>
<Value>0x10303</Value>
<ValueMapItem>
<Key>
</Key>
<Description>
</Description>
<Enabled>-1</Enabled>
<Value>0x1</Value>
</ValueMapItem>
<ValueMapItem>
<Key>
</Key>
<Description>
</Description>
<Enabled>-1</Enabled>
<Value>0x2</Value>
</ValueMapItem>
<ValueMapItem>
<Key>
</Key>
<Description>
</Description>
<Enabled>-1</Enabled>
<Value>0x100</Value>
</ValueMapItem>
<ValueMapItem>
<Key>
</Key>
<Description>
</Description>
<Enabled>-1</Enabled>
<Value>0x200</Value>
</ValueMapItem>
<ValueMapItem>
<Key>
</Key>
<Description>
</Description>
<Enabled>-1</Enabled>
<Value>0x10000</Value>
</ValueMapItem>
</KeywordsAny>
<KeywordsAll>
<Description>Events with all of these keywords are enabled</Description>
<ValueMapType>2</ValueMapType>
<Value>0x0</Value>
</KeywordsAll>
<Properties>
<Description>These additional data fields will be collected with each event</Description>
<ValueMapType>2</ValueMapType>
<Value>0</Value>
</Properties>
<Guid>{9E814AAD-3204-11D2-9A82-006008A86939}</Guid>
</TraceDataProvider>
</TraceDataCollector>
<PerformanceCounterDataCollector>
<DataCollectorType>0</DataCollectorType>
<Name>Performance Counter</Name>
<FileName>Performance Counter</FileName>
<FileNameFormat>1</FileNameFormat>
<FileNameFormatPattern>
</FileNameFormatPattern>
<LogAppend>0</LogAppend>
<LogCircular>0</LogCircular>
<LogOverwrite>0</LogOverwrite>
<LatestOutputLocation>C:\PerfLogs\Admin\EL4\ZACHBONHAM_20160604-000006\Performance Counter.blg</LatestOutputLocation>
<DataSourceName>
</DataSourceName>
<SampleInterval>15</SampleInterval>
<SegmentMaxRecords>0</SegmentMaxRecords>
<LogFileFormat>3</LogFileFormat>
<Counter>\Process(*)\*</Counter>
<Counter>\PhysicalDisk(*)\*</Counter>
<Counter>\Processor(*)\*</Counter>
<Counter>\Processor Performance(*)\*</Counter>
<Counter>\Memory\*</Counter>
<Counter>\System\*</Counter>
<Counter>\Server\*</Counter>
<Counter>\Network Interface(*)\*</Counter>
<Counter>\TCPv4\*</Counter>
<Counter>\TCPv6\*</Counter>
<Counter>\IPv6\*</Counter>
<Counter>\LogicalDisk(*)\*</Counter>
<CounterDisplayName>\Process(*)\*</CounterDisplayName>
<CounterDisplayName>\PhysicalDisk(*)\*</CounterDisplayName>
<CounterDisplayName>\Processor(*)\*</CounterDisplayName>
<CounterDisplayName>\Processor Performance(*)\*</CounterDisplayName>
<CounterDisplayName>\Memory\*</CounterDisplayName>
<CounterDisplayName>\System\*</CounterDisplayName>
<CounterDisplayName>\Server\*</CounterDisplayName>
<CounterDisplayName>\Network Interface(*)\*</CounterDisplayName>
<CounterDisplayName>\TCPv4\*</CounterDisplayName>
<CounterDisplayName>\TCPv6\*</CounterDisplayName>
<CounterDisplayName>\IPv6\*</CounterDisplayName>
<CounterDisplayName>\LogicalDisk(*)\*</CounterDisplayName>
</PerformanceCounterDataCollector>
<DataManager>
<Enabled>-1</Enabled>
<CheckBeforeRunning>-1</CheckBeforeRunning>
<MinFreeDisk>200</MinFreeDisk>
<MaxSize>1024</MaxSize>
<MaxFolderCount>100</MaxFolderCount>
<ResourcePolicy>0</ResourcePolicy>
<ReportFileName>report.html</ReportFileName>
<RuleTargetFileName>report.xml</RuleTargetFileName>
<EventsFileName>
</EventsFileName>
<Rules>
<Logging level="15" file="rules.log">
</Logging>
<Import file="%systemroot%\pla\rules\Rules.System.Common.xml">
</Import>
<Import file="%systemroot%\pla\rules\Rules.System.Summary.xml">
</Import>
<Import file="%systemroot%\pla\rules\Rules.System.Performance.xml">
</Import>
<Import file="%systemroot%\pla\rules\Rules.System.CPU.xml">
</Import>
<Import file="%systemroot%\pla\rules\Rules.System.Network.xml">
</Import>
<Import file="%systemroot%\pla\rules\Rules.System.Disk.xml">
</Import>
<Import file="%systemroot%\pla\rules\Rules.System.Memory.xml">
</Import>
</Rules>
<ReportSchema>
<Report name="systemPerformance" version="1" threshold="100">
<Import file="%systemroot%\pla\reports\Report.System.Common.xml">
</Import>
<Import file="%systemroot%\pla\reports\Report.System.Summary.xml">
</Import>
<Import file="%systemroot%\pla\reports\Report.System.Performance.xml">
</Import>
<Import file="%systemroot%\pla\reports\Report.System.CPU.xml">
</Import>
<Import file="%systemroot%\pla\reports\Report.System.Network.xml">
</Import>
<Import file="%systemroot%\pla\reports\Report.System.Disk.xml">
</Import>
<Import file="%systemroot%\pla\reports\Report.System.Memory.xml">
</Import>
</Report>
</ReportSchema>
<FolderAction>
<Size>0</Size>
<Age>1</Age>
<Actions>3</Actions>
<SendCabTo>
</SendCabTo>
</FolderAction>
<FolderAction>
<Size>0</Size>
<Age>56</Age>
<Actions>8</Actions>
<SendCabTo>
</SendCabTo>
</FolderAction>
<FolderAction>
<Size>0</Size>
<Age>168</Age>
<Actions>26</Actions>
<SendCabTo>
</SendCabTo>
</FolderAction>
</DataManager>
<Value name="PerformanceMonitorView" type="document">
<OBJECT ID="DISystemMonitor" CLASSID="CLSID:C4D2D8E0-D1DD-11CE-940F-008029004347">
<PARAM NAME="CounterCount" VALUE="4">
</PARAM>
<PARAM NAME="Counter00001.Path" VALUE="\Processor(_Total)\% Processor Time">
</PARAM>
<PARAM NAME="Counter00001.Color" VALUE="255">
</PARAM>
<PARAM NAME="Counter00001.Width" VALUE="2">
</PARAM>
<PARAM NAME="Counter00001.LineStyle" VALUE="0">
</PARAM>
<PARAM NAME="Counter00001.ScaleFactor" VALUE="0">
</PARAM>
<PARAM NAME="Counter00001.Show" VALUE="1">
</PARAM>
<PARAM NAME="Counter00001.Selected" VALUE="1">
</PARAM>
<PARAM NAME="Counter00002.Path" VALUE="\Memory\Pages/sec">
</PARAM>
<PARAM NAME="Counter00002.Color" VALUE="65280">
</PARAM>
<PARAM NAME="Counter00002.Width" VALUE="1">
</PARAM>
<PARAM NAME="Counter00003.Path" VALUE="\PhysicalDisk(_Total)\Avg. Disk sec/Read">
</PARAM>
<PARAM NAME="Counter00003.Color" VALUE="16711680">
</PARAM>
<PARAM NAME="Counter00003.Width" VALUE="1">
</PARAM>
<PARAM NAME="Counter00004.Path" VALUE="\PhysicalDisk(_Total)\Avg. Disk sec/Write">
</PARAM>
<PARAM NAME="Counter00004.Color" VALUE="55295">
</PARAM>
<PARAM NAME="Counter00004.Width" VALUE="1">
</PARAM>
</OBJECT>
</Value>
</DataCollectorSet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment