20
Using Microsoft Excel to View the UCMDB Class Model contact: j roberts - HP Software - ([email protected] ) - 214-732-4895 Step 1 – Start Excel ................................................................................ 2 Step 2 - Select a name and the type of database used by UCMDB ............... 2 Step 3 – Authenticate and connect to the database .................................... 3 Step 4 - Change the default database to the UCMB ”data” database ........... 4 Step 5 – Select the CCM_CLASSES table .................................................. 5 Step 6 – select the data .......................................................................... 6 Step 7 - Select File, Return data to Microsoft Excel ..................................... 7 Step 8 – find the data range bounds ........................................................ 8 Step 9 – insert columns......................................................................... 10 Step 10 – Copy Lookups into columns .................................................... 10 Step 11 – Test ..................................................................................... 11 Step 12 – Clean up for Display ............................................................. 11 Usage ................................................................................................ 12 Adding the Attributes to Complete the Data Model ................................... 17 Usage ................................................................................................ 19 Summary ............................................................................................ 20 Introduction A data dictionary is a common, standard document used in configuration management planning. UCMDB’s data model has traditionally been documented in a spreadsheet generated by product management. While this may continue, it may also be useful to create a data dictionary specific to a given implementation, i.e., with specific packages deployed. This is in some cases a critical improvement over depending on an imperfectly matching or dated document. This document provides the “recipe” for creating a document wherever and whenever it is needed. A working example (and the out-of-the-box class model for UCMDB 8.0) is provided here. The steps taken to build this spreadsheet are still included, in the case they may need to be modified for future versions or purposes. UCMDB v8.0 Class Model Page 1 of 20 March 4, 2009

Using Microsoft Excel to View the UCMDB Class Model.… · Using Microsoft Excel to View the UCMDB Class Model ... For Oracle, choose “Oracle in ... excel’s VLOOKUP function B

Embed Size (px)

Citation preview

Page 1: Using Microsoft Excel to View the UCMDB Class Model.… · Using Microsoft Excel to View the UCMDB Class Model ... For Oracle, choose “Oracle in ... excel’s VLOOKUP function B

Using Microsoft Excel to View the UCMDB Class Model contact: j roberts - HP Software - ([email protected]) - 214-732-4895

Step 1 – Start Excel................................................................................2 Step 2 - Select a name and the type of database used by UCMDB...............2 Step 3 – Authenticate and connect to the database ....................................3 Step 4 - Change the default database to the UCMB ”data” database ...........4 Step 5 – Select the CCM_CLASSES table ..................................................5 Step 6 – select the data ..........................................................................6 Step 7 - Select File, Return data to Microsoft Excel .....................................7 Step 8 – find the data range bounds ........................................................8 Step 9 – insert columns.........................................................................10 Step 10 – Copy Lookups into columns ....................................................10 Step 11 – Test .....................................................................................11 Step 12 – Clean up for Display .............................................................11 Usage ................................................................................................12 Adding the Attributes to Complete the Data Model...................................17 Usage ................................................................................................19 Summary ............................................................................................20

Introduction A data dictionary is a common, standard document used in configuration management planning. UCMDB’s data model has traditionally been documented in a spreadsheet generated by product management. While this may continue, it may also be useful to create a data dictionary specific to a given implementation, i.e., with specific packages deployed. This is in some cases a critical improvement over depending on an imperfectly matching or dated document. This document provides the “recipe” for creating a document wherever and whenever it is needed. A working example (and the out-of-the-box class model for UCMDB 8.0) is provided here. The steps taken to build this spreadsheet are still included, in the case they may need to be modified for future versions or purposes.

UCMDB v8.0 Class Model

Page 1 of 20 March 4, 2009

Page 2: Using Microsoft Excel to View the UCMDB Class Model.… · Using Microsoft Excel to View the UCMDB Class Model ... For Oracle, choose “Oracle in ... excel’s VLOOKUP function B

Caution: Some assembly is required. This procedure should only be attempted by trained professionals. If all you need is the completed spreadsheet, you can skip the rest of this document. Caution: Direct access of the database is unofficially discouraged unless under supervision by an HP technical person. If the UCMDB database is altered in any way outside the product, this is officially discouraged and may result in unsupportable problems. Never alter the UCMDB database in any way except with UCMDB. This spreadsheet can be re-created listing all the classes and attributes of the UCMDB class model as it exists in a specific UCMDB at report creation time. The steps are shown below. Differences in component versions may vary the appearances or steps shown below.

Step 1 – Start Excel Start Excel and select Data, Import External Data, New Database Query…,

then <New Data Source> as shown below:

Step 2 - Select a name and the type of database used by UCMDB

