Have you ever wanted to monitor or set up alerts for Service Fabric applications and its services when it crosses certain threshold in terms of memory or CPU utilization? Then this blog will help you set up performance counters for Service Fabric services and further you can set up alerts based on trigger condition.
Note:
I would strongly suggest to review How to set up Azure Monitor in Service Fabric Cluster to monitor and diagnose a cluster using events... if you’re looking for setting up Log Analytics for monitoring SF cluster based on Service Fabric events.
You can follow the below steps to enable performance counters for individual services:
Go to https://resources.azure.com/ -> Subscription -> Resource Group -> Microsoft.Compute -> Click on associated VMSS resource name.
You need to install the extension with following details on all VMSS associated with a particular cluster:
{
"name": "OMSExtension",
"properties": {
"autoUpgradeMinorVersion": true,
"publisher": "Microsoft.EnterpriseCloud.Monitoring",
"type": "MicrosoftMonitoringAgent",
"typeHandlerVersion": "1.0",
"settings": {
"workspaceId": "enter workspace id here",
"stopOnMultipleConnections": "true"
},
"protectedSettings": {
"workspaceKey": "enter Key value"
}
}
}
Do a PATCH operation using above details on the VMSS:
A service fabric application consists of multiple services, those services run as a process inside the VM, with these performance counters, you can see memory and CPU utilization of each process per node.
Few examples query:
Perf
| where TimeGenerated > ago(30m)
| where CounterName == "Working Set"
| project TimeGenerated, CounterName, CounterValue, Computer, InstanceName
| summarize UsedMemory = avg(CounterValue) by CounterName, bin(TimeGenerated, 1m), Computer, InstanceName
Perf
| where TimeGenerated > ago(15m)
| where ( ObjectName == "Process" ) and CounterName == "% Processor Time"
| summarize AggregatedValue = avg(CounterValue) by Computer, InstanceName
| render table
For more on queries, you can check here: https://docs.microsoft.com/en-us/azure/azure-monitor/logs/get-started-queries
You can tweak the query based on your requirement and then can set up alerts by clicking on “New Alert Rule” in the query editor.
While with above, you can monitor the CPU/Memory utilization of the services, do check the Log Analytics pricing for cost of using this performance counters feature. Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.