Section 11.3: Command-Line Monitoring Tools

Windows Server 2003 also provides a number of command-line tools to monitor performance. These are the logman utility (logman.exe), the relog utility (relog.exe), and the typeperf utility (typeperf.exe). You can use these command-line tools to monitor performance locally or on a remote computer.

11.3.1: The Logman Utility

You can use the logman command-line utility to manage and schedule performance counters and trace logs. You can use this utility on a remote computer provided you have the proper administrator credentials to access the remote computer. You can create, start, stop, delete, query, and update performance counters and traces using the logman command. The syntax for this command is:

Logman [create {<counter | trace>} <collection_name>] [start | stop | delete | update <collection_name>] [query <collection_name | providers>]

The parameters that make up the <coiiection_name> component are discussed in Table 11.2.

Table 11.2: Logman Collection Parameters

Switch Description
-s <server_name> The name of the computer on which you want to use logman.
-t config The name of the configuration file that contains all the logman parameters.
-b M/D/YYYY H:MM:SS The start time to collect data.
-e M/D/YYYY H:MM:SS The end time to collect data.
-m [start | stop] Manually starts or stops the trace or log. You cannot use this option with -e, -b, or -rt options.
-rt Specifies the trace is in "real time" mode. The trace is not from a trace log file.
-u <user_name> <password> The account credentials to be used to execute logman locally or remotely.
-o [<path> | <DSN_counter_log>] The output file and the path where the file is located.
-f {bin | bincirc | csv | tsv | SQL} Specifies the file format for counter logs or trace data. The format can be binary, circular binary, commas separated, tab separated or SQL database.
-max <value> Specifies the maximum size of the log. The logging will stop when the file exceeds this limit.
-c {<path> [<path ...>] | -cf <file_name>} Specifies the performance counter file path and name. You can also set these counters in text files and give the file location as the -cf parameter. Enclosing them in quotation marks and separating them with a space can specify multiple counters
-si [[HH]:MM:]SS The time interval for the performance counter in hours, minutes, and seconds. The default is 15 seconds.
11.3.2: The relog Utility

You can use the relog command-line utility to extract data from performance counter logs and convert it to tab separated value (. Tsv), Comma-Separated Value (.csv), binary log file (.blg), or SQL formats. This tool can also be used to create source data files for database manipulation tools. The syntax for this command is:

relog [<file_name> [<file_name> ...]] [option]

The options for the relog utility are discussed in Table 11.3.

Table 11.3: Relog Command Options

Option Description
-a Appends output to existing binary file.
-c {<path> [<path ...>] Counters to filter from input log.
-cf <file_name>} File listing counters to filter from input log.
-f {bin | csv | tsv | SQL} Specifies the file format for output file. The format can be binary, commas separated, tab separated or SQL database.
-t <number> Sets the frequency of logging to the output file in of records
-o <path> The output file and the path where the file is located.
-b M/D/YYYY H:MM:SS The start time to write records to the output file.
-e M/D/YYYY H:MM:SS The end time to write records to the output file.
-q List performance counters in the input file.
-y Answers "yes" to all questions without prompting.
11.3.3: The typeperf Utility

The typeperf command-line utility is similar to relog command-line utility. It allows you to write performance log file data onto a command window or a file. The syntax for this command is:

Typeperf {counter [counter ...] | [-cf <file_name> | [-q [object] | [-qx [object]} [options]

Table 11.4: Typeperf Command Parameters and Options

Option Description
counter [counter ...] Lists the performance counters to monitor.
-cf <file_name>} File listing counters monitor.
-q [object] Lists installed counters for the object without listing instances.
-qx [object] Lists installed counters and instances for the object.
-f {bin | csv | tsv | SQL} Specifies the file format for output file. The format can be binary, commas separated, tab separated or SQL database.
-si [[HH]:MM:]SS The time interval for the performance counter in hours, minutes, and seconds. The default is 1 second.
-o <path> The output file and the path where the file is located.
-sc <samples> Number of samples to collect.
-config <file_name> File containing command options.
-s <server_name> Specifies the server to monitor if not specified in the counter path.
-y Answers "yes" to all questions without prompting.