In my role, I take part in a lot of sales calls with potential customers. During these meetings we often discover that the client utilizes an inventory tool Flexera hasn’t seen or touched, or they have a home-grown tool. Since most IT managers don’t want to buy another tool or deploy “yet another agent,” the same question almost always comes up – “Can’t you just write an adapter for that?”
Well, of course we can. We’ll happily sell more service hours, but the more important question is – should we? Many times, after some investigation, the answer is no.
Sometimes the home-grown tool actually does give us the information we need (Installer Evidence + File Evidence), and no adapter is needed. Or it turns out the client is OK with the risks of using the existing tool. Even with Installer and File evidence, there are some titles that really do require the Flexera Agent. What’s more, the Flexera Agent will likely still be needed in some areas in addition to creating a new Inventory Adapter.
The good news is that Flexera has the tools to help you write the Inventory Adapter yourself. Start by familiarizing yourself with the Database Objects available to build the Inventory Adapter. For this blog, we will assume you will be connecting to data in a database (SQL Server for simplicity).
Using Inventory Adapter Studio
Let’s start with the basics. FlexNet Manager Suite includes the Inventory Adapter Studio (IAS). When you create a “new” adapter using IAS, you will start with a pre-filled template and example queries.
Let’s look at in the Computer section and the first step – “Get domains from source database.” I’ve color-coded each section, and we’ll look at each one separately. Any text in bold is a field included in the example.
The left pane, in Blue, shows all of the steps that the adapter will take. In the example template, there are many steps that you may not need or may be collapsed. For your first adapter, you may want to step through each of these and only delete those steps that you do not have information for. But you can also leave them in place as you build your first adapter until you are absolutely sure they are not needed.
The center\top pane, in Yellow, contains information about the object and step you are working on.
- The Step Name should be unique and descriptive.
- The Execution options you will use for Object Adapters are ExecuteOnSource (meaning actions are taken on the SOURCE database, typically used to create temporary tables for staging data for use later in the adapter) and SourceToObject (meaning that you are outputting the query with data to be sent to FlexNet Manager Suite to populate the object).
- The Data Object Type contains the data objects that are defined and may be used to populate data in FlexNet Manager Suite.
- File sets the filename where this step will be stored on the file system and must be an XML.
Leave the other fields in the Yellow area alone for now. You can utilize them for Excel as a data source as well as version your code to work with multiple versions of a data source (when underlying schema changes), but we aren’t going into that here. Just above this pane is where you define your connection to the Inventory Source.
Moving on to the Red pane on the right side. If you have chosen the SourceToObject Execution type and selected an object from the Data object type, the right pane contains the object information you need to create from your query. A few very important notes, these data fields are case sensitive. So, when you write your query, you want to make sure your output fields match exactly.
You also want to make sure your data type matches. If the data object is expecting an int and your database contains an integer in a text field, you need to cast or convert it to an Int. Also, don’t overflow your varchar fields, utilize Left and Trim functions as needed.
Finally, the center Green pane. This is where you do your actual work and write your query. Think of this as your Query screen. You may use comments with the appropriate comment nomenclature for the database you are connecting (in our example, SQL Server, so ‘–‘ for single line or ‘/* */‘ for multi-line). While you may load data into temporary tables if you wish, there should be one and only one “Output” query. Rename your output fields to match the appropriate information in the object model (Red pane).
One of the nice things about how the framework is created is that you don’t have to have every field available at once. As long as you include the Primary Key (labeled Natural Key), you can use multiple queries (each as their own step) to build the object. So, if you have IP and MAC Addresses in a separate table, you can build the appropriate query to convert them to a comma delimited list separately from the rest of the Computer Object – which is indeed included in the example. You can run each step (once you’ve defined your inventory connection) by clicking the Run current script. You will see the output in the result pane.
Putting it all together
Now that you have an overview of how the IAS works, you “simply” put it all together. I know, there’s nothing “simple” about it. What you’re looking for, at a minimum, is what you need to calculate license positions, which means the Computer Object (with HostName, SerialNumber, Processor Information, Chassis Information and as much other information as you can) and installed software. Ideally, you will want Installation Information and Installed File Evidence information. The example template separates these out to pull the normalized Installer and File Evidence information, and THEN links that normalized information to a computer object. However, you also have access to Consolidated Objects – ConsolidatedInstallerEvidence and ConsolidatedFileEvidence if pulling all of the information into a single object is more feasible. It is best practice to separate Computer, Installer, File, etc. information into their own XML files, but it is not a requirement of the tool.
I’ve found creating a new “template”, saving it as an example, then starting clean and building one object at a time with a small dataset is the most helpful for me. First Computer, then Installation Evidence and finally any other objects I can access.
Of course, your Flexera Services and Strategic Success Team is available to help you every step of the way. Contact our services team for help with creating the adapter!