Defining custom Config Item classes in OTRS CMDB

Source:www.opentechguides.com | Date Published: 2017-12-06 15:23:32

There are five types of configuration items (CIs)available in OTRS by default which are Computer, Hardware, Network, Software and Location. The asset portfolio of a modern day IT department consists of a lot many items that may not actually fit into any of those five broader categories. Let's take the example of a Company mobile phone, to add a mobile phone in OTRS CMDB you can select the class as Computer and set the type field to Phone. But the information we need to capture for a mobile phone such as the IMEI number, warranty end date, upgrade date, type, OS version etc., is different from the information we would need about a desktop computer. This means we need to create a new Config Item class to manage mobile phones. This article guides you on how to add a custom Config item class in OTRS.

1. First of all login to OTRS using an account that has admin privileges.

2. Click Admin tab and then on the General Catalog link.

General Catalog

3. In the General Catalog Management page click Config Item Class.

General Catalog Management

4. Click Add Catalog Item on the Actions panel.

Add Catalog Item

5. Input as below and click the Submit button.

New Catalog Item

6. Next, we will create another class that defines various Mobile Operating Systems types. Click General Catalog link again and click Add Catalog Class from the Action panel on the left.

Add Catalog Class

7. Input as below and click the Submit button.

This will create the Config Item class Mobile::Type and adds a catalog item named Android.

New Catalog Class

Repeat this step to add catalog items for other Operating systems like IOS, Nokia Symbian etc.,

8. Go back to the Admin page and click Config Items link.

Config Items

9. In the Config Item Management screen, click on Mobile

Config Item Management

10. Click Change class definition button in the Actions panel and then we can add definitions for following fields to the Mobile class.

Change Class Definition

Input the following in the Definition box and click Submit. The keys used in this class definition are explained at the end of this article.

[
   {
    Key => 'PhoneNumber',	
	Name => Translatable('Phone Number'),
	Searchable => 1,
	Input => {
 	    Type => 'Text',
 	    Required => 1,
	    Size => 15,
	    MaxLength => 15,
		},
    },
    {
	Key => 'Owner',
	Name => Translatable('Owner'),
	Searchable => 1,
	Input => {
 	    Type => 'Text',
 	    Required => 1,
 	    Size => 50,
 	    MaxLength => 50	,
		},
    },
    {
	Key => 'Make',
	Name => Translatable('Make'),
	Searchable => 1,
	Input => {
 	    Type => 'Text',
 	    Size => 30,
 	    MaxLength => 30,
		},
  },
  {
	Key => 'Model',
	Name => Translatable('Model'),
	Searchable => 1,
	Input => {
 	    Type => 'Text',
 	    Size => 30,
 	    MaxLength => 30,
		},
  },
  {
	Key => 'OperatingSystem',
	Name => Translatable('Operating System'),
	Searchable => 1,
	Input => {
 	    Type => 'GeneralCatalog',
 	    Class => 'ITSM::ConfigItem::Mobile::Type',
 	    Translation => 1,
		},
  },
  {
	Key => 'IMEINumber',
	Name => Translatable('IMEI Number'),
	Searchable => 1,
	Input => {
 	    Type => 'Text',
 	    Size => 15,
 	    MaxLength => 15,
		},
  },
  {
	Key => 'ActivationDate',
	Name => Translatable('Activation Date'),
	Searchable => 1,
	Input => {
 	    Type => 'Date',
 	    Required => 1,
 	    YearPeriodPast => 20,
 	    YearPeriodFuture => 10,
		},
   },
   {
	Key => 'WarrantyExpirationDate',
	Name => Translatable('Warranty Expiration Date'),
	Searchable => 1,
	Input => {
 	    Type => 'Date',
 	    YearPeriodPast => 20,
 	    YearPeriodFuture => 10,
		},
	},
   ]

11. You have now completed adding a new CI class named Mobile. To add a new CMDB items of type Mobile, Click CMDB in the menu bar and select New.

New CMDB Item

12. You will be presented with a form which displays all the fields that you have defined in the Mobile class.

Add CMDB Item

Config Item Class Attributes

In the config item class definition, you define a set of fields and their attributes as key/value pairs. There is a set of pre-defined attributes that are allowed in a class definition. These are:



Open Tech Guides | www.opentechguides.com