How to configure Operations Manager console integration with SquaredUp DS
Overview
Custom tasks can be added to the SCOM console to allow SCOM operators to automatically jump from any alert or computer object to the default perspective for that entity in SquaredUp.
You can add tasks that show you an alert or the object that raised the alert using the SCOM console, but if you want to open SquaredUp DS from an object directly you must create a management pack.
Instructions
The first two integrations add tasks to the SCOM console - one to view an alert in SquaredUp DS, and the other to view the object that raised an alert in SquaredUp DS.
The final section provides a walkthrough on how to create a SCOM management pack using Visual Studio Authoring Extensions (VSAE) that contains a task that opens SquaredUp DS from any computer object. This task could be adapted to function for any class in SCOM that has known key properties.
When asked to enter the URL of your SquaredUp server, ensure you replace SquaredUpServer
with the correct network name.
Adding the Alert task
- Open the SCOM Operations Console.
- Go to the Authoring workspace (Authoring tab on bottom left).
- Select Authoring > Management Pack Objects > Tasks in the left-hand tree view.
- Click Create a New Task in the right-hand task pane.
- Select Console Tasks > Alert Command line in the center list.
- Select an existing management pack in Select destination management pack or click New to create a new management pack that will contain your task.
- Click Next.
- Type 'View alert in SquaredUp DS' for the Task name. Click Next.
- On the Specify command line page, enter the following details and click Create.
- Application:
cmd
- Parameters:
/C "start http://SquaredUpServer/SquaredUp/drilldown/scomalert?id=$Id$"
- Display output when this task is run: Unchecked
- Application:
The task should now be visible when you select any alert in the SCOM console.
Adding the Alert Object task
- Open the SCOM Operations Console.
- Go to the Authoring workspace (Authoring tab on bottom left).
- Select Authoring > Management Pack Objects > Tasks in the left-hand tree view.
- Click Create a New Task in the right-hand task pane.
- Select Console Tasks > Alert Command line in the center list.
- Select an existing management pack in the Select destination management pack or click New to create a new management pack that will contain your task.
- Click Next.
- Type 'View object in SquaredUp DS' for the Task name. Click Next.
- On the Specify command line page, enter the following details and click Create.
- Application:
cmd
- Parameters:
/C "start http://SquaredUpServer/SquaredUp/drilldown/scomobject?id=$MonitoringObjectId$"
- Display output when this task is run: Unchecked
- Application:
The task should now be visible when you select any alert in the SCOM console.
Adding the View Computer task
In order to open a SquaredUp DS dashboard when viewing an object in a SCOM state view or diagram, we will need to launch a PowerShell script to translate key properties for that object into its SCOM guid. This is necessary because the default console task engine in SCOM does not give us access to the Monitoring Object Id when running tasks from an object.
MP Authoring
In this article we are going to use the Microsoft Visual Studio Authoring Extensions (VSAE) to build our management pack. This is a free extension for Visual Studio that makes it easy to build SCOM and SCSM management packs.
As of Visual Studio 2015 you no longer require Visual Studio Professional or higher to use VSAE. If you are eligible for Visual Studio community, you can now use these tools to create a management pack, though you are free to use whatever XML editor you prefer.
Download the Visual Studio Authoring Extensions
The MP schema shown in this article is for SCOM 2012 or later. This is not compatible with SCOM 2007 or 2007 R2.
If you are new to MP authoring, the MP Authoring Guide has useful articles and How-To instructions for several authoring tools, including Visual Studio.
Create the project
First we must create a project which will contain all MP fragments and resources required to build our management pack.
- Open Visual Studio.
- Click on File > New Project.
- Select Management Pack > Operations Manager under the Templates tree on the left.
- Select the appropriate version of SCOM for your environment (e.g. Operations Manager 2012 Management Pack).
This is the minimum version of SCOM required by this MP, so if you want to import this MP into multiple management groups choose the oldest supported platform. - Enter an appropriate name for the MP in the Name field (e.g.
LaunchSquaredUp
), and click on Browse to select a location to store the management pack project files. - Click on OK to complete the wizard and create the MP project.
- Locate the Solution Explorer window on the right side of the screen, and select your MP project. Note that the project is displayed underneath a Solution node, which will have the same name as your project but will have "Solution" prefixed.
- Right-click on your project and select Add > New Item.
- Select Code from the left list and choose Empty Management Pack Fragment. Enter
ManagementPack.mpx
for the Name and click on Add. - In this fragment we will specify the display strings for the MP file that will appear in the SCOM console. Modify the contents of the fragment to match the sample below. Note that the ElementId value should be exactly the same as the MP project name you specified earlier.
<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <LanguagePacks> <LanguagePack ID="ENU" IsDefault="true"> <DisplayStrings> <DisplayString ElementID="LaunchSquaredUp"> <Name>Launch SquaredUp Console Tasks</Name> <Description>Adds console tasks that let you open SquaredUp from the SCOM console.</Description> </DisplayString> </DisplayStrings> </LanguagePack> </LanguagePacks> </ManagementPackFragment>
- Once you are finished setting the Name and Description to suitable values, save the file by clicking the Save icon from the tool bar, or press CTRL+S.
Add the PowerShell script
We need to add a PowerShell script that can be executed locally on the operator's console when they click the task, that can look up the object ID from the computer's FQDN. This will then launch the default web browser and load the appropriate dashboard.
- Right-click on your project and select Add > New Folder. Name the folder
Resources
. - Right-click on the Resources folder and select Add > New Item.
- Select Resources from the left list and choose PowerShell script file. Name the script
LaunchSQUPByPrincipalName.ps1
and click on Add. - Copy and paste the below PowerShell into the newly created script file.
Param([String]$computerFQDN) $mgArgs = @{} $sdkService = Get-Service -Name omsdk -ErrorAction SilentlyContinue if ( $sdkService -eq $null -or $sdkService.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Running) { $key = 'HKCU:Software\Microsoft\Microsoft Operations Manager\3.0\User Settings' $mgArgs['ComputerName'] = (Get-ItemProperty -Path $key -Name SDKServiceMachine).SdkServiceMachine $credsRequired = (Get-ItemProperty -Path $key -Name SDKServiceMachineRequiresCredentials -ErrorAction SilentlyContinue).SDKServiceMachineRequiresCredentials if ($credsRequired -ne $null -and $credsRequired -eq 'True') { $mgArgs['Credential'] = Get-Credential -Message 'Please provide credentials to connect to SCOM.' } } Import-Module OperationsManager New-SCOMManagementGroupConnection @mgArgs # Get Windows Computer class $computerClass = Get-SCOMClass -Name 'Microsoft.Windows.Computer' # Get SCOM object $scomObject = (Get-SCOMClass -Name Microsoft.Windows.Computer| Get-SCOMClassInstance | where {$_.FullName -eq ('Microsoft.Windows.Computer:' + $computerFQDN)}) if ($scomObject -ne $null) { Start-Process -FilePath ('http://SquaredUpServer/SquaredUpv5/drilldown/scomobject?id=' + $scomObject.Id) }
Ensure you replaceSquaredUpServer
with the correct network name in the invocation of the Start-Process cmdlet. - Click the Save icon from the tool bar, or press CTRL+S.
Add the console task
Now we can define the console task that will automatically execute our script with the necessary parameters.
- Right-click on your project and select Add > New Folder. Name the folder
Tasks
. - Right-click on the Tasks folder and select Add > New Item.
- Select Code from the left list and choose Empty Management Pack Fragment. Enter
Task.ViewComputer.mpx
for the Name and click on Add. - In this fragment file we will define the task. Modify the fragment to match the sample below. If you named your MP something other than "LaunchSquaredUp" make sure you correct any ID references to ensure your identifiers match the management pack.
<ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Categories> <Category ID="LaunchSquaredUp.ConsoleTask.LaunchFromComputer.Category" Target="LaunchSquaredUp.ConsoleTask.LaunchFromComputer" Value="System!System.Internal.ManagementPack.ConsoleTasks.MonitoringObject" /> </Categories> <Presentation> <ConsoleTasks> <ConsoleTask ID="LaunchSquaredUp.ConsoleTask.LaunchFromComputer" Accessibility="Public" Enabled="true" Target="Windows!Microsoft.Windows.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><![CDATA[-noprofile -Command "& { $IncludeFileContent/Resources/LaunchSQUPByPrincipalName.ps1$ }"]]></Argument> <Argument>"$Target/Property[Type='Windows!Microsoft.Windows.Computer']/PrincipalName$"</Argument> </Parameters> </ConsoleTask> </ConsoleTasks> </Presentation> <LanguagePacks> <LanguagePack ID="ENU" IsDefault="true"> <DisplayStrings> <DisplayString ElementID="LaunchSquaredUp.ConsoleTask.LaunchFromComputer"> <Name>View computer in SquaredUp</Name> <Description>Opens the computer in SquaredUp using your default browser.</Description> </DisplayString> </DisplayStrings> </LanguagePack> </LanguagePacks> <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> </ManagementPackFragment>
- Click the Save icon from the tool bar, or press CTRL+S.
Build and import your management pack
Now that your management pack project is complete, you need to instruct Visual Studio to gather all defined fragments and construct a management pack from them.
- Select Build > Build Solution from the toolbar.
- The output window will likely appear and display build progress.
- Once Visual Studio displays "Build succeeded" in the bottom left corner, your management pack is complete and ready to import into SCOM.
If your build is unsuccessful, check the error list window for any errors and follow the help text to resolve them. Ensure all your IDs are correct and be aware that VSAE is case-sensitive. - Right-click on your project under Solution Explorer and select Open Folder in File Explorer.
- Open the bin folder, and then the Debug folder. You should see your management pack listed as an XML file here, ready for import.
- Import the management pack into SCOM using your organization's MP import process.
Open the SCOM console and navigate to a computer object. You should now see a View computer in SquaredUp task displayed in the Tasks list on the right. When launching the task you may be prompted for credentials to access SCOM before your browser launches and opens SquaredUp DS.
Sample MP
Below is a link to a reference management pack that contains all three tasks. You can create this using any text editor, just ensure that the file name matches the ID value below (e.g. LaunchSquaredUp.xml).