{"id":629,"date":"2009-05-10T23:03:10","date_gmt":"2009-05-10T21:03:10","guid":{"rendered":"http:\/\/contoso.se\/blog\/?p=629"},"modified":"2009-12-01T09:36:47","modified_gmt":"2009-12-01T07:36:47","slug":"performance-reports-and-groups","status":"publish","type":"post","link":"http:\/\/contoso.se\/blog\/?p=629","title":{"rendered":"Performance Reports and Groups"},"content":{"rendered":"<p>When running a performance report against a group you get a average value for all the members of the group. Often you need\u00c2\u00a0the report to specify each member of the group in the report. You can of course add each member of the group as object to the report. Another solution is to build a report where you can input a group. That will save you some time if you already have updated groups you want to run reports against. The following query can be run against a group that contains computer objects, it will then find the members of the group and run the report against each of them.<\/p>\n<p><img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/contoso.se\/files\/perfReport01.JPG\" alt=\"\" \/><\/p>\n<p><code><br \/>\nSELECT vManagedEntity.ManagedEntityGuid, vManagedEntityTypeImage.Image, Perf.vPerfHourly.DateTime, Perf.vPerfHourly.SampleCount, Perf.vPerfHourly.AverageValue,<br \/>\nPerf.vPerfHourly.StandardDeviation, Perf.vPerfHourly.MaxValue, vManagedEntity.FullName, vManagedEntity.Path, vManagedEntity.Name,<br \/>\nvManagedEntity.DisplayName, vManagedEntity.ManagedEntityDefaultName, vPerformanceRuleInstance.InstanceName, vPerformanceRule.ObjectName,<br \/>\nvPerformanceRule.CounterName<br \/>\nFROM Perf.vPerfHourly INNER JOIN<br \/>\nvManagedEntity ON Perf.vPerfHourly.ManagedEntityRowId = vManagedEntity.ManagedEntityRowId INNER JOIN<br \/>\nvManagedEntityType ON vManagedEntity.ManagedEntityTypeRowId = vManagedEntityType.ManagedEntityTypeRowId LEFT OUTER JOIN<br \/>\nvManagedEntityTypeImage ON vManagedEntityType.ManagedEntityTypeRowId = vManagedEntityTypeImage.ManagedEntityTypeRowId INNER JOIN<br \/>\nvPerformanceRuleInstance ON vPerformanceRuleInstance.PerformanceRuleInstanceRowId = Perf.vPerfHourly.PerformanceRuleInstanceRowId INNER JOIN<br \/>\nvPerformanceRule ON vPerformanceRuleInstance.RuleRowId = vPerformanceRule.RuleRowId<br \/>\nWHERE (vPerformanceRule.CounterName LIKE N'%Available MBytes%') and (Perf.vPerfHourly.DateTime &gt; @ReportParameter2 and Perf.vPerfHourly.DateTime &lt; @ReportParameter3)<\/p>\n<p>and vManagedEntity.ManagedEntityGuid in (<\/p>\n<p>select BMETarget.BaseManagedEntityId from OperationsManager.dbo.BaseManagedEntity BMESource<br \/>\ninner join OperationsManager.dbo.Relationship R<br \/>\non R.SourceEntityId = BMESource.BaseManagedEntityId<br \/>\ninner join OperationsManager.dbo.BaseManagedEntity BMETarget<br \/>\non R.TargetEntityId = BMETarget.BaseManagedEntityId<br \/>\ninner join OperationsManager.dbo.ManagedType MT<br \/>\non BMETarget.BaseManagedTypeId = MT.ManagedTypeId<\/p>\n<p>where MT.TypeName = 'Microsoft.Windows.OperatingSystem'<br \/>\nand BMESource.BaseManagedEntityId in (<\/p>\n<p>select BMETarget.BaseManagedEntityId from OperationsManager.dbo.BaseManagedEntity BMESource<br \/>\ninner join OperationsManager.dbo.Relationship R<br \/>\non R.SourceEntityId = BMESource.BaseManagedEntityId<br \/>\ninner join OperationsManager.dbo.BaseManagedEntity BMETarget<br \/>\non R.TargetEntityId = BMETarget.BaseManagedEntityId<br \/>\nWhere BMESource.DisplayName = @Group)<br \/>\n)<\/p>\n<p>ORDER BY Perf.vPerfHourly.DateTime<br \/>\n<\/code><\/p>\n<p>In this example the report will show the &#8220;Available MBytes&#8221; performance counter for a group that you input as parameter @Group. It will show data between @ReportParameter2 and @ReportParameter3 (dates). I get all groups from the database by this query<\/p>\n<p><code><br \/>\nSelect DISTINCT BMESource.DisplayName as [Group Name]<br \/>\nFrom OperationsManager.dbo.BaseManagedEntity BMESource<br \/>\nInner Join OperationsManager.dbo.Relationship R<br \/>\nOn R.SourceEntityId = BMESource.BaseManagedEntityId<br \/>\nInner Join OperationsManager.dbo.BaseManagedEntity BMETarget<br \/>\nOn R.TargetEntityId = BMETarget.BaseManagedEntityId<br \/>\n<\/code><\/p>\n<p>The two date parameters, @ReportParameter2 and @ReportParameter3 I get from two queries that returns current data and current date minus seven days.<\/p>\n<p><code>SELECT convert(date,getdate(),21)<\/code><br \/>\n<code>SELECT convert(date,dateadd(day,-7,getdate()),21)<\/code><\/p>\n<p><img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/contoso.se\/files\/perfReport02.JPG\" alt=\"\" \/><\/p>\n<p>In my report I also added a matrix to show the values. I added the following line as BackgroundColor on the data value cell. This will give me a red background on every value below 100, in this example each time a machine had less than 100 Mb free memory. <code>=iif(Fields!AverageValue.Value &lt; 50, \"Red\", \"White\")<\/code><br \/>\nBig thanks to <a href=\"http:\/\/sentryboy.spaces.live.com\/blog\/\">Mike Eisenstein <\/a>for good ideas and SQL help.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When running a performance report against a group you get a average value for all the members of the group. Often you need\u00c2\u00a0the report to specify each member of the group in the report. You can of course add each member of the group as object to the report. Another solution is to build a &hellip; <a href=\"http:\/\/contoso.se\/blog\/?p=629\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[19],"tags":[],"_links":{"self":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/629"}],"collection":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=629"}],"version-history":[{"count":20,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/629\/revisions"}],"predecessor-version":[{"id":1162,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/629\/revisions\/1162"}],"wp:attachment":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=629"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=629"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=629"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}