cancel
Showing results for 
Search instead for 
Did you mean: 

Importing from an xml file or database to mega

SOLVED
MEGA Partner

Importing from an xml file or database to mega

Hi, im relatively new with mega and im trying to import from a database(CMDB) a list of servers, apps, city maps etc to mega.

I want mega to know by some key value or something to use the object server for when its needed and use the mega object application for when its and application or the object technology and so on. 

 

Thanks!

 

Gonzalo G.

4 REPLIES
MEGA Partner

Re: Importing from an xml file or database to mega

Dear Gonzalo,

 

can you explain a bit more in detail what you are trying to achieve? It's not completely clear to me.

 

some questions that immediately pop-up :

 

1. Are you looking for a one-shot upload ?

2. What are you trying to upload ? only objects and their attributes ? or also relations between both?

3. If it's not a one-shot upload, how often does it require to run ?

4. what do you mean with use the object server for when its needed?

5. what do you mean with some key value?

 

 

Regards

 

stijn

MEGA Partner

Re: Importing from an xml file or database to mega

Hi stijn, thanks for responding my question.

 

Here is what i want to do:

 

Lets say i have a database that each day creates a .txt,xls,csv which ever file that has a list of maybe applications, servers, technologies, etc.  and it stores it on a folder so that mega could read it automatically and generate the new objects it finds and updates objectects already created. For example the txt file has 3 applications, so mega reads that information and uses the object application in mega and creates all 3 of them or finds 2 new technologies and mega creates or updates using the object technology.

 

Or if this is not possible, maybe mega can connect directly to the database withouth looking for a file.

 

im new with the mega tool so i dont know if its possible to do something like this automatically everyday.

 

I hope i explained it a little better. i just need to upload the objects and their properties

 

thanks a lot!

 

Gonzalo.

Highlighted
MEGA Partner

Re: Importing from an xml file or database to mega

Clear now, and absolutely possible and not to hard to achieve.

 

There are different ways to achieve this. The fastest and easiest is by creating a script / program and schedule it (through your companies scheduler ) to run every night.

 

When the program executes you have  two possibilities:

1. Read the CMDB data directly through the CMDB API and import directly in MEGA through the MEGA API

2. Read a file with the CMDB info at a predefined location and import in MEGA throug the API

 

Let's assume you take option 2 as you suggested.

 

What you need to watch out for is thinking about how will you know that the object is new or it's an update? Are you going to store the CMDB identifier of the object in MEGA, so when the program finds an object with that identifier it knows it's an update or not? Or will you do it the other way around, when an object is created in MEGA supply it's ID to the CMDB application?

 

Storing the identifier in MEGA is easier when you go for the file based option. When you bridge the two applications (option 1) I would store the identifiers also in the CMDB application.

 

In order to achieve this task; you need to get acquinted with the API of MEGA. the documentation is good on this and I'm pretty sure there are few examples there that get you on the way.

 

regards

 

stijn

MEGA Partner

Re: Importing from an xml file or database to mega

Thanks stijn you have helped me a lot!