The Community is now in read-only mode to prepare for the launch of the new Flexera Community. During this time, you will be unable to register, log in, or access customer resources. Click here for more information.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Custom Inventory Importer is a command-line interface (CLI) tool that allows you to upload custom inventory data into Flexera One for processing, just like any other data source. This tool allows you to test out ideas or demonstrate the platform's capabilities.

How to use the Custom Inventory Importer

To use Custom Inventory Importer, you'll need:

  • Access to the Flexera One organization that you intend to import custom inventory into
  • A valid Flexera IAM Refresh Token for API authentication and authorization
  • A custom inventory file that conforms to Flexera One common ingest format
  • A Windows or Linux machine that can connect to your Flexera One organization UI

1. Obtain a Flexera IAM Refresh token for use with the CLI

  1. Log into Flexera One and navigate to User Settings / API Credentials.
  2. Select the Create API Refresh Token button.
  3. Copy the token and note it for later use.refreshToken.png

2. Get a copy of the Custom Inventory Importer

You'll use a different executable depending on your environment, but the same parameters are supported in both. For example, the following two commands will do the same thing, but you'll need to substitute the path parameters for those in your chosen environment.

  • Windows
    ciImporterSigned.exe import template --out c:\imports\template
  • Linux
    ./ciImporter4Linux import template --out ./imports/template


3. Get your custom inventory file ready

Option A: Import from CSV

1. Get a CSV Template to populate.

You can use the tool to build a CSV template that the importer supports to convert from. Execute the tool with the following CLI parameters:

  import template --out <folder or new zip file to create>

Depending on what you specify, this action will either create a folder, populate an empty folder, or create a zip file. The folder will contain a series of expected CSV files, with the first row in each specifying the type of data it expects.

IMPORTANT: Including the following file types is essential when preparing the CSV files. However, only the "Computer" related CSV files require mandatory data. In contrast, non-computer-related CSV files do not need data but must contain their respective field headers.
• BusinessService
• Computer
• InstallerEvidence
• OSEvidence

2. Convert the CSV to the Common Ingest format

Converting the CSV to the Common Ingest format requires a folder or zip file with the CSV files prepared. Execute the tool with the following CLI parameters:

  import convert --in <zip or folder where CSV files are> --connectionName <name of this source> --orgId <your org id> --out <new zip file to create>

Your files will be at the destination zip file you specified, ready for import.

Option B: Build the CommonIngest files yourself

