Discussion:
[otrs] How to use Import/Export Management to create links between config items
Martin Aigner
2011-03-08 09:52:34 UTC
Permalink
Hello OTRS,

first of all, OTRS is a great project. We are struggeling with an ancient
ticket/inventory systems for ages and now it seems we are finally able to
swithing to OTRS. Thanks for that.

Right now I am trying to migrate our inventory to OTRS using the import/export
management. I retrieve inventory data from OCS inventory
http://www.ocsinventory-ng.org/ and write a csv file with a simple python
script. btw: I am willing to share the script if someone is interested. It is
not a big deal, though.

This procedure works fine for computers, printers, monitors... as stand alone
items.

What I would like to do is to import the link between this items. I can
provide the IDs of the related items but it seems that the import manager
cannot create a template to import such data. I use
$OTRS/bin/otrs.ImportExport.pl with a template I created using the admin
interface.

Best, Martin
Martin Aigner
2011-03-08 09:58:24 UTC
Permalink
Hello OTRS,

first of all, OTRS is a great project. We are struggeling with an ancient
ticket/inventory systems for ages and now it seems we are finally able to
swithing to OTRS. Thanks for that.

Right now I am trying to migrate our inventory to OTRS using the import/export
management. I retrieve inventory data from OCS inventory
http://www.ocsinventory-ng.org/ and write a csv file with a simple python
script. btw: I am willing to share the script if someone is interested. It is
not a big deal, though.

This procedure works fine for computers, printers, monitors... as stand alone
items.

What I would like to do is to import the link between this items. I can
provide the IDs of the related items but it seems that the import manager
cannot create a template to import such data. I use
$OTRS/bin/otrs.ImportExport.pl with a template I created using the admin
interface.

Best, Martin
Udo Bretz
2011-03-08 10:44:19 UTC
Permalink
Hello Martin,

unfortunately the Import/Export script is currently not able to create
links between objects.

But you could write a script, which uses Kernel/System/LinkObject.pm,
especially the LinkAdd() function to create the links.

Best regards,
Udo
Post by Martin Aigner
Hello OTRS,
first of all, OTRS is a great project. We are struggeling with an ancient
ticket/inventory systems for ages and now it seems we are finally able to
swithing to OTRS. Thanks for that.
Right now I am trying to migrate our inventory to OTRS using the import/export
management. I retrieve inventory data from OCS inventory
http://www.ocsinventory-ng.org/ and write a csv file with a simple python
script. btw: I am willing to share the script if someone is interested. It is
not a big deal, though.
This procedure works fine for computers, printers, monitors... as stand alone
items.
What I would like to do is to import the link between this items. I can
provide the IDs of the related items but it seems that the import manager
cannot create a template to import such data. I use
$OTRS/bin/otrs.ImportExport.pl with a template I created using the admin
interface.
Best, Martin
---------------------------------------------------------------------
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
Martin Aigner
2011-03-16 10:26:53 UTC
Permalink
Thanks Udo,

you approach works as expected. Excellent API btw.

Best, Martin
Post by Udo Bretz
Hello Martin,
unfortunately the Import/Export script is currently not able to create
links between objects.
But you could write a script, which uses Kernel/System/LinkObject.pm,
especially the LinkAdd() function to create the links.
Best regards,
Udo
Post by Martin Aigner
Hello OTRS,
first of all, OTRS is a great project. We are struggeling with an ancient
ticket/inventory systems for ages and now it seems we are finally able to
swithing to OTRS. Thanks for that.
Right now I am trying to migrate our inventory to OTRS using the
import/export management. I retrieve inventory data from OCS inventory
http://www.ocsinventory-ng.org/ and write a csv file with a simple python
script. btw: I am willing to share the script if someone is interested.
It is not a big deal, though.
This procedure works fine for computers, printers, monitors... as stand
alone items.
What I would like to do is to import the link between this items. I can
provide the IDs of the related items but it seems that the import manager
cannot create a template to import such data. I use
$OTRS/bin/otrs.ImportExport.pl with a template I created using the admin
interface.
Best, Martin
---------------------------------------------------------------------
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
---------------------------------------------------------------------
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
Martin Aigner
2011-03-29 10:53:38 UTC
Permalink
FYI: attached is the script that creates the links between conputers and
monitors in OTRS.

The script is (I hardly dare to say) documented inline. But it's not a big
deal. Feel free to ask.

cheers, Martin
Post by Martin Aigner
Thanks Udo,
you approach works as expected. Excellent API btw.
Best, Martin
Post by Udo Bretz
Hello Martin,
unfortunately the Import/Export script is currently not able to create
links between objects.
But you could write a script, which uses Kernel/System/LinkObject.pm,
especially the LinkAdd() function to create the links.
Best regards,
Udo
Post by Martin Aigner
Hello OTRS,
first of all, OTRS is a great project. We are struggeling with an
ancient ticket/inventory systems for ages and now it seems we are
finally able to swithing to OTRS. Thanks for that.
Right now I am trying to migrate our inventory to OTRS using the
import/export management. I retrieve inventory data from OCS inventory
http://www.ocsinventory-ng.org/ and write a csv file with a simple
python script. btw: I am willing to share the script if someone is
interested. It is not a big deal, though.
This procedure works fine for computers, printers, monitors... as stand
alone items.
What I would like to do is to import the link between this items. I can
provide the IDs of the related items but it seems that the import
manager cannot create a template to import such data. I use
$OTRS/bin/otrs.ImportExport.pl with a template I created using the
admin interface.
Best, Martin
---------------------------------------------------------------------
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
---------------------------------------------------------------------
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
---------------------------------------------------------------------
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
Sebastien Bory
2011-03-10 13:47:43 UTC
Permalink
Hello Martin,
I am in the same situation , i use OTRS for ticket and OCS for my Inventory,
but I failed to import my inventor y( csv files from OCS) to OTRs items, if
you have the solutions I'm interested

