1

I have a Virtual Machine Scale Set (VMSS) with autoscaling rules. I can get the performance metrics of a host but there is no graph for instances count.

Metrics

There is a graph on VMSS settings "Scaling" -> "Run history", like this.

Scaling History

But how I can get it from Metrics and place on the dashboard?

Peter Bons
  • 26,826
  • 4
  • 50
  • 74
Evgeniy
  • 564
  • 5
  • 14
  • 1
    what makes you think its possible? why would app insights capture azure platform data? – 4c74356b41 Aug 08 '18 at 05:48
  • Ok, it could be not Appinsight but Azure Monitor. The goal is get this metric into [Grafana dashboard](https://azure.microsoft.com/en-us/blog/monitor-azure-services-and-applications-using-grafana/) – Evgeniy Aug 08 '18 at 08:08

4 Answers4

3

By default, having a VMSS does not emit anything to Application Insights (AI) unless you configure an app / platform (like Service Fabric for example) to use AI.

So, if you do have software running on the VMSS that emits to AI then you could write an AI analytics query to get the instance count like this:

requests
| summarize dcount(cloud_RoleInstance) by bin(timestamp, 1h) 

Typically cloud_RoleInstance contains a VM identifier so that is what I used in the query. It does show the distinct count of VMs.

This only works reliable if the software runs on all VMs in the VMSS and if all VMs emit data to AI at least once an hour. Of course you can adapt the script to your liking / requirements.

operators used:
dcount: counts the unique occurences of the specified field
bin: group results in slots of 1 hour

Peter Bons
  • 26,826
  • 4
  • 50
  • 74
2

Thanks Peter Bons, it's that I need!

As I run Docker on the VM I can add OMS agent container and use it's data.

This is what I wanted. ContainerInventory | where TimeGenerated >= ago(3h) | where Name contains "frontend" | summarize dcount(Computer) by bin(TimeGenerated, 5m)

enter image description here

Evgeniy
  • 564
  • 5
  • 14
0

On Azure portal, navigate to VMSS, select required VMSS -> Scaling under Settings from left-navigation-panel -> Click on 'Run History' tab on right-side-panel

GKV
  • 29
  • 3
0

The easy way is after you have gone to the 'Run History' tab just click the 'Pin to Dashboard' button. You can see this button in the image supplied in the question.

Chris
  • 1
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/33613851) – Woody1193 Jan 18 '23 at 00:21