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

    Anfügen der CPU Daten an ein Virtual Server Objekt

    Scheduled Pinned Locked Moved Entwicklung
    2 Posts 2 Posters 330 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.
    • R Offline
      roadfox
      last edited by roadfox

      Hallo zusammen

      Ich versuche einem Objekt vom Typ: "C__OBJTYPE__VIRTUAL_SERVER" die CPU's via API zu konfigurieren bzw. zu aktuallisieren.
      Unklar ist mir wie ich an die Liste der möglichen werte z.b. für "manufacturer" komme. Gemäss doku hier ist dies "isys_catg_cpu_manufacturer__id" doch wie krieg ich eine Liste der cpu's und deren id's?

      Mein Aufruf sieht folgendermassen aus:

      {
              "jsonrpc": "2.0",
              "id": 1,
              "method": "cmdb.category.create",
              "params": {
                "objID": "{{ idoit_read.json.result.id }}",
                "category": "C__CATG__CPU",
                "data": {
                  "manufacturer": "{{ cpu_manufaturer_id }}",
                  "type" "{{ cpu_type_id }}",
                  "cores": "2",
                  "frequency": "1995",
                  "frequency_unit": "{{ cpu_frequency_unit_id }}",
                  "description": "updated by ansible"
                },
                "apikey": "{{ idoit_apikey }}",
                "language": "{{ idoit_language }}"
              }
            }
      

      Mit fehlen also "manufacturer_id", "type_id" und "frequency_unit_id". Ich möchte diese auslesen und falls die passende CPU nicht vorhanden ist diese auch erstellen können.

      Gruss
      Andi

      1 Reply Last reply Reply Quote 0
      • Philipp HörselmannP Offline
        Philipp Hörselmann
        last edited by

        Moin @roadfox
        bei den Herstellern und den Typen handelt es sich um Dialog+ Felder. Daher musst du einmal zuvor die Dialog+ Einträge auslesen.
        (https://kb.i-doit.com/display/de/API+Methoden#APIMethoden-cmdb.dialog.read)
        Für Hersteller sieht das wie folgt aus:
        Request:

        {
            "version": "2.0",
            "method": "cmdb.dialog.read",
         		"params": {
                "category": "C__CATG__CPU",
                "property": "manufacturer",
                "apikey": "{{ api_key }}",
                "language": "en"
            },
            "id": 1
        }
        
        {
          "id": 1,
          "jsonrpc": "2.0",
          "result": [
            {
              "id": "1",
              "const": "",
              "title": "AMD"
            },
            {
              "id": "2",
              "const": "",
              "title": "Intel"
            },
            {
              "id": "3",
              "const": "",
              "title": "IBM"
            },.....
            .....
            ...
        }
        

        Folgen kannst du dann auch die id anstelle des title nutzen.
        Bsp.:

        {
            "version": "2.0",
            "method": "cmdb.category.save",
            "params": {
                "object": XXXXXX,
                "data": {
        	   "title": "First_CPU",
        	   "manufacturer": 1,
        	   "type": 2
                },
                "category": "C__CATG__CPU",
                "apikey": "{{ api_key }}",
                "language": "en"
            },
            "id": 1
        }
        

        Informationen, wie du Kategorien und Attribute ansteuern kannst, findest du in i-doit direkt in der Verwaltung. -> https://kb.i-doit.com/pages/viewpage.action?pageId=7831613#API(JSON-RPC)-KategorieninderIT-Dokumentation

        Die Methoden cmdb.category.create und cmdb.category.update sind übrigens veraltet. Die Methode cmd.category.save ist eine zusammengefasste und verbesserte Variante 😉

        Weitere Informationen zur Nutzung der API findest du hier -> https://kb.i-doit.com/pages/viewpage.action?pageId=7831613

        VG
        Phil

        1 Reply Last reply Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post