The common ingest format is a series of JSON Lines files, a convenient format for storing structured JSON data. These are the four types of custom inventory data structures supported.

  • Computers.
    Sample JSON:
{
    "resource_type": "Computer",
    "computer": {
        "machine_id": "id:0",
        "name": "ThinkStation S20",
        "domain": "",
        "manufacturer": "Lenovo",
        "model_no": "ThinkStation S20",
        "operating_system": "Windows XP Professional",
        "service_pack": "",
        "inventory_date": "",
        "serial_number": "WCL-206-Q10853-BF",
        "total_memory": "1000",
        "calculated_user": "calculated_user",
        "last_loggedon_user": "user1",
        "network_info": [
            {
                "mac": "5f:a9:9f:a6:9c:7e",
                "ipv4_address": "130.14.35.93",
                "ipv6_address": "2001:cafe:3d68:ec43:b99c:5737:ce43:b936"
            },
            {
                "mac": "70:0f:47:18:64:9d",
                "ipv4_address": "106.166.194.76",
                "ipv6_address": "2001:cafe:ca02:7679:21e0:b790:ac6:ea0"
            },
            {
                "mac": "11:0f:d0:e5:22:1a",
                "ipv4_address": "152.230.80.56",
                "ipv6_address": "2001:cafe:f650:fe17:1ad9:2eb7:5e74:b8c4"
            }
        ],
        "hdd_count": "1",
        "number_of_processors": "2",
        "hdd_total_space": "123",
        "chassis_type": "Unknown",
        "display_adapter_count": "3",
        "processors": [
            {
                "name": "Intel Automated needs-based functionalities",
                "clock_speed_max": 2311,
                "core_count": 4,
                "logical_count": 13
            },
            {
                "name": "Intel Integrated well-modulated software",
                "clock_speed_max": 1345,
                "core_count": 1,
                "logical_count": 12
            }
        ],
        "inventory_agent": "serviceNow",
        "incomplete": "1"
    },
    "key": "eea9ec0d3790200044e0bfc8bcbe5dc3",
    "event_type": "update"
}
  • Installer evidence.
    Sample JSON:
{
    "resource_type": "InstallerEvidence",
    "installer_evidence": {
        "machine_id": "id:0",
        "items": [
            {
                "title": "Unde consequatur voluptas eum. 1.1.1.7474",
                "version": "1.1.1.7474",
                "manufacturer": "Effertz Inc",
                "source": "Uninstall",
                "product_code": "{d0389040-c253-f87f-ebea-68c9f58bb56d}",
                "install_date": "2005-11-21T11:23:06",
                "installed_id": "{d233a747-1c00-ea0a-638a-750a83d056d6}",
                "software_id": "{ffc8b194-5cc3-446f-b885-fb580cd6db97}"
            },
            {
                "title": "Unde consequatur voluptas eum. 1.1.1.7474",
                "version": "1.1.1.7474",
                "manufacturer": "Effertz Inc",
                "source": "Uninstall",
                "product_code": "{d0389040-c253-f87f-ebea-68c9f58bb56d}",
                "install_date": "2005-11-21T11:23:06",
                "installed_id": "{d233a747-1c00-ea0a-638a-750a83d056d6}",
                "software_id": "{ffc8b194-5cc3-446f-b885-fb580cd6db97}"
            },
            {
                "title": "Unde consequatur voluptas eum. 1.1.1.7474",
                "version": "1.1.1.7474",
                "manufacturer": "Effertz Inc",
                "source": "Uninstall",
                "product_code": "{d0389040-c253-f87f-ebea-68c9f58bb56d}",
                "install_date": "2005-11-21T11:23:06",
                "installed_id": "{d233a747-1c00-ea0a-638a-750a83d056d6}",
                "software_id": "{ffc8b194-5cc3-446f-b885-fb580cd6db97}"
            },
            {
                "title": "Et consequatur. 7.6.4.1292",
                "version": "7.6.4.1292",
                "manufacturer": "Weimann LLC",
                "source": "Uninstall",
                "product_code": "{50df42b5-e30c-9b67-8aec-d107ce46ddd7}",
                "install_date": "2017-10-15T08:04:55",
                "installed_id": "{f4091e4b-fe17-c2aa-16d5-355a1ad9174d}",
                "software_id": "{c383c86f-2eb7-4100-0107-23915e74c986}"
            },
            {
                "title": "Quia ea iure nisi aut. 6.4.1.7314",
                "version": "6.4.1.7314",
                "manufacturer": "Padberg, Wisozk and Blick",
                "source": "Uninstall",
                "product_code": "{79971c2c-d8b2-5ea4-8f30-476692f18d6e}",
                "install_date": "2004-01-03T18:55:08",
                "installed_id": "{70e90e38-9631-97ad-8ff2-c99127d900e4}",
                "software_id": "{75bb4018-3642-6d5a-91d1-4d7ec3c2baeb}"
            },
            {
                "title": "Nihil sint. 19.3.5.2076",
                "version": "19.3.5.2076",
                "manufacturer": "Corkery-Schuppe",
                "source": "Uninstall",
                "product_code": "{7814471b-305a-c775-40e8-40de03758993}",
                "install_date": "2008-12-10T11:24:00",
                "installed_id": "{31e6f56f-9fb2-cb1e-fdb4-2fc0a03192a1}",
                "software_id": "{b4170332-114e-1881-cf58-7efb8946ab44}"
            },
            {
                "title": "Quia ea iure nisi aut. 6.4.1.7314",
                "version": "6.4.1.7314",
                "manufacturer": "Padberg, Wisozk and Blick",
                "source": "Uninstall",
                "product_code": "{79971c2c-d8b2-5ea4-8f30-476692f18d6e}",
                "install_date": "2004-01-03T18:55:08",
                "installed_id": "{70e90e38-9631-97ad-8ff2-c99127d900e4}",
                "software_id": "{75bb4018-3642-6d5a-91d1-4d7ec3c2baeb}"
            },
            {
                "title": "Omnis natus quis cumque placeat laudantium. 14.7.0.9878",
                "version": "14.7.0.9878",
                "manufacturer": "Hessel and Sons",
                "source": "Uninstall",
                "product_code": "{344d803c-04e5-0f72-ae21-39a3bd15ee6a}",
                "install_date": "2012-01-01T04:24:50",
                "installed_id": "{b1e219f0-1b1c-630a-5b6d-b2dc92d6fbbc}",
                "software_id": "{79f7961f-f86f-a67c-ccd8-bee619e458af}"
            },
            {
                "title": "Perspiciatis officia. 3.5.9.9255",
                "version": "3.5.9.9255",
                "manufacturer": "Ledner, Torphy and Cassin",
                "source": "Uninstall",
                "product_code": "{48303caf-acad-777c-f8e6-a264bcb63af1}",
                "install_date": "2004-06-03T09:52:11",
                "installed_id": "{9d4279f9-45e9-d618-72a6-1684a7b1e65c}",
                "software_id": "{dcbcfe5b-d00f-43ec-6209-538efa3fc90d}"
            }
        ]
    },
    "key": "key:0",
    "event_type": "update"
}
  • Operating systems.
    Sample JSON:
{
    "resource_type": "OSEvidence",
    "os_evidence": {
        "machine_id": "id:0",
        "items": [
            {
                "manufacturer": "Senger Group",
                "name": "Microsoft Windows bhusuhcp",
                "caption": "Microsoft Windows Caption bhusuhcp",
                "csd_version": "Service Pack 2",
                "version": "5.2.9185"
            },
            {
                "manufacturer": "Kulas, Rowe and Ruecker",
                "name": "Microsoft Windows 99sacoel",
                "caption": "Microsoft Windows Caption 99sacoel",
                "csd_version": "Service Pack 4",
                "version": "5.2.4968"
            },
            {
                "manufacturer": "Senger Group",
                "name": "Microsoft Windows bhusuhcp",
                "caption": "Microsoft Windows Caption bhusuhcp",
                "csd_version": "Service Pack 2",
                "version": "5.2.9185"
            },
            {
                "manufacturer": "Johnston, Marvin and Jaskolski",
                "name": "Microsoft Windows wxrnqopw",
                "caption": "Microsoft Windows Caption wxrnqopw",
                "csd_version": "Service Pack 4",
                "version": "5.2.5618"
            },
            {
                "manufacturer": "Senger Group",
                "name": "Microsoft Windows bhusuhcp",
                "caption": "Microsoft Windows Caption bhusuhcp",
                "csd_version": "Service Pack 2",
                "version": "5.2.9185"
            }
        ]
    },
    "key": "key:0",
    "event_type": "update"
}
  • Business services.
    Sample JSON:
{
    "resource_type": "BusinessService",
    "business_service": {
        "id": "10000",
        "name": "Ibm websphere 8.2545",
        "computer_keys": [
            "key:1",
            "key:5",
            "key:2"
        ]
    },
    "key": "business-service-0",
    "event_type": "update"
}

