Why do I get the following exception from Gibraltar Loupe Agent and what can I do about it?


Caption Unable to record performance information for network counters
Class Gibraltar.Monitor.Net.PerformanceMonitor
Method InitializeNetworkCounters
Specific exception System.UnauthorizedAccessException
Exception message Access to the registry key 'Global' is denied
Stack Trace   at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str)
  at Microsoft.Win32.RegistryKey.InternalGetValue(String name, Object defaultValue, Boolean doNotExpand, Boolean checkSecurity)
  at Microsoft.Win32.RegistryKey.GetValue(String name)
  at System.Diagnostics.PerformanceMonitor.GetData(String item)
  at System.Diagnostics.PerformanceCounterLib.GetPerformanceData(String item)
  at System.Diagnostics.PerformanceCounterLib.get_CategoryTable()
  at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String category)
  at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
  at System.Diagnostics.PerformanceCounterCategory.GetCounterInstances(String categoryName, String machineName)
  at System.Diagnostics.PerformanceCounterCategory.GetInstanceNames()
  at Gibraltar.Monitor.Net.PerformanceMonitor.InitializeNetworkCounters() 

That error is typical when the application is running as a low-privileged user. Basically, the agent doesn't have sufficient access to record network performance information. This information isn't necessary for Loupe Server communication to work or for Agent functionality other than gathering performance metrics on the network interfaces of the computer.

There are basically three things you can do:


  1. Turn off the network performance counters by setting the enableNetworkPerformance option of the listener configuration to false. No more warning (but no counters either) 
     
  2. Ignore the warning and leave the configuration set so it'll make a best effort attempt to gather them, but will fail when the user doesn't have access (like now) 
     
  3. Grant access by adding the user that is running your application to the Performance Monitor Users group, Performance Log Users group, or equivalent.  See technet for more details.