Dec 15 2017
- last edited on
Apr 07 2022
I have DSC linked to OMS to retrieve logs of machine status and whatnot. What I'm looking for is the ability to show the DSC compliance status of the machines connected.
So, let's say I have 4 machines (PC1, PC2, PC3 and PC4). I would like to know under a category how many machines are either; Failed, Compliant, Started, Completed, In Progress, Suspended, NotCompliant and Pending (as which has been pulled by the ResultType). Something like:
Failed - 1
Compliant - 2
In Progress - 1
I've got as far as this below, but I'm absolutely useless in trying to figure a way to summarise by ResultType without getting 1,000 of counts, or 1,000 of total results, or nothing at all! Please help, the new syntax doesn't have much online documentation to help newbies like me.
Dec 18 2017 09:48 AMSolution
You're actually very close to the syntax you need, if I got you correctly I think this is it:
Also, you might want to check out our tutorial on aggregations, it's exactly on this topic, might help.
Dec 19 2017 02:04 AM
Legend, this was getting me close to what I wanted. I ended up doing:
AzureDiagnostics | summarize count() by Category == "DscNodeStatus", ResultType
Dec 19 2017 03:00 AM
If what you want is to count by ResultType, only for a specific Category, use this:
AzureDiagnostics | where Category == "DscNodeStatus" | summarize count() by ResultType
The syntax you used counts records per result type in other categories as well.