You will also need to construct a "manifest.json," which describes how the file will be imported and important meta-information about the import.

See the attached file samplesJSON.zip for more examples.

4. Execute the Custom Inventory Importer

Execute the tool with the following CLI parameters:

upload --connectionName <connectionName> --file <CommonIngest zip file> --orgId <org id> --refreshToken "<my-token>" --region <the region your account is in>

Parameters supported:

Parameter Value Description
connectionName string The name of this datasource
file string The relative path to the file source being uploaded
orgid integer The Flexera assigned Organization ID for your account
refreshToken string The generated Refresh IAM token to authenticate the upload
region EU/US/AP/Staging The environment to connect to

Current Limitations

Only a single custom inventory data source is supported for each org. Therefore, subsequent imports via the Custom Inventory Importer to the same org will replace the previous ones.

Upcoming Features

  • Upload straight from CSV source (avoid conversion step)
  • Simpler CLI
100% helpful (2/2)
Comments
jasonlu
By Level 7 Champion
Level 7 Champion

Hi, I'm trying this out but I'm coming up with some questions:

1) regarding the upload parameters:

--file <CommonIngest zip file>

Does this mean the path to the extracted csv files with the data?

Does this mean zip the files back up?

2) Do I need to supply ALL the csv files in the location, or just the ones with data? 

