Ability to export from command line?



  • Hi there,

    I've spent some time writing a Python script which basically generates an XML file from a bunch of Puppet YAML files suitable for I-DOIT to import. It works great, except that often the imported file contains new objects which need to be linked to inside I-DOIT. For example, part of the imported XML may contain a new application/service that needs to be inserted into I-DOIT first. I need to insert the app into I-DOIT to find out the ID so I can link to it in the imported XML, so my question is whether it is possible to export the entire CMDB from command line?

    If it is possible, then I could parse my current XML to work out what applications/etc are missing from the exported file, then get them inserted, and run an export again. As it stands right now, I'm doing the export manually via the web interface but I was hoping to automate it if possible.

    Thanks in advance!

    Regards
    Gonzalo



  • It is currently only possible via wget:

    1. Switch to Modules -> Export, create your export and create an "Export Template"
    2. Get the direkt url of your export Template by clicking on in the the Export Template list (Something like moduleID=xy&pid=2&id=1).
    3. Try the autologin: http://localhost/idoit/index.php?login=admin,21232f297a57a5a743894a0e4a801fc3,1, That 2123.. String is a md5 Hash of your admin password, 1 is the id of your mandator
    4. Attach your export template parameters to the autologin URL: http://localhost/idoit/index.php?login=admin,21232f297a57a5a743894a0e4a801fc3,1&moduleID=xy&pid=2&id=1
    5. You should now be able to dump the export via: wget http://localhost/idoit/index.php?login=admin,21232f297a57a5a743894a0e4a801fc3,1&moduleID=xy&pid=2&id=1



  • Thank you very much. This is useful. Before receiving your reply I did something similar in that I used wget to log in with post-data and saved the cookies, then ran wget again with the cookies file and pointed it at the export module page selecting the "export to file" option. This created the idoit_export.xml file I needed.

    If anyone is interested in this script, let me know and I'll post it up. I think ds's way is nicer, though.



  • I'm very interested in this script. Can you post it up?



  • I'm interested too.
    Integrating idoit and puppet is on my TODO list too.


 


Datenschutz / Privacy Policy