Archive for the ‘Asset Management’ Category

Adding an Attribute to the CMDB via a CMDB Driver Script

Thursday, April 3rd, 2014

There are a number of ways to create an attribute in the CMDB. You could use the BMC Atrium Core Console, Remedy API, or the CMDBDriver.

The BMC Atrium Core Console offers a nice GUI interface, and is fairly slick when used via the mid-tier. I have noticed some issues using the mid-tier version vs the UserTool version. One issue that I’ve noticed is that sometimes custom fields do not show up when your viewing the classes. When viewed from the UserTool, everything is there. Another issue I have noticed is that the Menu Style field shows different results when compaired to what one see’s in the UserTool.

The Remedy API is a very powerfull feature, if used correctly, and you understand what your doing. I have built everything from forms, fields, active links, filters, and guides with the API and really, one takes for granted what the GUI does for you.

But the topic is the CMDBDriver tool. This is not a user friendly tool, but once you understand it, its great for automating alot of your work.

The one feature is the “execute” command. This allows you to execute a driver script that is basically a list of commands (like a macro) that you want the driver to execute. The following text is what is used to create a selection field, with 3 entries, on the BMC_Application class:

ca
BMC.CORE
BMC_Application
CUS_BusinessGroup
OS-0050368f00f39DRrUwYP1cqw21KL
6
900100102
2
2
3
Corporate Group
12100
Customer Group
12200
Enterprise Group
12300
F
1
8
4
CUS.CUSTOM
0

These lines would sit in a text file, and the driver would execute the contents. The first line is the “CA” command which stands for Create Attribute. The following lines would be the supplied input for the process of manually creating an attribute.

The power of this feature is that you could maintain a number of these commands in the text file, allowing you to create as many fields, on as many forms as you like. For example, when I build out a new server environment, I can execute just one file that will add every custom field we added to the CMDB, bringing it upto speed with our existing environments.

CMDBDriver - Start Up

CMDBDriver – Start Up

 The next step is to enter the “init” command. This initizlizes the session, closing off any other session that you may have been already logged into. This is the first step that you must do when first opening the application. The next step is to enter the “log” command. Here you are logging in with your UserID, Password, and Server Name. Finally, if you are using a port number to connect to your server, enter the “ssp” command. This allows you to enter your TCP port number.
Initialization and Login

Initialization and Login

The next step is to issue the “ex” command. This will prompt you for the command/driver file to load. Enter in the full path and filename. No need to enclose everything in quotes, as spaces dont matter.

Execute Command

Execute Command

This is the part of the process that gets cluttered, and leaving you wondering whats going on. As the CMDBdriver executes the script, prompts for data are appearing on the screen. Normally you would manually enter the values, but our command file is supplying the data for us. I would have been nice if the values were actually displayed as the system exectued the file. Depending on how many attributes, which class your hitting, and the amount of data in your CMDB, this could take a few seconds or minutes to complete.

If you have multiple attributes being created, this screen will repeat the the cluttered block for each one. Once done, you should finally see the Command prompt come back.

Execution of the command file

Execution of the command file

Over the years, dealing with problem tickets with BMC Support and talking with the application engineers, they all have said that they use the CMDBDriver for most of the work that they do. When you use the Atrium Core/Class Manager to add attributes, the CMDBDriver is actually being called in the background to do the work. It pulls its information from the OBJSTR:Class form (these are your Pending records). Once the driver completes the task, the record in the OBJSTR:Pending form is removed.

One nice thing about the CMDBDriver is that if something goes wrong, it tells your right away. If something goes wrong using the AtriumCore/ClassManager, you have to go in and start deleting records in various forms.

One last helpful hint if AtriumCore/ClassManager does not appear to be completing the building of your new field, you can grab the ‘Pending ID’ and from within the CMDBDriver, issue the “sync” command, which will prompt you for the Pending ID. This will force the attribute to complete for you, and the matching record in the OBJSTR:Pending form will disapear (As long as there are no errors in your system, but thats another issue to resolve). Note that the ‘Pending ID’ is not visible on the form, but you have to export the data, or manually type it out from the report option. On most of my sites, we have made this field visible (read only) so its easy to grab.

 

 

How to Sync New CMDB 7.6.0x fields to the Asset Management AST forms

Friday, September 2nd, 2011

Using the Class Manager, you must first create your custom fields:

Open up the BMC_ComputerSystem, select the Attributes tab and then click the New button at the bottom. Enter in the details for the new field and then save:

Once the save process has completed (this can take some time depending at what level you add the fields), you can then open up the class you added the fields to to view. In our example, viewing the CMDB class BMC.CORE:BMC_ComputerSystem, we can see that the system has completed the process of adding two of our custom fields to one of the Custom tabs:

If we view the Asset Management AST:ComputerSystem form, we can see that we have no Custom tab showing as the fields that were added into the CMDB don’t get added to the AST forms automatically:

The next step is to sync the fields that were added. To do this, use the following list of steps: 

  1. navigate from the side bar to Administrator Console / Application Administration Console.
  2. Change to the Custom Configuration tab.
  3. Under the Application Settings, expand the Asset Management / Advanced Options list.
  4. Click on the Sync Asset UI with CMDB.
  5. Click the Open button.

The window that opens up should be a search window. Just click the Search button to pull back all the forms. In the list of Search values that come back, locate the CMDB form you are looking to sync. In our example, we select the ComputerSystem record:

With our record selected, press the Update Asset UI button (Press the Update All button if you have alot of forms that need to be updated):

Details after hitting the sync button:

Reloading the AST form, AST:ComputerSystem form in our example, we can see that two of our custom fields have now been added:

 

PERSONAL NOTE: Due to some problems that we have experienced in a number of our environments (Linux and Solaris), we have found that using the Asset Sync does not work reliablly and you should do this using the manual steps. We have run into table corruption with the fields, especially if you need to remove any fields.  We only add/modify/remove fields from the CMDB via the CMDBDriver (I have been advised a number of time by BMC Support that this is the way they recommend). I have done this for all the implentations of 7.x and have never experienced any problems.

UPDATE (October 2012): I was advised by a BMC consultant that there was a “bug” in 7.6.04 SP1 and possibly SP2 where the Sync did not work correctly. This appears to have been resolved in SP3. I personally have not had a chance to verify.