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

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 On 08.03.2011 10:58, Martin Aigner wrote:
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

Thanks Udo, you approach works as expected. Excellent API btw. Best, Martin On Tuesday, March 08, 2011 11:44:19 AM Udo Bretz wrote:
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
On 08.03.2011 10:58, Martin Aigner wrote:
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

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 On Wednesday, March 16, 2011 11:26:53 AM Martin Aigner wrote:
Thanks Udo,
you approach works as expected. Excellent API btw.
Best, Martin
On Tuesday, March 08, 2011 11:44:19 AM Udo Bretz wrote:
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
On 08.03.2011 10:58, Martin Aigner wrote:
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

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-bounces@otrs.org [mailto:otrs-bounces@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

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: Display@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 On Thursday, March 10, 2011 02:47:43 PM Sebastien Bory wrote:
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-bounces@otrs.org [mailto:otrs-bounces@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
--------------------------------------------------------------------- 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
participants (3)
-
Martin Aigner
-
Sebastien Bory
-
Udo Bretz