Use Zabbix to monitor your .NET CLR Garbage Collected heap

Use Zabbix to monitor your .NET CLR Garbage Collected heap.

Whether you run a .NET web application or administer a webserver that hosts .NET web applications, it is important to keep an eye out for memory usage. As developers and systems administrators we're all too familiar with OutOfMemoryException. As the name suggests, the exception is thrown when a .NET application runs out of memory, something you don't want to happen.

Fortunately, you can use Zabbix and a bit of PowerShell and CIM (Common Information Model - successor to WMI or Windows Management Interface) to query various bits 'n pieces in the Windows Server operating system and .NET pipeline. Some key metrics to keep an eye out are:

  • AllocatedBytesPersec
  • Gen0heapsize
  • Gen0PromotedBytesPerSec
  • Gen1heapsize
  • Gen1PromotedBytesPerSec
  • Gen2heapsize
  • LargeObjectHeapsize
  • NumberTotalcommittedBytes
  • NumberTotalreservedBytes
  • PercentTimeinGC

You find these in the Win32_PerfRawData_NETFramework_NETCLRMemory performance counter. But you need a bit of PowerShell to get the right data. 

The post Monitor .NET CLR Garbage Collected heap from your web application provides you with all relevant information, Powershell script parts and Zabbix items to monitor these memory related metrics.

Keeping track of .NET memory usage enables you to optimize usage and performance further.