3) What does this error mean?

Error details: 'Unfinished upload, trace id: '': read C:\imports\template: The handle is invalid.'

The location exists. The executing user has access. I've tried with only the populated files and also blank files. Same error.

 

 

JohnSorensenDK
By Moderator Moderator
Moderator

@jasonlu 

I have earlier succeeded following the steps above:

Capture.PNG

1. I created the CSV files in a folder and populated some of these with data. (Some of them merely contained the header record...)

2. Used the documented command to convert the content of this folder into a zip file with the common ingest import format.

3. Used the documented command to upload the zip file generated from the step above.

You will need all the CSV files in the folder for step 2, i.e., despite of some of them merely having the header record.

I haven't come across this specific error message, but I would suggest starting with a few records in each CSV file while troubleshooting it.

Thanks,

jasonlu
By Level 7 Champion
Level 7 Champion

Awesome, thanks. This is getting me moving.

One thing I've noticed is that at the convert stage if Computer.csv->InventoryDate or InstallerEvidence-Items.csv->InstallDate is blank then I get the error:

Root Source=Computer.csv,line=2:body.inventory_date must be formatted as a date-time but got value "", parsing time "" as "2006-01-02T15:04:05Z07:00": cannot parse "" as "2006"

However in the documentation neither of these are mandatory.

I've put some dummy data in and it converted and then uploaded successfully.

Assuming I'll have to wait for ITV to process the data before I declare victory.

thanks again.

j

 

 

JohnSorensenDK
By Moderator Moderator
Moderator

@jasonlu 

Thanks for the feedback, and yes, it can take quite some time before the data is visible in the dashboards. The evidence views are populated quicker, i.e., as soon as the normalization process has imported and processed the data queued in the pipeline:

Capture.PNG

I will notify the author about the dates issues you've run into and to request a documentation update.

Thanks,

 

jasonlu
By Level 7 Champion
Level 7 Champion

Thanks.

Had success in seeing the data finally in ITV. Looks like I'll need a better dataset than the test data that I have, but it works.

 

Final question, any idea about deleting the connection?

The  ciImpoterSigned.exe command does not have a delete function.

None of the items under the "IT Visibility" menu in FlexeraOne have it.

"Inventory"->"IT Visibility Devices" doesn't have it.

Nothing in "Data Collection"->"IT Visiblity Inventory Tasks" either.

 

Is it just a matter of blanking the data in the csv files and rerunning?

j

JohnSorensenDK
By Moderator Moderator
Moderator

Right, as you've discovered there are some limitations to use of the Custom Inventory Importer as also pointed out in the original post in this thread including its lack of visibility as an import task. Hence no option to "delete" it either...

I haven't personally tested if it would work with empty CSV's but it would be worth trying...

Thanks,

Version history
Last update:
‎Oct 28, 2024 09:24 PM
Updated by: