Working with Data Collector Sets
In addition to the provided Data
Collector Sets, you can also create user-defined Data Collector Sets
consisting of your own counters and settings. Real-time monitoring is
great when a quick snapshot is required, but it can be difficult to
identify patterns and trends when observing a server “live.” It’s
usually more convenient to capture performance data to a file and then
analyze that log file . This section walks through
configuring a user-defined Data Collector Set to monitor system
performance.
User-defined Data Collector Sets in Windows
Server 2008 replace the Performance Logs and Alerts from Windows
2000/2003 but the principle is the same. To access them, from
Reliability and Performance Monitor select Data Collector Sets.
Right-click User Defined and choose New ⇒ Data Collector Set. A short
wizard launches to create the new collector set. The first choice is to
create from a template or create manually. Creating a collector set
from a template provides three template collectors: Basic, System
Diagnostics, and System Performance. You can use these templates as a
starting point, adding and removing counters as required. Because these
templates are Windows-generic, there’s nothing especially interesting
about them from a SQL Server perspective. Therefore, choose the second
option, Create manually (Advanced), and give the new collector a useful
name, as shown in Figure 5.
The next step is to select Create Data Logs or
Performance Counter Alerts. In most situations you’ll use the
Performance Counter data log because you will likely be interested in
gathering some system-wide performance data, rather than use PerfMon to
fire an alert when a threshold is exceeded. Three types of data can be
captured in the data log, as summarized in Table 2.
TABLE 2: Data Collector Set Logging Options
LOG TYPE |
DESCRIPTION |
Performance counter |
Provides performance data for most aspects of Windows and SQL Server |
Event trace data |
Uses event tracing for Windows to provide low-level operating system tracing |
System configuration information |
Captures Registry keys |
After selecting Create Data Logs, select the
Performance counter log type and click Next to continue. Now you’ll add
a small selection of interesting counters to get an overview of system
performance. Click Add, and select all counters as shown in Figure 6. Leave the sample interval at 15 seconds; the impact of the sampling interval is covered in the next section.
After adding the counters, select a folder to
store the trace data. Ensure there is sufficient space on the disk to
hold the trace file (the size depends on how long the trace is running
but normally 2GB of free space should be fine for a few hours of
tracing). Click Next when you have entered a location for the logs. At
the final confirmation dialog, click Finish to create the collector.
Starting, Stopping, and Scheduling Collectors
At this point, the data collector has
been defined, but no data has actually been captured because the
collector has not been started. To start a collector, right-click on
the collector name and choose Start. Collectors with no stop condition
configured will run until they are stopped manually. To stop the
collector, right-click on the collector name and choose Stop.
Collectors can be started and stopped as a whole, but performance logs
or traces within a collector cannot be started independently of the
collector. Define a new collector if this is required.
You can schedule collectors using the Schedule
tab on the collector properties. When combined with a stop condition,
both starting and stopping a collector can be fully scheduled.
Configuring Collector Properties
There are two points of interest in the
properties dialog. One is the Directory tab, where you can change the
folder used to store the log files. The other is the Stop Condition
tab, which enables administrators to configure the duration of the
collector — in seconds, minutes, hours, days, or weeks. Once the time
configured in the stop condition has elapsed, the collector is
automatically stopped.
Other points of interest on the collector
properties dialog include the Schedule tab, which as it suggests
enables administrators to schedule the start of the collector. There’s
also a Task tab, where you can configure a task to run when the data
collector stops, such as sending a MSG (new version of NET SEND) on
completion.
Configuring Properties for Performance Counters
You may have noticed that there is no
place in the collector properties to add or remove PerfMon counters —
that’s because they are found in the Performance Counter properties.
Because collectors can contain multiple data sources (listed in the
right-hand pane), these properties are specific to each log type.
Locate the Performance Counter log (usually named DataCollector01) and
double-click it to show the properties.
Use the Performance Counter properties to modify
log parameters, such as adding and removing counters, and changing log
format and sample interval. The File tab contains further settings,
including a checkbox to prefix log files with the computer name; this
is particularly useful when comparing logs from multiple servers
because it saves time opening files to identify the source server.
PerfMon Log Formats
There are four options for PerfMon log
format: Comma Separated, Tab Separated, SQL, and Binary. The Binary log
(BLG) type is the default and is suitable for most situations. Choosing
SQL will require a data source name (DSN) to connect to SQL Server.
There are some performance considerations when using this method
because you want to limit the impact of monitoring to genuine users or
server activity, and outputting trace data to the same instance being
monitored is unlikely to help. Performance log files can be imported
into a database post-capture for easier/better analysis, so avoid
logging directly to SQL Server, unless there’s a good reason to do so
and you’re confident you understand any impact on the monitored
instance.
Using the Relog.exe tool it’s possible to
manipulate log files, converting files between types; and if you’re
working with large log files, you can narrow the time frame or extract
some interesting counters.