Lesson 1: Reassigning large quantities of software instances

This lesson shows you how to reassign large quantities of software instances with the REST API and a cURL command line tool. You can use the information in this lesson to implement an automatic external tool for large scale rebundling.

Before you begin

You must have root operating system privileges.

About this task

After software scan data is imported from the BigFix® server, software instances are automatically associated with products based on automatic bundling rules. If some instances are assigned to the wrong product, they must be reassigned correctly.

In this lesson, some instances of Tivoli® Storage FlashCopy® Manager are assigned to the wrong product. The Tivoli Storage FlashCopy Manager product is only installed on computers with a host name that begins with nc04, and only on Linux® computers. You reassign all other instances of Tivoli Storage FlashCopy Manager to a release of IBM® Tivoli Storage Manager.

Important:
  • Some of the commands in this lesson are long, and for the purposes of presentation, some line breaks were introduced. Treat each line break as a space.
  • You must add token ID at the end of each cURL command. To obtain the token,
    1. In the License Metric Tool user interface, click Management > Users.
    2. Click the user name.
    3. In the lower part of the page, click Show token.

Procedure

  1. Log on to your computer and start the command line interface.
  2. Retrieve a list of all products that are discovered in your environment. Run the following command:
    curl -v -X GET http://server_url:server_port/api/sam/swinventory/products?token=token_ID
  3. Review the list to obtain the product ID for IBM Tivoli Storage FlashCopy Manager.
    {
      "id": "16790",
      "level": "product",
      "isConfirmed": "false",
      "productReleaseComponent": "IBM Tivoli Storage FlashCopy Manager",
      "children": "true",
      "nmbOfAllRows": "44",
      "confidence": "11",
      "type": "root"
    }
  4. Retrieve all releases for the product. Use the product ID you obtained in the previous step. Run the following command:
    curl -v -X GET http://server_url:server_port/api/sam/swinventory/product/16790/
    releases?token=token_ID
  5. Review the list to obtain the release IDs for IBM Tivoli Storage FlashCopy Manager.
    {
      "label": "name",
      "identifier": "id",
      "numRows": "1",
      "items": [{
      "id": "985",
      "level": "release",
      "isConfirmed": "false",
      "numberOfAllInstances": "5",
      "productReleaseComponent": "IBM Tivoli Storage FlashCopy Manager 3.1",
        "children": "true",
        "nmbOfAllRows": "1",
        "confidence": "11"
    }
  6. Retrieve a list of all instances for the releases. Use the release IDs you obtained in the previous step. Run the following command:
    curl -v -X GET http://server_url:server_port/api/sam/swinventory/release/985/
    instances?token=token_ID
  7. Review the list to obtain the product inventory IDs for instances of IBM Tivoli Storage FlashCopy Manager that meet your criteria.

    Instances that are not installed on a computer with a host name that begins with nc04, or that are not installed on a Linux computer.

    Note: You might need to filter the list by using an external tool.
    {
      "isCharged": "true",
      "operatingSystem": "AIX 6.1",
      "isConfirmed": "false",
      "currentServerId": "IBM 8233 06A851P",
      "updateTime": "1381322771321",
      "children": "false",
      "hostname": "NC107073",
      "confidence": "11",
      "productInventoryId": "134",
      "id": "134",
      "level": "instance",
      "bundleRules": "the relation in the software catalog, the stand-alone pr
    oduct discovery",
      "isAgentDeleted": "false",
      "processorType": "IBM(R) POWER7 (750, 755, 775 servers) Multi-core All E
    xisting",
      "productReleaseComponent": "IBM Tivoli Storage Manager Client 6.3",
      "pvuPerCore": "100",
      "installationPaths": "/IBM Software/TSM",
      "nmbOfAllRows": "5",
      "isSimple": "false"
    },
    {
      "isCharged": "true",
      "operatingSystem": "Win2008R2 6.1.7601",
      "isConfirmed": "false",
      "currentServerId": "TLM_VM_42362841-6b4e-ea26-9755-07b28dc0fd41",
      "updateTime": "1381322771321",
      "children": "false",
      "hostname": "VMW009128109094",
      "confidence": "11",
      "productInventoryId": "137",
      "id": "137",
      "level": "instance",
      "bundleRules": "the relation in the software catalog, the stand-alone pr
    oduct discovery",
      "isAgentDeleted": "false",
      "processorType": "Other Other One core All Existing",
      "productReleaseComponent": "IBM Tivoli Storage Manager Client 6.3",
      "pvuPerCore": "100",
      "installationPaths": "C:\\IBM Software\\TSM",
      "nmbOfAllRows": "5",
      "isSimple": "false"
    }
  8. Retrieve a list of the releases where instances can be reassigned to. Use an instance ID you obtained in the previous step. Run the following command:
    curl -v -X GET http://server_url:server_port/api/sam/swinventory/
    targetBundlesOfInstances?productInventoryId=134&token=token_ID
  9. Review the list to obtain the IBM Tivoli Storage Manager release ID you want to reassign the instances to.
    {
      "id": "33424",
      	"appliedRules": 
      "the infrastructure co-location, the relation in the software catalog",
      	"releaseId": "33424",
    	  "isSelected": "false",
    	  "branchType": "0",
      	"confidenceLevel":3,
    	  "isShared": "false",
    	  "productName": "IBM Tivoli Storage Manager 6.3",
    	  "productInventoryId": "134},
    }
  10. Reassign the releases by running the following command:
    curl -v -X POST http://server_url:server_port/api/sam/swinventory/reassign -d 
    "productInventoryId=inventory_IDs&productId=release_ID&updateTime=timestamp"?token=token_ID
    Where:
    • inventory_IDs Are the instances to reassign
    • release_ID Is the product release to reassign to
    • timestamp Is the update time that is expressed in milliseconds. The timestamp must be equal to or greater than the timestamps retrieved as a property of the instances to reassign, in step.6

    For example:

    curl -v -X POST http://server_url:server_port/api/sam/swinventory/reassign -d 
    "productInventoryId=134,137&productId=33424&updateTime=9949237658579"
    An HTTP response 204 is received. The selected instances are reassigned to the new release.