Page 2 of 20 March 4, 2009

Page 3: Using Microsoft Excel to View the UCMDB Class Model.… · Using Microsoft Excel to View the UCMDB Class Model ... For Oracle, choose “Oracle in ... excel’s VLOOKUP function B

Select the type of database UCMDB was installed on. For Microsoft SQL Server, choose “SQL Server” source as shown above. For Oracle, choose “Oracle in <DB name>” source. You may need to install the Oracle client on your workstation for the Oracle source to appear here. If you select SQL Server, the dialog for authenticating to the database is shown below. The dialog will differ slightly for Oracle:

Step 3 – Authenticate and connect to the database Fill in the name, description, and host name or IP address of the SQL server but do not click OK yet. Then, configure how you will authenticate to the database. The default is shown above. The below screen capture shows what was changed for this example:

Page 3 of 20 March 4, 2009

Page 4: Using Microsoft Excel to View the UCMDB Class Model.… · Using Microsoft Excel to View the UCMDB Class Model ... For Oracle, choose “Oracle in ... excel’s VLOOKUP function B

Do not click OK at this point. Click Options:

Step 4 - Change the default database to the UCMB ”data” database Note: this may differ in your installation depending on the naming convention chosen to name the UCMDB databases at installation. Generally, you will see three databases with “Foundation”, “Data”, and “History” or mnemonics thereof in their names, and “data” is the correct one. Again, get help from your DBA or UCMDB administrator if necessary.

Page 4 of 20 March 4, 2009

Page 5: Using Microsoft Excel to View the UCMDB Class Model.… · Using Microsoft Excel to View the UCMDB Class Model ... For Oracle, choose “Oracle in ... excel’s VLOOKUP function B

Do not change anything else unless necessary, and click OK.

Step 5 – Select the CCM_CLASSES table The Create New Data Source dialog returns. Select the CCM_CLASSES table as the default table:

Click OK.

Page 5 of 20 March 4, 2009

Page 6: Using Microsoft Excel to View the UCMDB Class Model.… · Using Microsoft Excel to View the UCMDB Class Model ... For Oracle, choose “Oracle in ... excel’s VLOOKUP function B

Ensure the new data source (UCMDB 8.0 as shown in the example) and click OK. The Microsoft Query tool appears. For clarity the screen shots are compressed.

Step 6 – select the data Double-click on the “*” in the CLASS_NAME in the CCM_CLASSES table:

Page 6 of 20 March 4, 2009

Page 7: Using Microsoft Excel to View the UCMDB Class Model.… · Using Microsoft Excel to View the UCMDB Class Model ... For Oracle, choose “Oracle in ... excel’s VLOOKUP function B

Data is retrieved and shown in the Query grid.

Step 7 - Select File, Return data to Microsoft Excel

The dialog asks where you want to put the query data. Click OK. Microsoft Excel is populated with the external data:

Page 7 of 20 March 4, 2009

Page 8: Using Microsoft Excel to View the UCMDB Class Model.… · Using Microsoft Excel to View the UCMDB Class Model ... For Oracle, choose “Oracle in ... excel’s VLOOKUP function B

Class Model data shown in Microsoft Excel. The columns displayed are: CLASS_ID CUSTOMER_ID CLASS_NAME DISPLAY_NAME PARENT_ID CLASS_TYPE DESCRIPTION IS_ACTIVE NAME_SPACE IS_FACTORY IS_UPDATED Most of these columns are not needed or are used only via lookup, so we will hide these later.

Step 8 – find the data range bounds Locate the first and last rows of the data and remember this row number. For UCMDB out-of-the-box, this number is 460 as shown below:

Page 8 of 20 March 4, 2009

Page 9: Using Microsoft Excel to View the UCMDB Class Model.… · Using Microsoft Excel to View the UCMDB Class Model ... For Oracle, choose “Oracle in ... excel’s VLOOKUP function B

Upper row is row 7.

Last row is row 592. You will use this number in the formula values below.

Page 9 of 20 March 4, 2009

Page 10: Using Microsoft Excel to View the UCMDB Class Model.… · Using Microsoft Excel to View the UCMDB Class Model ... For Oracle, choose “Oracle in ... excel’s VLOOKUP function B

The upper range will depend on whether you have inserted any title rows for headers and titles. For this example, the data range was rows 7 to 460.

Step 9 – insert columns Insert two columns before column A, so that column A becomes Column C with two empty columns before it:

After this step, insert another column between columns H and I, so that column I is blank and column J contains the class description, as shown below:

