Last active
January 21, 2018 16:44
-
-
Save sunnyc7/094fd6ec1064409e5aa06985e0501b56 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// LogAnalytics function to query a performance counter (CounterName), in computer, starting on date Sart for a 30d period | |
// Copy paste the query in LogAnalytics window | |
// Define custom Loganalytics function | |
let PerfCountWithin30dRange = (start:date, CounterName:string, CompName:string) { | |
let period = 30d; | |
Perf | |
| where (TimeGenerated > start and TimeGenerated < start + period) | |
| where (Computer contains CompName) | |
| where CounterName == "User Count" | |
| summarize percentiles(CounterValue, 95) by bin(TimeGenerated, 15m) | |
| render timechart | |
}; | |
// VARIABLES | |
let start = ago(60d); | |
let comp = 'SERVERNAME'; | |
let perfcountername = "User Count"; | |
// Call the functions | |
PerfCountWithin30dRange(start, perfcountername, comp); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment