VMware ソフトウェアインストールレコードのサンプルペイロード

  • リリースバージョン: Australia
  • 更新日 2026年03月12日
  • 所要時間:9分
  • VMware 検出ライセンスキー消費 [samp_vmware_license_key_usage] テーブルにサードパーティーディスカバリーソースからのソフトウェアインストールレコードを入力する、VMware パブリッシャーパックのサンプルペイロード。

    ディスカバリーソースを介してソフトウェアのインストールを検出したら、IRE REST API エンドポイントを介してペイロードを ServiceNow インスタンスに送信し、VMware 検出ライセンスキー消費 [samp_vmware_license_key_usage] テーブルにソフトウェアインストールレコードを入力します。
    注:
    [プロパティ] ページで、[サードパーティのデータソース統合フレームワーク [com.snc.samp.ire.datasource.integration] を使用するときにスケジュール済みジョブを有効にします。
    1. VMware 検出ライセンスキー [samp_vmware_license_key] テーブルにライセンスキーを作成するためのペイロードを送信します。
    2. ペイロードの応答本文から、新しいライセンスキーの Sys ID をコピーし、後で使用できるようにテキストエディターに貼り付けます。
    3. 拡張 IRE API を使用して、新しいライセンスキーを使用する CI の Sys ID をクエリします。
    4. 応答本文から、CI の Sys ID をコピーし、後で使用できるようにテキストエディターに貼り付けます。
    5. ライセンスキーの Sys ID と CI の Sys ID を含むペイロードを送信します。
    6. スケジュール済みジョブ SAM- Update Software Usage を実行して、VMware 検出ライセンスキー消費 [samp_vmware_license_key_usage] テーブルにソフトウェアインストールレコードを入力します。
    Request Body
    { 'items': [
                    {'className':'cmdb_ci_vcenter',
                  'related': [
                              {
                              className:'samp_vmware_license_key',
                                values:{
                                 'cost_unit':'cpuPackage',
                                          'edition':'esxEnterprisePlus.vram',
                                          'features':'autodeploy,das,dpvmotion',
                                          'license_key':'SYDOJ-28J5Q-78X48-0NC24-REKAR',
                                          'product_name':'VMware vSphere 5 Enterprise Plus',
                                          'product_version':'5.0',
                                          'rights_owned':'8',
                                          'rights_used':'6'
                                  }
                              }
                            
                            ],
                  'values': {
                     'name':'VCenter Ref 1A'
                      }
                  },
                  {
                    'className':'cmdb_ci_win_server',
                     'values': {'name':'VirtualMachine-WS2'
                               }
                          }
                  ],
                  'relations':[{
                       'type':'Runs on::Runs',
                       'parent':0,
                       'child':1
                     }]
                }
    
    Response Body
    {
      "result": {
        "items": [
          {
            "className": "cmdb_ci_vcenter",
            "operation": "INSERT",
            "sysId": "8fb47793e7cc10107aea07d8d2f6a93a",
            "relatedSysIds": [
              "cbb47793e7cc10107aea07d8d2f6a93f"
            ],
            "relatedItems": [
              {
                "className": "samp_vmware_license_key",
                "sysId": "cbb47793e7cc10107aea07d8d2f6a93f",
                "markers": [],
                "inputIndices": [
                  {
                    "mainIndex": 0,
                    "subIndex": 0
                  }
                ]
              }
            ],
            "additionalRelatedItems": [],
            "identifierEntrySysId": "Unknown",
            "identificationAttempts": [
              {
                "attributes": [
                  "name"
                ],
                "identifierName": "VMWare VCenter Ref CI",
                "attemptResult": "NO_MATCH",
                "searchOnTable": "cmdb_ci_vcenter",
                "hybridEntryCiAttributes": []
              }
            ],
            "errorCount": 0,
            "markers": [],
            "inputIndices": [
              0
            ]
          },
          {
            "className": "cmdb_ci_win_server",
            "operation": "UPDATE",
            "sysId": "30ccb31ddbe7720087b9fd441d961992",
            "identifierEntrySysId": "556eb250c3400200d8d4bea192d3ae92",
            "identificationAttempts": [
              {
                "attributes": [
                  "serial_number",
                  "serial_number_type"
                ],
                "identifierName": "Hardware Rule",
                "attemptResult": "SKIPPED",
                "searchOnTable": "cmdb_serial_number",
                "hybridEntryCiAttributes": []
              },
              {
                "attributes": [
                  "serial_number"
                ],
                "identifierName": "Hardware Rule",
                "attemptResult": "SKIPPED",
                "searchOnTable": "cmdb_ci_hardware",
                "hybridEntryCiAttributes": []
              },
              {
                "attributes": [
                  "name"
                ],
                "identifierName": "Hardware Rule",
                "attemptResult": "MATCHED",
                "searchOnTable": "cmdb_ci_hardware",
                "hybridEntryCiAttributes": []
              }
            ],
            "errorCount": 0,
            "markers": [],
            "inputIndices": [
              1
            ]
          }
        ],
        "additionalCommittedItems": [],
        "relations": [
          {
            "className": "cmdb_rel_ci",
            "operation": "INSERT",
            "sysId": "43b47793e7cc10107aea07d8d2f6a940",
            "identifierEntrySysId": "Unknown",
            "errorCount": 0,
            "markers": [],
            "inputIndices": [
              0
            ]
          }
        ],
        "additionalCommittedRelations": []
      }
    }
    
    From this we get the samp_vmware_license_key sys id
    "relatedSysIds": [
              "cbb47793e7cc10107aea07d8d2f6a93f"
            ]
    
    -- Obtaining the CI sys id (POST)
    role: sam_admin
    
    
    https://k8s0057813-node1.thunder.lab3.service-now.com/api/now/identifyreconcile/queryEnhanced?sysparm_data_source=ServiceNow
    
    Request Body
    { 'items': [ {'className':'cmdb_ci_win_server', 'values': {'name':'Server-WS11'} }]}
    
    Response Body
    {
      "result": {
        "items": [
          {
            "className": "cmdb_ci_win_server",
            "operation": "UPDATE",
            "sysId": "99ccb31ddbe7720087b9fd441d9619da",
            "identifierEntrySysId": "556eb250c3400200d8d4bea192d3ae92",
            "identificationAttempts": [
              {
                "identifierName": "Hardware Rule",
                "attemptResult": "SKIPPED",
                "attributes": [
                  "serial_number",
                  "serial_number_type"
                ],
                "searchOnTable": "cmdb_serial_number",
                "hybridEntryCiAttributes": []
              },
              {
                "identifierName": "Hardware Rule",
                "attemptResult": "SKIPPED",
                "attributes": [
                  "serial_number"
                ],
                "searchOnTable": "cmdb_ci_hardware",
                "hybridEntryCiAttributes": []
              },
              {
                "identifierName": "Hardware Rule",
                "attemptResult": "MATCHED",
                "attributes": [
                  "name"
                ],
                "searchOnTable": "cmdb_ci_hardware",
                "hybridEntryCiAttributes": []
              }
            ],
            "markers": [],
            "inputIndices": [
              0
            ],
            "mergedPayloadIds": [],
            "errorCount": 0
          }
        ],
        "additionalCommittedItems": [],
        "relations": [],
        "additionalCommittedRelations": []
      }
    }
    
    where  "sysId": "99ccb31ddbe7720087b9fd441d9619da" is the sys id of the ci/used_by
    
    
    // create usage table
    POST 
    https://k8s0057813-node1.thunder.lab3.service-now.com/api/now/table/samp_vmware_license_key_usage?sysparm_fields=sys_id
    
    {"license_key":"cbb47793e7cc10107aea07d8d2f6a93f","rights_used":"1","used_by":"99ccb31ddbe7720087b9fd441d9619da"}
    要素 説明
    className cmdb_ci_vcenter 関連テーブル [samp_vmware_license_key] テーブルの名前
    className samp_vmware_license_key ライセンスキーが作成されるテーブルの名前。
    className cmdb_ci_win_server Windows サーバーテーブルの名前
    name VirtualMachine-WS2 Windows サーバー仮想マシンの名前。