Add Custom Performance Counters Log Analytics

Did you know you can add any performance counter found in Performance Monitor on your Windows servers to Log Analytics work space in Azure Monitor? Yea I didn’t either. I’ve been working on a project for Microsoft Consulting Services working with a MS Product Group, all of which is under NDA. However, I can tell you about this nugget I learned. We were doing a demo and someone from the PG says yea, just add it. We responded, just add it, what? And he says yea just add it, and then showed us under Advanced settings in Log Analytics. You add them the exact same way as all other perf counters. So I’ll show you how to add custom performance counters from Performance Monitor.

Find Your Counter in Perf Mon

Opening up Performance Monitor on your server clicking the green plus opens up the Add Counters menu.

So here I’m adding Storage Spaces Virtual Disk, Virtual Disk Active Bytes. You need to note this information, because Storage Spaces Virtual Disk is the Object Name, and Virtual Disk Active Bytes is the Counter Name, both of which we need when we add them to Log Analytics. Just for fun I also added OpsMgr Connector, Bytes Transmitted, because I was looking for objects that aren’t already populated within Log Analytics. If you’ve ever looked you know there are a ton of counters available in there already.

 

Add Counters to Log Analytics

Trying to add the OpsMgr counter turns up zero counters or even any objects what so ever.

 

You can see there are a bunch of Storage Spaces objects, but no Storage Spaces Virtual Disk objects

Adding them looks like this

OpsMgr Connector(*)\Bytes Transmitted

Storage Spaces Virtual Disk(*)\Virtual Disk Active Bytes

 

Unfortunately it doesn’t appear you can do something like this: Storage Spaces Virtual Disk(*)\(*) and get all counters.

 

Perf Table Additions

Naturally, the counters are added to the Perf table. If added correctly they will show up sometimes in 5 to 10 minutes in my experience.

 

Using the distinct operator we can figure out when the new counters have come in.

Looking at what the Storage Spaces Virtual Disk gives we get all the instances (each disk per machine that has virtual disks), the counter path and I went ahead and converted the bytes to MB for easier parsing.

 

So next time you need an obscure counter remember you can add custom performance counters to Log Analytics. Don’t forget to tune them, Perf counters are by far the biggest cost in Log Analytics.

Hi, I’m Billy York.  I’m a Cloud and Datacenter Engineer, specializing in monitoring and automation. Here you’ll find posts about System Center Operations Manager, Powershell, Hyper-V, Azure Automation, Azure Log Analytics and other Microsoft related technologies.