UPDATED: I’ve changed employers and have moved on to other projects. I no longer use OTRS, or have access to OTRS, so I won’t really be able to help you beyond what I’ve already posted here.

Jeff

I’ve seen the number of people looking at my short entry dealing with importing items into OTRS’s CMDB, so I thought I’d expand on that a bit. I’ll go ahead and give a slight overview, then provide a quick-and-dirty description of how to manually import items into the CMDB. Later, when time permits, I’ll add a better explanation of how to automate the import process. I may clean this up at a later time, bur for now, I want to get down the basics.

You can manually import CMDB items (computers, software, etc.) into OTRS using the Import/Export function, via the web interface. There is also a way that you can automatically import items, via cron and the commandline. I have a brief overview of that here, but will create a more complete explanation at a later time. First things first though; you have to do the steps below anyway, before you can automatically import items. You have to have the import template created in order to automate the process, since the automation uses an existing template.

Overview

To create the template, we’ll need to identify what we’re importing, the delimiter, and the CMDB columns to be included. In my example, I’m importing desktop computers, the file is a comma-delimited format, and I’ll be submitting the minimum required fields.

Required Fields
What I mean by minimum required fields is that OTRS has a small number of fields within a CMDB record that have to be filled in. If you go into the CMDB section online and manually add an item, you can see what the requried fields are; they’ll be marked with an asterisk (star). For my desktop computer import, I’ll need to AT LEAST provide: Computer Name, Deployment State, Incident State, Network Adapter 1(NIC1), and whether it gets IP over DHCP.

Creating an Import Template

So, here’s a quick-and-dirty rundown of how to setup an import template. The values that are shown in the images below SHOULD get you a working template. You will however, probably want to edit the values to more precisely match what you need. As always, please read my disclaimer before proceeding.

Name: Name of your new templateObject: The object typeFormat: format of the import dataValid: set it as valid, if you want to be able to use the template…

4> When finished, click Next

5> Set the values in the Step 2 screen

Class: whatever type of import it will be – this affects what elements show up later.Maximum number of one element: Not sure what this does 🙂Empty field means keep value: This will leave existing data, rather than “blanking” it out.

6> When finished, click Next

7> Set the values in Step 3 screen

Column Separator: The separator used in your import file.Include Column Headers: That’s up to you. I do “No”

8> When finishd, click Next

9> Add mapping elements

There are a few things to note when adding elements:

1> Click “Add Mapping Element” to add a line for each field that is in the import file.
2> Add an entry for EVERY field in the import file, in the order they exist in the file.
3> There are some REQUIRED fields.These fields have to exist in the import file, and have valid values, in order for the record to import. The required fields are: Name,Deployment State, Incident State,NIC1,IP over DHCP Name,Vendor,Model,OS,NIC-IP

10> When finished adding elements, click Next

11> Fill in search criteria to be used for exporting (optional)

You don’t really need to do anything with this, if you’re only planning on importing items.

12> If/when you finish adding search criteria, click Finish

13> Note the number of the template that you just created

This should bring you back to Import/Export Management page that shows a listing of the existing Import/Export templates. You should see your newly created template listed there. Note the Number of your template, since this is what will be used to automate the import.

To actually import items, you’ll simply click on the “Import” link for the appropriate import template, select the source file with all of the records in it, and hit the “Import” button. When it finishes, it will give you Summary page which indicates total records, successes, and failures.

Share this:

1 Comment

[…] OTRS has an import/export utility that can actually be used to bring in outside information. First, you need to create a template from within the OTRS Admin interface. Once that’s done, you can then setup a cron job to actually run the import/export script, […]