SCOM 2012 R2 – Create Task Pane Dashboard Manually

A recent customer requirement was to add additional dashboards to the Navigation pane in the SCOM console.  There is this tool to assist with the creation on the MOM Team blog, however, it was not working in this particular case.  Rather than spending a ton of time attempting to troubleshoot, I took a more manual approach which ultimately yields similar results.

Tested version – SCOM 2012 R2 UR7

image

Step 1 – Create a new management pack to contain your dashboard

image

Step 2 – Under the Monitoring pane, locate the folder for your MP and create a new dashboard

image

Step 3 – Choose a layout.  In this case, I am just going to create Grid Layout dashboard with a single cell in order to look at CPU utilization on a chosen Windows Computer

A.  Choose Grid Layout

image

B.  Give it a name

image

C.  Choose a single cell for simple demo purposes

image

D.  Create

Step 4 – Export the management pack.  It is easier to move the dashboard under the Navigation pane and add the widgets after the fact

image

Step 5 – Open the XML in your favorite editor.  There are a few pieces we need to tweak.

A. Add a reference to the Windows Library

image

B. Modify the <ComponentType> to include a Target

image

Note: the reference is correct.  You do not use the typical alias when dealing with the mpinstance notation.

C. Modify the Parent for the <ComponentReference> to point at the Navigation pane rather than the default folder that was created within the MP

image

D. Modify the <ComponentImplementation> to point at the same Target as the <ComponentType>

image

E. Save your management pack.  Optional – increment the version number

Step 6 – Import your new management pack

image

Step 7 – Locate your dashboard.  If it still shows under the default folder in the monitoring pane, close and reopen your console.

image

Step 8 – Open your dashboard and click “Click to add widget…”

A. Select Performance Widget

image

B. Give it a name

image

C. Find an object of the specific type you are targeting.  It is key that select a specific item, not a group or an object of a different class.  In this case, Windows Computer

image

D. Select the desired performance counter and add

image

E. Choose a Time range

image

F. Choose whether or not to show the legend and then the desired fields if you choose to show

image

G. Create

Note – at this point you probably notice that the dashboard doesn’t work.  This is expected behavior as the code for the widget is not correct since it was authored through the console but not for specific use in the Navigation pane

Step 9 – Export your management pack

Step 10 – Open the XML in your favorite editor

Step 11 – Find the <ComponentImplementation> for the widget and modify the <Base /> tag

image

Step 12 – Locate the <Bindings> section under the <ComponentOverride> for the Widget

image

Step 13 – Highlight and cut all of the <Binding> tags

image

Step 14 – Paste the <Binding> section between the <Base> tags within the <ComponentImplementation> for the widget

image

Step 15 – Under the PerformanceObjectCounters binding, locate the ManagedEntityIds binding

image

Step 16 – Modify binding to accept the id of the targeted object in the console rather than a specific instance

image

Step 17 – Delete the rest of the <ComponentOverride> code for the widget

image

Step 18 – Locate the <DisplayString> for the widget component override and delete that as well

image

Step 19 – Save and import your management pack.  Post import, close and reopen your console

Step 20 – Test your dashboard.  Enjoy

image

 

Download

Management Packs, MP Authoring, SC Operations Manager

MS OMS – Performance Data Collection Now Live

Microsoft Operations Management Suite (OMS) is now able to collect performance data at a rate of up to every 10 seconds.

image

Configuration is super simple.

image

Simply add or remove the counters you wish to have collected and the data will start pouring in for review.  The only challenge I see here is how to collect SQL related data since the SQL instance name comprises part of he object name.  In order to test how this is going to be handled, I added the following counters just taking a guess (and hoping something was done to simplify the process) as to how OMS might handle this situation:

image

I found a bunch of these events for MSSQL and MSSQL$ in the event log shortly after attaching the SQL machine to OMS:

image

A few minutes afterwards, I found the performance data with the object name MSSQL$OMDB inside Search within the OMS Portal:

image

This means the SQL data will have to be treated a little bit differently from a collection perspective, but it is manageable.  Next steps would be to explore if there is a way to programmatically interface with OMS in order to configure these counters.  For now, most performance counters are very easily configured and collected for analysis in OMS!

Uncategorized

SCOM 2012 R2 – PowerShell Based Console Task

From time to time, it is nice to take advantage of the agent and console tasks exposed in the SCOM console to more easily accomplish some sort of remediation or to retrieve some information.  I have authored agent tasks before, and they are pretty straight forward.  I do not believe I have ever authored a console task, however, when I received the request from one of my peers, I figured it would be a snap.  The ask was to be able to execute a PowerShell script against the SDK straight out of the console and display the results back to the user.  It ends up this is not too bad, but you do have to do some digging in order to see how these tasks are actually constructed.

Step one for me is to always try and find an example that I can reference.  A quick Bing search did not turn up much, so I exported all of the MPs from my SCOM environment via PS and then scanned them for console tasks.  I found an interesting one in the Microsoft.Windows.Server.Library management pack.

<ConsoleTask ID=”Microsoft.Windows.Server.Computer.OpenPowerShell” Accessibility=”Public” Enabled=”true” Target=”Windows!Microsoft.Windows.Server.Computer” RequireOutput=”false”>
<Assembly>Res.Microsoft.Windows.Server.Computer.OpenPowerShell</Assembly>
  <Handler>ShellHandler</Handler>
<Parameters>
<Argument Name=”WorkingDirectory” />
<Argument Name=”Application”>powershell.exe </Argument>
<Argument> -noexit -command “Enter-PSSession -computer $Target/Property[Type=”Windows!Microsoft.Windows.Computer”]/PrincipalName$”</Argument>
</Parameters>
</ConsoleTask>

A straight forward task that simply opens PowerShell and creates a remote session on the targeted Windows Server Computer.  This is essentially what I want to do, except I want to execute code against the SDK and display results rather than simply opening a remote session.

1

This is great.  I did notice the <Assembly> line (highlighted in yellow above) that seems to basically define the type of task you are trying to execute.  Searching the code further for this particular assembly, I find a resource at the very bottom of the management pack:

<Resources>

<Assembly ID=”Res.Microsoft.Windows.Server.Computer.OpenPowerShell” Accessibility=”Public” FileName=”Microsoft.Windows.Server.Computer.OpenPowerShell” HasNullStream=”true” QualifiedName=”Microsoft.Windows.Server.Computer.OpenPowerShell” />
</Resources>

I scoured my workstation, my MS servers, and the installation media for this file and I was not able to find it.  I really want to track this down since this will potentially expose other types of console task types.  My best guess is that this code has been relocated into some other DLL but I do not know for sure.  If I find the code, I will post an update.

With that, I felt I had most of the necessary pieces in order to get an example running.  For this example, I just wanted to do something simple like list all of the properties for a selected Windows Computer.  Here is the script to do the work:

Param([String]$computerFQDN)
$key = ‘HKCU:Software\Microsoft\Microsoft Operations Manager\3.0\User Settings’
$SDK = (Get-ItemProperty -Path $key -Name SDKServiceMachine).SdkServiceMachine

Import-Module OperationsManager
New-SCOMManagementGroupConnection $SDK

## Get Windows Computer class
$computerClass = Get-SCOMClass -Name “Microsoft.Windows.Computer”

## Get SCOM object
$computer = Get-SCOMClassInstance -Class $computerClass | Where-Object {($_.FullName -eq $computerFQDN) -or ($_.Name -eq $computerFQDN)}
$computer | fl *

This code connects to the SDK using whatever SDK service the machine upon which the script is being executed last connected.  If multiple consoles are open and connected to multiple management groups, this approach will only work for Computer objects in the last console opened.  However, this is fine for demo purposes and my lab since I only have a single environment.

Since the OpenPowershell module opens PowerShell and executes a scriptblock, I need to wrap the code above in a scriptblock and pass in the $computerFQDN value using a $Target variable:

<Parameters>
<Argument Name=”WorkingDirectory” />
<Argument Name=”Application”>powershell.exe </Argument>
<Argument><![CDATA[ -noexit -command “& {Param([String]$computerFQDN)

}” ]]></Argument>
<Argument>$Target/Property[Type=”Windows!Microsoft.Windows.Computer”]/PrincipalName$</Argument>
</Parameters>

Dropping this into a <ConsoleTask> and adding the exact code chunk to add the Assembly from the bottom of the Microsoft.Windows.Server.Library management pack yields the following:

image

When I click on my “Console Task – Get Computer Info” task, it launches the script which returns the following:

image

There are all of the properties for the selected Windows Computer.  Results!

Management Packs, MP Authoring, PowerShell, SC Operations Manager

Datazen – Dashboard Initial Configuration

Now that we have the product installed, the next step is to determine what data needs to be displayed.  Since I am going to be consuming SCOM data, I am going to create a simple dashboard that contains information that is pertinent to the health of the SCOM environment itself.  In order to accomplish this, the next steps are to grant access to the appropriate users, create a hub, create a data source and then use that data source to create views into the data.  It sounds like a lot, but it is really not bad at all.

For my DZ install, I created a new user named DZAuthor.  This is the account I am going to use to do the bulk of the authoring work.  I already had a SCOMUser account in my lab, so I am going to grant that user access to the dashboard I am creating in order to simulate my end user experience.

image

The DZ install has a couple of URLs you need to access.

http://<servername> and http://<servername>/cp.  The first is the end user page (where the dashboards and KPIs will be displayed) and the second one is the control panel (cp for short).  The control panel is where we need to go to get started.  I open the CP URL and then enter the admin account and password (specified during install) in order to get logged in the first time.

Once I get logged in, the first step is to grant access to my DZAuthor account.  This is the account that I am going to use for creating the dashboards and all of the supporting components.  On the home tab in the CP portal I hit create user.  As you can see here, there is also a batch import process here that allows you to create users in bulk as well.

image

After I hit Create User, I fill in the details for the DZAuthor account.  Since I specified Active Directory settings during the install, the necessary information is pretty minimal.

image

Now that I have created my authoring user, I now need to create a hub.  A hub is basically a container for dashboards.  Users are assigned permissions at the hub level.  Once I have my dashboard created, I should be able to grant access to the hub SCOMUser account and that user should be able to then view the contents of the hub.

image

I hit Create BI Hub and then create a hub named SCOM Health Hub.  This is where the dashboards pertaining to the health of the SCOM infrastructure itself are going to be stored.

image

I give it a max of 10 users.  For lab, this should be fine.  For prod, you would need to make sure and check scaling for the IIS servers you have hosting these sites.  Once the hub is created, I logoff the Admin account and login with my DZAuthor account.

Once I am logged back in as DZAuthor, I need to make sure the SCOM Health Hub is selected in my navigation pane.  Since this is the first and only hub in the environment, this is the case:

image

The next step is to create a User Group for this hub.  I hit User Groups in the navigation pane and then hit the “Create New User Group” button at the top

image

and then:

image

I create a new group for the SCOM Health Hub

image

By default, DZAuthor is automatically dropped into this group since DZAuthor is the hub owner.  We will come back later and add in the SCOMUser account in order to grant permissions to the published dashboards.

Speaking of dashboards (the reason we are here), the next step is to create a group for the dashboards.

image

I navigate to Dashboards and then hit “Create a New Group” at the top.

image

I’m going to create a group for the core infrastructure.  Later on, I will circle back and create a group that specifically pertains to agent health.  In step 2, I select “Allow Access” for the recently created hub user group:

image

That’s more or less the framework.  Now comes the work that pertains directly to what we want to display on the screen.  In order to get at any data, we need to create a Data Source.  I navigate to Data Sources:

image

and then hit “New Folder” at the top:

image

I give it a generic name for holding all of my SCOM information.  I click on the folder that gets created in order to drop in a level, and then I hit “New Data Connection” button at the top:

image

At this time, there are 13 different types of data providers available.  These range all the way from Azure SQL Databases to Excel spreadsheets.  For connecting to SCOM, we’re going to be querying the SQL databases.  For what I want to accomplish, I am going to be querying the OperationsManager database directly and going around the SDK.  Is this supported?  Nope.  Do I care?  Nope.  Should you care?  Great question.  The database layout for the bulk of the data we would want to dashboard from the OpsDB hasn’t really changed that much (or at all) from the first days of SCOM 2007 through the most recent UR for SCOM 2012 R2.  Is this supported?  Nope.  Does it work?  Yep.

The next step is to grant access to the data source:

image

At this point, the screen should look something like this:

image

Now, we click into OperationsManager in order to start mining some data.  Once inside, we hit “New Data View” button:

image

Since we are under the OperationsManager data source we created, these views are all going to be query based and will be driven off the OperationsManager database.  Now, we need to figure out how to get at the data we need.  A great place to always start is Kevin Holman’s “Useful Operations Manager 2007 SQL queries” blog post when querying either the OperationsManager of OperationsManagerDW databases.  Another option is to actually find the data you want in the SCOM console and use SQL Profiler to see what query SCOM is executing in order to retrieve the data for the SDK.

View #1:

Number of Alerts per day

SELECT Convert(DateTime,CONVERT(VARCHAR(20), TimeAdded, 102)) AS DayAdded, COUNT(*) AS NumAlertsPerDay
FROM Alert WITH (NOLOCK)
WHERE TimeRaised is not NULL
GROUP BY CONVERT(VARCHAR(20), TimeAdded, 102)
Having Convert(DateTime,CONVERT(VARCHAR(20), TimeAdded, 102)) > DATEADD(d,-7,GetUTCDate())
ORDER BY DayAdded

