Updating the CMDB using an API



  • I need to find a way to automatically populate the CMDB whenever we build a new Linux server. This has to be totally automated because the VMs are being provisioned by Satellite and there is no way to add manual steps without interrupting the process or having a separate manual procedure.

    I have found several methods for producing reports from within i-doit and then manually checking information, and for interactively querying the CMDB (see below) but none of these tools enable me to see the fields/schema used to create the records that are already in the CMDB, or to bulk-upload one or more records for new virtual machines.

    Does anyone know where I can find some example programs or utilities to do this as there does not seem to be much on Google or GitHub

    ./idoit –version

    i-doit CLI tool 0.3

    /var/www/html/controller --help

    Usage: controller.php [OPTION] [PARAMETERS]
    e.g.:  controller.php -v -m workflow
    Options:
      -m HANDLER  Load handler HANDLER module.
      -u username  i-doit username
      -p password  i-doit password
      -i tenant    ID of tenant to connect to (use './tenants ls' for a list)
      -h          This help text
      -v          Verbose mode
      -d          Displays ALL debug messages

    HANDLER can be one of the following availlable handlers:
    addldapdn, archivelog, cleanup_auth, cleanup_objects, csv_import, import, increment_config, isc_dhcpd, jdisc, jdisc_discovery, ldap, maintenance, nagios, nagios_export, notifications, ocs, regenerate_relations, report, search_index, syslog, tenants, updatecheck, workflow



  • You can use the JSON-RPC API.



  • @franknagel:

    You can use the JSON-RPC API.

    Any tutorials on this?


  • i-doIT Team

    There are some examples in our knowledge base, but currently only in German. However, the JSON code itself is in English. We are working on closing this gap.

    Btw. the "i-doit CLI tool" you mentioned just USE the API but does NOT EXPLAIN what happens in the background. The "i-doit controller" does not use the API at all.


  • administrators

    An example that you could use via bash script would be this:

    
    curl --data '{"jsonrpc":"2.0","method":"cmdb.object.create","params":{"type":"C__OBJTYPE__SERVER","title":"My little server","apikey":"c1ia5q"},"id":1}' --header "Content-Type: application/json" https://demo.i-doit.com/src/jsonrpc.php
    

 


Datenschutz / Privacy Policy