Community
    • Categories
    • Recent
    • Popular
    • Users
    • Search
    • Register
    • Login

    Updating the CMDB using an API

    Scheduled Pinned Locked Moved Operating
    5 Posts 5 Posters 1.0k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • I Offline
      ingenico
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • F Offline
        franknagel
        last edited by

        You can use the JSON-RPC API.

        1 Reply Last reply Reply Quote 0
        • B Offline
          Bertsch
          last edited by

          @franknagel:

          You can use the JSON-RPC API.

          Any tutorials on this?

          1 Reply Last reply Reply Quote 0
          • bheisigB Offline
            bheisig i-doit Team
            last edited by

            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.

            1 Reply Last reply Reply Quote 0
            • dkirstenD Offline
              dkirsten administrators
              last edited by

              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
              

              Viele Grüße,

              Daniel

              1 Reply Last reply Reply Quote 0
              • First post
                Last post