I stole this one from Kevin’s blog and then tweaked it a bit for the dashboard.  First, note the datetime column returned from the query needs to contain an actual datatime value from SQL or Datazen will not treat it as a datetime.  I got stuck here for a bit since the data looks good.  In Kevin’s query, the datetime had actually been converted to a varchar so DZ was just treating that column as a normal string. In order to deal with this and keep it simple, I just wrapped the varchar field with an additional Convert() function and set it back to a datetime.

Additionally, I removed the row with the total and only returned the previous 7 days.  I am happy with the results from the query in SQL Management Studio, so I move back to the Control Panel and fill in the rest of the data for the Alerts/Day view:

image

Notice I set the Refresh Frequency to every 30 minutes.  You may want to set this more or less frequent depending on your environment and business needs.  There are a couple of other interesting things on this screen such as parameterizing filters and personalizing the query by adding in the username to the query.  I don’t need these for this dashboard, but they are options to explore later.

I repeat the steps 3 more times:

View #2 – Events Per Day

SELECT Convert(DateTime,CONVERT(VARCHAR(20), TimeAdded, 102)) AS DayAdded,
COUNT(*) AS EventsPerDay
FROM EventAllView
GROUP BY CONVERT(VARCHAR(20), TimeAdded, 102) WITH ROLLUP
Having Convert(DateTime,CONVERT(VARCHAR(20), TimeAdded, 102)) > DATEADD(d,-7,GetUTCDate())
ORDER BY DayAdded

View #3 – Performance Samples Per Day

SELECT Convert(DateTime,CONVERT(VARCHAR(20), TimeSampled, 102)) AS DaySampled, COUNT(*) AS PerfInsertPerDay
FROM PerformanceDataAllView with (NOLOCK)
GROUP BY CONVERT(VARCHAR(20), TimeSampled, 102) WITH ROLLUP
Having Convert(DateTime,CONVERT(VARCHAR(20), TimeSampled, 102)) > DATEADD(d,-7,GetUTCDate())
ORDER BY DaySampled DESC

View #4 – State Changes Per Day

SELECT Convert(DateTime,CONVERT(VARCHAR(20), TimeGenerated, 102)) AS DayGenerated, COUNT(*) AS StateChangesPerDay
FROM StateChangeEvent WITH (NOLOCK)
GROUP BY CONVERT(VARCHAR(20), TimeGenerated, 102) WITH ROLLUP
Having Convert(DateTime,CONVERT(VARCHAR(20), TimeGenerated, 102)) > DATEADD(d,-7,GetUTCDate())
ORDER BY DayGenerated DESC

After following the same logic for each of the views, my Control Panel now shows the 4 views I created:

image

At this point, I am ready to create an actual dashboard and publish it!

The next post will focus on utilizing these views in a simple dashboard using the Datazen Publisher app available from the Windows Store.

Presentation, SC Operations Manager

Datazen – Lab Installation

Per my previous post, MS has acquired a BI solution capable of providing dashboards using many different types of data sources. From a System Center perspective, we have been waiting for a scalable solution that meets the performance needs of our customers. Seeing this solution has a very nice look and feel, I was interested in getting my hands on the software to take it for a test drive.

Download

Reading through the documentation, I noticed that there are many options for scaling this product for a large scale customer. For lab, however, a single server scenario seems like the way to go. Just to make sure this would perform at least OK, I spun up a Basic_A3 VM in Azure (4 cores, 7GB of RAM) and downloaded the product and kicked off the install.

clip_image001

clip_image002

Since this a single server install, I leave all of the features selected. I do, however, not know how the product will react to the disk caching on the C drive. I decide to leave it as the C drive for lab purposes but would expect to move this off to a different drive if I was doing a production install.

clip_image003

After reading a little bit about security in from the included PDF, I decide to go with a domain account to run the core services. This is how you would approach the situation if this was a distributed deployment and better follows security best practices.

clip_image004

The Control Panel for the application (administrative web portal) has a default admin user. The user name is “admin” and here I set the password for that account.

clip_image005

I want to integrate with AD. I configure this connection to leverage the same service account I created and set to run the core services. In a production install, you would most likely use different accounts.

clip_image006

I copy off the encryption key and store it in a safe place.

clip_image007

I copy off the instance ID just in case I decide to add additional servers to the overall install in the future.

clip_image008

I choose to “Use Core Service credentials” in the next step for simplicity.

clip_image009

I want this server to host the websites so I leave the host name field blank.

clip_image010

I configure the Exchange settings so that the service can send emails.

clip_image011

Install.

clip_image012

At this point, the install takes quite a while (10-15 minutes) as the necessary windows features are added to the machine and product is ultimately installed.

clip_image013

Happy dashboarding! The next post will cover getting started with getting a hub set up, creating a data source, and building some views in order to populate the dashboards.

Presentation