Cloud and Datacenter Management by Anders Bengtsson

How to create a new CI class and a new form

The RTM version of Service Manager Authoring Tool is released! The new versions allows you to do some new things that we did direct in XML before. In this blog post I will show you how you can create a new CI class, add a custom form to work with your class and also seal your management pack. The first thing you need to do is install the RTM version of the Authoring Tool. You can download it here.

In this example we will build a custom CI class named contoso. The first part will create a new CI class named Contoso.Projector.Library, we will then add a couple of properties that describes a projector. 

  1. Start Service Manager Authoring Tool (v 7.0.5826.620)
  2. Click “Create a new Management Pack”
  3. Input Contoso.Projector.Library as file name, click save
  4. Select the top node in the management pack explorer, in the details pane, input “Management Pack that extends the CMDB with a projector class.” as description
  5. In the management pack explorer, right-click Classes and select “Create Configuration Item Class…”
  6. In the create class window, input Contoso.Projector and click Create
  7. Change the class name and description if needed
  8. Click “Create Property”
  9. In the create property window, input for example “Resolution”. Repeat step 9 for each of the following properties
    1. Resolution
    2. Name
    3. Location
    4. Contrast
    5. Manufacture
    6. Number
    7. Purchase
    8. WarrantyEnd
    9. Vendor
    10. Monthly
  10. Select the Name property and change Key to TRUE. This means that the Name property will be the single property identifying a unique instance of the projector class.
  11. Select the automatically added property named Property_X. Delete it.
  12.  When you select a property you can change details in the details pane. Change the data type for your properties, for example change WarrantyEnd and Purchase to data type Date Time. That means that the data should be in date format.
  13. Change some of the names to a better display string for example
    1. Purchase, Purchase date
    2. Number, Serial Number
    3. WarrantyEnd, Warranty End
    4. Monthly, Monthly Price
  14. Change Name to minimum length 2. You need to input at least two letters

That should do it; the class for projectors is done. Next step is to create a form that we can use to add projectors in the service manager console.

  1. In management pack explorer, right-click Forms and select Create
  2. In the base class window, select Contoso.Projector
  3. In the create form window, input contoso.projector.form
  4. Drag and drop a label for each property from the form customization toolbox to the form design window
  5. Drag and drop a text box for each property where the user will input text strings
  6. Drag and drop a date picker for the purchase date and warranty end date properties
  7. In the detail pane you can change the font and text size for any text
  8. The next step is to bind each text box to a property of your project class. Select a text box, for example Name and click binding path in the details pane.
  9. In the Binding Path window, select Name
  10. Repeat step 9 for each text box and date picker

That should do it! You now have a management pack with a new class and a form that we can use to create CIs for the new class.

We should seal the management pack before we import it. That would give us a couple of benefits, for example we can store views and folders in another management pack and access objects related to our projects management pack. We can’t create views and folders in the current version of the authoring tool so good practices could be to save them in another unsealed management pack and all core things in a sealed library management pack.

Next step is to seal the management pack. To seal the MP we will use .NET framework strong name utility (sn.exe).

  1. Open a command prompt
  2. Navigate to the folder where SN.EXE is located, in my case C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\bin\.
  3. Run SN –k mykey.snk
  4. Verify that a new key pair was generated, for example a mykey.snk file
  5. Switch to the Authoring Tool again
  6. In the management pack explorer, right-click the top node, in my example Contoso.Projector.Library and select “Seal Management Pack”
  7. In the Seal Management Pack window, select a suitable Output Folder, for example C:\MPs
  8. Browse and select your key file that you generated in step 3
  9. Input a company name, for example Contoso
  10. Click Seal
  11. Verify that seal succeeded, click Close

Now, import your management pack into Service Manager. Remember to import the management pack from C:\MPs, your sealed version. To create and view projectors you need to create a folder and a view

  1. In the service manager console, go to the Configuration Items workspace
  2. In the tasks pane, click Create Folder
  3. In create new folder window, input Projectors as Folder Name. Create a new management pack named Contoso.projector.config and store the folder in it. We can’t store the folder in your Contoso.projector.library management pack as it is now sealed.
  4. Select your new Projectors folder and select Create View
  5. In the create view window, input “All projectors” and view name. In the Criteria tab select Contoso.Projector as class. Click OK to save the view.
  6. Select your new “All projects” view. Create “create contoso.projector” from the tasks pane. Contoso.Projector is the name of the class we created in the authoring tool.
  7. In the projector form, fill in the text fields and click OK

Now you have a new class in your CMDB, you can store information about projectors. You can use your new form to input the information and your new view to review it.

« »

© 2019 www.contoso.se. Theme by Anders Norén.