Deploy Performance Counter Categories and Counters with the PerformanceCounterlnstaller Component
The easiest way to incorporate performance counters in your .NET application is to use PerformanceCounter components. You can use these components to read values from existing predefined counters, such as memory or processor counters, and you can also read from and write to custom counters that you create. For example, you might use the Server Explorer to create a new performance counter category named MyApp, and then create counters for monitoring your application performance, such as NumFilesOpen for the number of files that are in use, and UserCons for how many users are currently connected, and so on.
If you create custom counters, you need to ensure that they are deployed with your application. Registry entries need to be added to your production computers for custom categories and counters. The easiest way to deploy these counters and categories is to use PerformanceCounterInstaller components for your PerformanceCounter components. You can run the installation component either as a custom action in your Windows Installer file or with the Installutil.exe utility.
When deploying performance counters with your application, you should be aware that:
• Performance counters are supported only on the following platforms:
• Windows NT Workstation 4.0
• Windows XP Home Edition
• Windows XP Professional
• Windows .NET Server family
• Performance counters need to be created by security accounts with administrative privileges — the easiest way to ensure this is to have your Windows Installer file run by an administrator, or to have an administrator run the Installutil.exe utility to install your performance counter.
Post a comment