Step 10 – Copy Lookups into columns Using the table below, replicate the following formulae into the indicated columns for all rows that contain data. One way to do this is: Copy the formula into the top row of data. Copy the cell value. Select the rest of the cells in the column and Paste.

Col Formula Column Description Suggested Display Label/Hide

A =IF(F2="",0,F2) Normalizes the Parent hierarchy and accounts for the root class having no parent. Also places the parent id to the left of the lookup range as required for

Parent_id – Hide

Page 10 of 20 March 4, 2009

Page 11: Using Microsoft Excel to View the UCMDB Class Model.… · Using Microsoft Excel to View the UCMDB Class Model ... For Oracle, choose “Oracle in ... excel’s VLOOKUP function B

excel’s VLOOKUP function B =VLOOKUP(A7,$C$7:$G$592,3,

FALSE) Looks up the parent’s name from the parent_id. If no parent (root), value is FALSE. Substitute the references to $C$& and $G$592 to your ranges found in step 8.

Parent Class

C Internal Class ID Hide D Unused Hide E Internal CI Type Class Name Hide F CI Type Display Name Class Name G Internal Parent ID Hide H Raw Type Hide I =IF(H7="OBJECT","CI","Rela

tion") Simplifies distinction between a CI or a Relation

Type

J

CI Type Description Description

K-N

Unused Hide

Step 11 – Test At this point you should have a working spreadsheet. The columns should look similar to the following:

Spreadsheet showing class model with parent hierarchy.

Step 12 – Clean up for Display If you have any items left over from step 10, make adjustments now.

Page 11 of 20 March 4, 2009

Page 12: Using Microsoft Excel to View the UCMDB Class Model.… · Using Microsoft Excel to View the UCMDB Class Model ... For Oracle, choose “Oracle in ... excel’s VLOOKUP function B

Hide Columns - Hide the columns you do not want to display in the final result. Be default, columns A, C-E, G-H, and K-N are hidden. To hide a column, resize it into zero width, by either dragging the right-hand side of the column to the left-hand edge, or, from the menu, Format, Column, Hide. Rename Columns – Change or add column header names (by default on row 6). Follow the recommendations in step 10 or alter them to your needs. Resize Columns – Resize columns appropriately. For Column J, the description, you may want to expand it and turn word wrap on, so that a landscape page setup will be only one page wide. Add Header and Titles – You may want to title your spreadsheet, update a last-updated date, or place contact information in the upper rows. Do any formatting such as , turning word wrap on or off, bolding or otherwise highlighting the titles, etc. Format Text – Adjust font faces or sizes as needed. If you are planning on printing the document, you may want to do a print preview and consider using landscape page setup. It is possible to print all columns within one landscape page width.

Usage You should have something similar to the following:

Page 12 of 20 March 4, 2009

Page 13: Using Microsoft Excel to View the UCMDB Class Model.… · Using Microsoft Excel to View the UCMDB Class Model ... For Oracle, choose “Oracle in ... excel’s VLOOKUP function B

Using Excel, you can now use the list in any way appropriate. A few suggestions: Searching – Excel allows you to search for any value, including the names and descriptions used here. Search can be limited to row or column, etc.

Search and resulting find. Export to customer-facing documents – The spreadsheet contents can be copied and pasted to a document, or the Save As… can be used to convert the data to a wide variety of formats.

Page 13 of 20 March 4, 2009

Page 14: Using Microsoft Excel to View the UCMDB Class Model.… · Using Microsoft Excel to View the UCMDB Class Model ... For Oracle, choose “Oracle in ... excel’s VLOOKUP function B

Example of saving the spreadsheet to a web page.

Class Model shown as a web page from html. Sorting by various columns - The default order of the rows is in id order, not particularly useful.

Page 14 of 20 March 4, 2009

Page 15: Using Microsoft Excel to View the UCMDB Class Model.… · Using Microsoft Excel to View the UCMDB Class Model ... For Oracle, choose “Oracle in ... excel’s VLOOKUP function B

Efficient sorting in Excel: 1. Click on the left column of the title row (row 6 above). 2. Type CTRL+Shift+End which will select all the data. 3. Alt+d,s invokes the sorting dialog:

If header data is seen in the top row, the “Header row” button will be selected and the column headers appear in the Sort by selection boxes. Hint: Sorting the Type column in Ascending order will put the CIs first, then the Relations (C precedes R alphabetically).

Resulting sort. Sorting by Type, then Class Name allows easy browsing of the classes and links.

Page 15 of 20 March 4, 2009

Page 16: Using Microsoft Excel to View the UCMDB Class Model.… · Using Microsoft Excel to View the UCMDB Class Model ... For Oracle, choose “Oracle in ... excel’s VLOOKUP function B

Sorting by Type, then by Parent Class Name browses the model hierarchically. Create custom perspectives: - Save the spreadsheet to other spreadsheets and rename them, applying whatever sorting, labeling, or formatting you wish for multiple uses or users.

Here, multiple customizations are saved in different worksheets and labeled as shown by the red boxes.

Page 16 of 20 March 4, 2009

Page 17: Using Microsoft Excel to View the UCMDB Class Model.… · Using Microsoft Excel to View the UCMDB Class Model ... For Oracle, choose “Oracle in ... excel’s VLOOKUP function B

Adding the Attributes to Complete the Data Model The above steps demonstrate how to extract data and produce a report of the UCMDB Class Model at the CI Type level. To complete the data model, the attributes are added next. The end result is a single spreadsheet with each attribute’s information displayed, including the name of the owning class and the name of the parent of the owning class. This procedure will re-use the previous steps, and should produce something similar to the following:

Steps to add attributes:

1. Created another data source named UCMDB80-Attr according to step 1. The default table is CCM_ATTRIBUTE.

2. Add all columns another worksheet named “Attributes by CI Type”. 3. Import the data into the new worksheet starting at row 6. Repeat steps

2-8 for the Attribute data. 4. Three columns are added to the left-hand side (A-C). 5. The column formula, column titles, and explanations for the Attribute-

level table are as shown in the table below. 6. Follow steps 11 and 12 for the cleanup and initial attempts at usage.

Create some copies and sort on various columns.

Page 17 of 20 March 4, 2009

Page 18: Using Microsoft Excel to View the UCMDB Class Model.… · Using Microsoft Excel to View the UCMDB Class Model ... For Oracle, choose “Oracle in ... excel’s VLOOKUP function B

Col Formula Column Description Suggested Display Label/Hide

A =IF(M7="",G7,M7) Copies the Attribute name to the left hand column for ease of human readability. Uses the external name if present, otherwise refers to the internal name.

Name

B =IF(B7=0,"None",VLOOKUP(B7,'CI Types by Parent'!$C$7:$F$592,4,FALSE))

Displays the Classe’s parent’s name. Uses a VLOOKUP to the CI Type worksheet. Searches by Class name in the next column.

Parent Class Name

C =VLOOKUP(E8,'CI Types by Parent'!$C$7:$G$592,5,FALSE)

Looks up the id of the parent CI Type. Intermediate step to allow lookup of the parent’s name in column A.

Class Parent ID - hide

D =VLOOKUP(E8,'CI Types by Parent'!$C$7:$F$592,3,FALSE)

Internal Class Name. Found by Class ID in column E.

Class Name

E Internal Attribute ID ATTRIBUTE_ID – Hide

F Internal Class ID CLASS_ID - Hide G Internal Attribute Name Attribute Name

– Hide H Default Value of the attribute out of the box,

if any Default Value – Hide

I Attribute Data type – may be useful to sort on (see how big all your strings are, for example)

Data Type

J Value size – for variable-size attributes such as strings, the maximum length of the value – may be useful to sort on

Value Size - Hide

K Hide L Hide M External Attribute Name – copied to Column

A for more understandability Attribute Display Name - Hide

N Attribute Description Attribute Description

O 0 if no instances of this CI exist Empty? – Hide P Index – cardinal order of the attributes –

ignore Index – Hide

Q 0 if not altered since install Chg? – Hide R 1 if out of the box, 0 if custom Ootb? - Hide

Page 18 of 20 March 4, 2009

Page 19: Using Microsoft Excel to View the UCMDB Class Model.… · Using Microsoft Excel to View the UCMDB Class Model ... For Oracle, choose “Oracle in ... excel’s VLOOKUP function B

Usage The Data Model can be searched and sorted according to the usage section on page 12. This sort:

Produces this layout:

Produces this type of report (Sorted by Class Name) Caution: This document is approximately 170 pages in size. Sorting by attribute name then by class name, as shown below:

Page 19 of 20 March 4, 2009

Page 20: Using Microsoft Excel to View the UCMDB Class Model.… · Using Microsoft Excel to View the UCMDB Class Model ... For Oracle, choose “Oracle in ... excel’s VLOOKUP function B

Produces this layout:

Attribute list sorted by Attribute name (left-hand column) The included spreadsheet also contains a worksheet sorted by the parent class name.

Summary Microsoft Excel is an easy way to extract data about the UCMDB data model. Hide or manipulate columns as needed. The “Hide” indicators are only defaults. This technique is also useful for other purposes. Contact the author if you have questions. Feedback is welcomed, but remember the disclaimers at the beginning of this document.

Page 20 of 20 March 4, 2009