thanks

Sébastien  Bory
-----Message d'origine-----
De : otrs-***@otrs.org [mailto:otrs-***@otrs.org] De la part de
Martin Aigner
Envoyé : mardi 8 mars 2011 10:58
À : User questions and discussions about OTRS.
Objet : [otrs] How to use Import/Export Management to create links between
config items

Hello OTRS,

first of all, OTRS is a great project. We are struggeling with an ancient
ticket/inventory systems for ages and now it seems we are finally able to
swithing to OTRS. Thanks for that.

Right now I am trying to migrate our inventory to OTRS using the
import/export management. I retrieve inventory data from OCS inventory
http://www.ocsinventory-ng.org/ and write a csv file with a simple python
script. btw: I am willing to share the script if someone is interested. It
is not a big deal, though.

This procedure works fine for computers, printers, monitors... as stand
alone items.

What I would like to do is to import the link between this items. I can
provide the IDs of the related items but it seems that the import manager
cannot create a template to import such data. I use
$OTRS/bin/otrs.ImportExport.pl with a template I created using the admin
interface.

Best, Martin
---------------------------------------------------------------------
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
Martin Aigner
2011-03-15 08:53:33 UTC
Permalink
It depends on what you call a "solution" ;)

But here it is. The files are not accepted by the mailing list so I put them
on http://www3.s.roteskreuz.at/files/
I use the latest OTRS version 3.0.6 with ITSM 2.1.96

The script (in python 2.6) connects to your ocs database via the MySQLdb
package. Btw I'm using ocs 1.3.3. If you are using a different version make
sure the database model is the same.
You can configure the connection in config.py, the queries reside in ocs.py
where the entites are encapsulated in the corresponding functions.
* get_hardware
* get_drives
* get_networks and so on

The most interesting file is hardware.py. It corresponds to computers in OTRS.
In OTRS computers may have more than one harddrive or network adapter. The
script has a hardcoded limit of five items of such. This (or a similar) limit
has to be fixed since the relation of drives or NICs with the computer needs
to be flattened for the cvs file. An XML importer would be nice btw.

In line 87 the script prints one line per computer in a format of your choice.
e.g.
boxname,Production,Operational,JackBlack,Windows7...

According to the format of your cvs file you can create an import template in
the admin area of your OTRS installation.

Format: cvs (obviously)
Class: Computer
Maximum number of one element: 5 (as mentioned above)
Column Separator: Comma

Then create a mapping along your cvs format. (see import_mapping.png)
Note that the field "OCSlink" is no OTRS default value. It stores the URL of
the computer in OCS. It uses ocs_url in config.py. You can add the definition
in the config item managment for Computers like:
{
Key => 'OCSlink',
Name => 'OCS Link',
Searchable => 0,
Input => {
Type => 'Text',
Size => 100,
MaxLength => 100,
},
},

This allows you to click on the ocslink from the config item view in OTRS.
You might also want to lengthen the field for "HardDisk" because the string
the script generates is usually longer. Import works but if you want to edit
the item in OTRS afterwards you will get an error.

e.g.
{
Key => 'HardDisk',
Name => 'Hard Disk',
Input => {
Type => 'Text',
Size => 50,
MaxLength => 100,
},

monitors.py works similar. ocs2otrs.py is the main script. Right now it lacks
any convenience so you have to comment out the modules (hardware of monitors)
you dont need.

The steps for the are always the same.
* Load ocs info from database
* format a cvs line per item
* create the corresponding import filter
* import as in the following example

write the csv file
$> ./ocs2otrs.py > computers.csv

lets assume the number of the import filter is 000003 and otrs is installed in
$OTRS. You can also use the OTRS web interface, of course
$> $OTRS/bin/otrs.ImportExport.pl -n 000003 -a import -i computers.csv

I'm still thinking of a way to connect computers with monitors in OTRS. Thanks
to Udo for the hint, btw. I guess thats the best way right now.

There is a quite ugly hack I have to mention. For computers I think it is fine
to use the name as an identifier (at least in out network). For monitors I
create an artifical identifier from the ocs ID to the computer where it is
connected to. e.g. "123: ***@yourbox". You might think of something that
fits better for your purpose.

For now, I hope that helps. At least you forced me to write some documentation
about it ;)

cheers, Martin
Post by Udo Bretz
Hello Martin,
I am in the same situation , i use OTRS for ticket and OCS for my
Inventory, but I failed to import my inventor y( csv files from OCS) to
OTRs items, if you have the solutions I'm interested
thanks
Sébastien Bory
-----Message d'origine-----
Martin Aigner
Envoyé : mardi 8 mars 2011 10:58
À : User questions and discussions about OTRS.
Objet : [otrs] How to use Import/Export Management to create links between
config items
Hello OTRS,
first of all, OTRS is a great project. We are struggeling with an ancient
ticket/inventory systems for ages and now it seems we are finally able to
swithing to OTRS. Thanks for that.
Right now I am trying to migrate our inventory to OTRS using the
import/export management. I retrieve inventory data from OCS inventory
http://www.ocsinventory-ng.org/ and write a csv file with a simple python
script. btw: I am willing to share the script if someone is interested. It
is not a big deal, though.
This procedure works fine for computers, printers, monitors... as stand
alone items.
What I would like to do is to import the link between this items. I can
provide the IDs of the related items but it seems that the import manager
cannot create a template to import such data. I use
$OTRS/bin/otrs.ImportExport.pl with a template I created using the admin
interface.
Best, Martin
---------------------------------------------------------------------
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
---------------------------------------------------------------------
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
Loading...