Build highly effective dashboards with Microsoft System Center 2016 Operations Manager
Objective
The steps that you will walkthrough in this lab area as follows:
- Create a new dashboard with a State Tiles Widget for specific computers.
- Add a PowerShell Grid Widget to display health of objects related to the objects in the selected tile.
- Create a simple web form and display results in PowerShell Web Browser Widget.
- Modify script in PowerShell Web Browser to display an existing web form listing objects related to object in selected widget.
- Modify web form to list objects related to object in selected widget, and change script to view new form.
- Modify web form to display results in a table.
- Modify web form to display a heat map instead of a table.
- Modify web form to display object when tile in heat map is selected.
- Modify web form to display context menu when tile in heat map is selected.
Scenario
Virtual Machines
- SCOM 2012 R2
- SCOM Client
Exercise 1 : Create dashboard
You will start by creating the dashboard and adding a State Tiles widget for two computers in the lab. This is a dashboard called Lab Dashboard with a column layout and a single column.
- Log on to lab computerLog on to SCOMCLIENT with the following credentials:
User: scomuser
Password: Pa$$w0rd - Open the Operations ConsoleOpen the Operations Console.
- Open Visual StudioOpen Visual Studio.
- From the Operations ConsoleFrom the Operations Console, right click Monitoring and select New > Dashboard View.
- Select Column Layout. Click NextSelect Column Layout. Click Next.
- For Name, type Lab DashboardFor Name, type Lab Dashboard. Click Next.
- For Column CountFor Column Count, select 1. Click Next.
- Click CreateClick Create.
Click Continue to advance to the next exercise.
Exercise 2 : Add State Tiles Widget and PowerShell Grid Widget
You will now add a State Tiles Widget to the dashboard for the two computers in the lab environment and then a PowerShell Grid widget that lists the related objects when a tile is selected.
- Add State Tiles widgetAdd State Tiles widget.
a. In the dashboard, click Click to add widget.
b. In the New Dashboard and Widget Wizard, select the options in the following table:
Please click on the camera icon on the lower left hand side to view the screenshot. - Add the PowerShell Grid WidgetAdd the PowerShell Grid Widget.
a. Select the gear icon for the dashboard and select Add Cell.
b. In the new cell, click Click to add widget.
c. In the New Dashboard and Widget Wizard, select the options in the following table:
Please click on the camera icon on the lower left hand side to view the screenshot.
- Select each of the tiles in the ObjectsSelect each of the tiles in the Objects and verify that the list of related objects are displayed in the Related Objects cell.
Click Continue to advance to the next exercise.
Exercise 3 : Create Basic Web Project
You will now create a basic web project that displays Hello Web Server to the browser. After completing the project, you will publish it to the web server where it can be requested from a PowerShell Web Browser Widget and displayed in the Operations Console. You will later modify this project to provide detail of monitored objects.
Note that you do not have to create a web site to host the project. A site called Labweb is already created on SCOMSERVER.CONTOSO.COM.
Note that you do not have to create a web site to host the project. A site called Labweb is already created on SCOMSERVER.CONTOSO.COM.
- Create the projectCreate the project.
a. In Visual Studio, select File > New > Project.
b. Select Templates > Visual C# > Web.
c. Create the project using the following options:
Please click on the camera icon on the lower left hand side to view the screenshot.
d. When prompted, select Empty template and click OK. - Open the Solutions ExplorerOpen the Solutions Explorer, select View > Solution Explorer.
- Create a web form in the projectCreate a web form in the project.
a. When the project has been created, right click the DashboardView project. And select Add > Web Form.
b. Name the form View and click OK.
c. Within the
d. Select File > Save View.aspx. - Build and publish the projectBuild and publish the project.
a. Select Build > Build Solution.
b. Select Build > Publish DashboardView.
c. Click down arrow and select.
d. Name the profile SCOM and click OK.
e. Provide the following information and click Publish.
Please click on the camera icon on the lower left hand side to view the screenshot. - Test the web form in a browserTest the web form in a browser.
a. Open a web browser and type in the address http://scomserver/labweb/view.aspx.
b. Verify that Hello from web server is displayed in the browser.
Click Continue to advance to the next exercise.
Exercise 4 : Create PowerShell Web Browser Widget
Now that you have a working form, you will now add a PowerShell Web Browser Widget to the dashboard to display the output of that form in the Operations Console. The widget will include a script that performs the web request.
- Select the gear iconIn Operations Manager select the gear icon for the dashboard and select Add Cell.
- In the new cellIn the new cell, click Click to add widget.
- In the New Dashboard and Widget WizardIn the New Dashboard and Widget Wizard, select the options in the following table:
Please click on the camera icon on the lower left hand side to view the screenshot. - Verify that Hello from web server is displayedVerify that Hello from web server is displayed in the widget.
Click Continue to advance to the next exercise.
Exercise 5 : Change PowerShell Grid Widget to display data from selected object
While this shows that you can display the output of a web page with a widget, the information being displayed isn’t particularly interesting. You will now change the script in the PowerShell Web Browser Widget to display a list of objects related to an object selected in the dashboard. This is similar information that is already being displayed in the PowerShell Grid widget, but it is using code from the web server.
The web form that you are using in this step already exists in the lab environment. If you want to look at the source code for this project, it is available in C:\Lab\SampleWeb. You will be creating a similar web form in later steps.
The web form that you are using in this step already exists in the lab environment. If you want to look at the source code for this project, it is available in C:\Lab\SampleWeb. You will be creating a similar web form in later steps.
- Select the gear iconSelect the gear icon for the View cell and select Configure.
- Click NextClick Next.
- Replace the scriptReplace the script with the contents of C:\Lab\Code\View02.ps1 and click Finish.
- Select each of the tiles in the ObjectsSelect each of the tiles in the Objects and verify that the list of related objects are displayed in the View cell.
Click Continue to advance to the next exercise.
Exercise 6 : Change Web Form to Display Script Results
You will now start modifying the simple web form that you created to display the same information as the completed web form that you just saw. The first step is to accept data from the script and display a simple result. This is only an initial step to show that the view can accept data from the script. You will later modify the view to show details about these objects
The data from the script is sent to the web form is formatted as JSON, and you will need to deserialize it before you can use it. You will create a class to represent the data once it has been deserialized.
The data from the script is sent to the web form is formatted as JSON, and you will need to deserialize it before you can use it. You will create a class to represent the data once it has been deserialized.
- Switch to Visual StudioSwitch to Visual Studio.
- Add a reference to System.Runtime.SerializationAdd a reference to System.Runtime.Serialization for JSON serialization.
a. Right click References and select Add Reference.
b. Select System.Runtime.Serialization and click OK. - Add class to project to represent the object dataAdd class to project to represent the object data.
a. In Visual Studio, right click the DashboardView project. And select Add > Class.
b. Name the class Data.cs and click Add.
c. Add a using statement for System.Runtime.Serialization and the Data Members included in C:\Lab\Code\Data01.cs.
d. Select File > Save Data.cs. - Add code to the View to accept the object dataAdd code to the View to accept the object data from the PowerShell script and serialize it from JSON.
a. Expand View.aspx and open View.aspx.cs.
b. Add a using statement for System.Runtime.Serialization.Json and the code included in C:\Lab\Code\View01.aspx.cs.
c. Select File > Save View.aspx.cs. - Change the view to displayChange the view to display the number of objects returned from the script. This is done using the Length property of the RequestData object that is defined in the code behind the form.
a. Open View.aspx.
b. Replace the body of the page with
Related Objects [<%= RequestData.Length %>]
. This is shown in C:\Lab\Code\View02.aspx.
c. Select File > Save View.aspx. - Build and publish the projectBuild and publish the project.
a. Select Build > Build Solution.
b. Select Build > Publish DashboardView.
c. Click Publish. - Change the scriptChange the script to display the modified View page.
a. Open the Operations Console.
b. Click the gear icon next to the View widget and select Configure.
c. Change the BaseUrl of the Request object in the script from http://scomserver.contoso.com/SampleWeb/Explorer.aspx to http://scomserver.contoso.com/LabWeb/View.aspx. This is shown in C:\Lab\Code\View03.ps1. - Test the modified dashboardTest the modified dashboard.
a. Select one of the tiles in the Objects widget.
b. Select one of the tiles in the Objects widget.
c. Verify that Related Objects[#] is displayed in the View widget. The # will represent the number of objects related to the object represented by the selected tile.
Click Continue to advance to the next exercise.
Exercise 7 : Change Web Form to Display Script Results in a Table
At this point, the dashboard is only displaying the number of objects related to the one that is selected. You will now change the web form to display detailed data from the script in a table. This will require changes in the web form to create a Repeater control called DataFormatter thatwill allow you to step through each record in the data and format it into a table row. You will also need to add code behind the web form to populate the data source for this control with the data from the widget.
- Add the HTML for the table to the web formAdd the HTML for the table to the web form.
a. In Visual Studio, open View.aspx.
b. Add the HTML for the Repeater control and the table shown in C:\Lab\Code\View03.aspx.
c. Select File > Save View.aspx. - Add code behind the web formAdd code behind the web form to set the data source for the Repeater control.
a. Open View.aspx.cs.
b. Add the two lines of code for DataFormatter in C:\Lab\Code\View02.aspx.cs.
c. Select File > Save View.aspx.cs. - Build and publish the solutionBuild and publish the solution.
a. Select Build > Build Solution.
b. Select Build > Publish DashboardView.
c. Click Publish. - Test the new web formTest the new web form.
a. In the Operations Console, select one of the tiles in the Objects widget.
b. Verify that a table of related objects is displayed in the View widget.
Click Continue to advance to the next exercise.
Exercise 8 : Change Table View to a Heat Map
The table that the web form is displaying is interesting, but it’s similar to the data that is already being displayed with less complexity using the PowerShell Grid widget. You will now make a changes to the web form to show off the flexibility of using the PowerShell Web Browser Widget. Instead of displaying a table of related objects, you will change the web form to display a heat map of related objects. This will display a colored tile for each related object indicating the health state of the object.
- Add a Color method to the Data classAdd a Color method to the Data class. This method inspects a value indicating the state of the object and then sets an appropriate color for the tile.
a. In Visual Studio, open Data.cs.
b. Add the Color method shown in C:\Lab\Code\Data02.cs.
c. Select File > Save Data.cs. - Modify the web form to display a gridModify the web form to display a grid for each data record instead of a table row.
a. Open View.aspx.
b. Add the HTML for a style for the tiles and replace the table rows with a tile matching the color of each object’s health state as shown in C:\Lab\Code\View04.aspx.
c. Select File > Save View.aspx. - Build and publish the solutionBuild and publish the solution.
a. Select Build > Build Solution.
b. Select Build > Publish DashboardView.
c. Click Publish. - Test the new web formTest the new web form.
a. In the Operations Console, select one of the tiles in the Objects widget.
b. Verify that a set of tiles representing related objects is displayed in the View widget.
Click Continue to advance to the next exercise.
Exercise 9 : Add a link to each tile in the Heat Map
The tiles in the heat map currently have no action if you click on them. You will now add a link to each that will allow you to click on the tile to display the object in the Related Objects widget. This link will use console:SetSelectedItems which instructs the Operations Console to set the selected item on the dashboard.
- Add a link to each tile in the heat mapAdd a link to each tile in the heat map.
a. In Visual Studio, open View.aspx.
b. Add the HTML link enclosing the tile in as shown in C:\Lab\Code\View05.aspx.
c. Select File > Save View.aspx. - Build and publish the solutionBuild and publish the solution.
a. Select Build > Build Solution.
b. Select Build > Publish DashboardView.
c. Click Publish. - Test the new web formTest the new web form.
a. In the Operations Console, select one of the tiles in the Objects widget.
b. Hover over one of the tiles representing related objects in the View widget and verify that the Display Name of the object is displayed in a tool tip.
c. Click on the tile and verify that the object is displayed in the Related Objects widget.
Click Continue to advance to the next exercise.
Exercise 10 : Add a context menu to each tile in the Heat Map
In addition to displaying the object when you click on its tile, you will also now have a context menu display in the Operations Console for the object. You will need to add a script to the web form and then have that script run by adding the oncontextmenu event to each tile.
- Add the script to the web formAdd the script to the web form.
a. In Visual Studio, open View.aspx.
b. Add the script shown in C:\Lab\Code\View06.aspx.
c. Select File > Save View.aspx. - Add the context menu event to each tileAdd the context menu event to each tile.
a. Add the oncontextmenu event between the div tags shown in C:\Lab\Code\View06.aspx.
b. Select File > Save View.aspx. - Build and publish the solutionBuild and publish the solution.
a. Select Build > Build Solution.
b. Select Build > Publish DashboardView.
c. Click Publish. - Test the new web formTest the new web form.
a. In the Operations Console, select one of the tiles in the Objects widget.
b. Click on one of the tiles representing related objects in the View widget and verify that a context menu is displayed in the Tasks pane.
Click Continue to advance to the next exercise.
No comments:
Post a Comment