77.2 Exporting the Inventory Information

You can customize the inventory information you want to export from the Inventory database into a comma-separated value (.csv) or an XML file.

You select the inventory components that should be exported, such as the Operating System Name and Version. You can further filter the inventoried workstations whose attributes are exported depending upon the export scope. For example, you can export only those inventoried workstations with a particular processor speed. The Data Export tool exports all inventoried workstations satisfying these query conditions into a .csv or .xml file.

If you want to reuse the same data export settings for export, you can save the data export configurations.

The following sections help you use the Data Export tool:

77.2.1 Procedure to Export the Inventory Information

  1. In ConsoleOne, select a container.

  2. Invoke the Data Export tool.

    • To invoke the Data Export tool from a database object, right-click the database object, click ZENworks Inventory, then click Data Export.

    • To invoke the Data Export tool from the ConsoleOne Tools menu, you must first configure the Inventory database and then click Tools, click ZENworks Inventory, then click Data Export. For more information on how to configure the Inventory database, see Section 77.1.1, Configuring the Inventory Database.

  3. Select Create a New Database Query.

    This option lets you add a new query that defines the inventory components such as hardware, software, network, and others that you want to export. You can also specify the criteria to limit the inventoried workstations and the database sites to be included in the query. Based on the inventory components and criteria you specify, the inventory information from the database is exported to a .csv or .xml file.

    NOTE:If you want to load existing configuration settings for data export, select Open a Saved Database Query. This options lets you modify the settings for data export and then export the data to a .csv or .xml file. For more information, see Section 77.2.2, Loading an Existing Configuration File.

  4. Click Next.

  5. Specify the filter conditions for the inventoried workstations.

    1. Click Edit Query. For more information on how to define a query, see Section 77.1.3, Viewing Inventory Information by Querying the Database.

    2. (Optional) The Enable Filter option is available for selection only if you define the query using the software classes and its attributes of a supported category. Following are supported categories:

      • Category 1: Software Group, Software Group File Information, Software Group Patch Information, Software, File Information, and Patch Information
      • Category 2: Exclude File Information
      • Category 3: Disk Usage

      The Enable Filter option is not available for selection if the query contains attributes belonging to different categories. For example, a query containing software.name=word, softwaregroup.name=office, and diskusage.name=exe.

      If you want the results stored in .csv or .xml file to be filtered on the basis of the above query, select the Enable Filter check box.

    3. Set the scope for exporting the information from the Inventory database.

      If the ConsoleOne snap-ins and the Data Export tool have been installed for both ZENworks 7 Server Management and ZENworks 7 Desktop Management, the Data Export tool allows you to change the scope of exporting the inventory information.

      By default, the Workstations option is enabled. The query locates all inventoried workstations satisfying the query expression. If ZENworks 7 Server Management and ZENworks 7 Desktop Management are installed in the same environment, the Workstations, the Servers and the Both options are available.

      When you select Workstations, the query locates all inventoried workstations satisfying the query expression. Choose Both to include all inventoried workstations and inventoried servers satisfying the query expression.

    4. Review the query that you define.

    5. Click Next.

  6. Select the database fields from the list of database fields, then click Add.

    If you select a group component, all subcomponents of the group are added. For example, if you select the Software component group, the subcomponents of Software such as vendor name, product name, and version are added.

  7. Click Next.

  8. View the data export settings.

    1. Click Save Configuration to save the configurations settings to an .exp file. Specify the filename for the .exp file and then click Save.

      The configuration file (.exp) contains the settings such as the inventory components you selected, and also the query formed for filtering the inventoried workstation data export. You create an .exp file so that you can reload the configuration settings and generate the .csv or .xml files any time you need to.

    2. Click Next.

  9. Select the machine from where you intend to perform the query.

    1. Perform the Query from This Computer: Select this option to run the data export processing from the workstation computer. This option accesses the Inventory database on the specified database server and export the data in to a .csv or .xml file.

      Perform the Query on a Remote Server: Select this option to run the data export program from any server that has Workstation Inventory components installed.

      Running the Data Export program from a server is recommended if you are exporting data from a large database with more than 10,000 inventoried workstations or if you have specified complex queries with more than 20 database fields selected for exporting.

    2. If you want to apply default encoding of the machine to the .csv or .xml file, select Default Encoding. The Default Encoding check box is selected by default. To apply Unicode encoding to the .csv or .xml file, select Unicode Encoding.

      NOTE:If you create an .exp file to perform the data export from the local machine but use the same .exp to perform data export from a remote server and you want Unicode encoding, you must manually edit the .exp file and set the value of DEExportEncode to UNICODE.

    3. Click Next.

  10. Select an export option.

    1. Select one the following options:

      Export to CSV: Saves the inventory information in a .csv file.

      Export to XML: Saves the inventory information in a .xml file.

    2. Specify the path and the filename where you want to create the .csv or .xml file.

    3. Click Finish.

      If the configuration settings are not saved, you are prompted to save the changes.

This generates the .csv or .xml file in the specified directory.

Open the .csv file in Microsoft Excel or any other CSV-supported viewer to view the exported data.

Open the .xml file in a XML viewer such as XML Spy. For more information, see Section 77.2.4, An Overview of XML and the Contents of an XML File.

77.2.2 Loading an Existing Configuration File

You can load an existing configuration file (.exp). An .exp file contains the settings such as the inventory components you selected, and also the query formed for filtering the inventoried workstation data export.

After you load the .exp file, you can modify the settings for data export and then export the data to a .csv or .xml file.

To load existing configuration settings for data export:

  1. Make sure that you have generated the data configuration files.

    Complete the procedure outlined in Section 77.2.1, Procedure to Export the Inventory Information. This procedure generates the .csv or .xml file and the data configuration files.

  2. In ConsoleOne, select a container and invoke the Data Export tool using any of the following methods:

    • To invoke the Data Export tool from a database object, right-click the database object, click ZENworks Inventory, then click Data Export.

    • To invoke the Data Export tool from the ConsoleOne Tools menu, you must first configure the Inventory database and then click Tools, click ZENworks Inventory, then click Data Export. For more information on how to configure the Inventory database, see Section 77.1.1, Configuring the Inventory Database.

  3. Select Open a Saved Database Query, then click Next.

    The default directory for .exp files is consoleone\consoleone_version\reporting\export. Click Browse to open an existing .exp file.

    If the .exp and .cfg files are invalid or are an older version, the data export will not proceed. The data export displays the number of servers and servers that satisfy the query and filter conditions for export.

  4. Select a saved database query from the list of saved queries.

    1. Select a saved database query from the list of saved queries. The list box displays the .exp files that are saved in consoleone\consoleone_version\reporting\export.

      or

      Click Browse to open an existing .exp file in any other location.

    2. (Optional) If the .exp and .cfg files are invalid or are an older version, the data export will not proceed. The data export displays the number of servers and servers that satisfy the query and filter conditions for export.

      If you want to modify the existing query, click Edit and modify the query and select the new database fields. For more information on how to define a query, see Section 77.1.3, Viewing Inventory Information by Querying the Database.

    3. Click Next.

  5. View the data export settings.

    1. Click Save Configuration to save the configurations settings to an .exp file. Specify the filename for the .exp file and then click Save.

      The configuration file (.exp) contains the settings such as the inventory components you selected, and also the query formed for filtering the inventoried workstation data export. You create an .exp file so that you can reload the configuration settings and generate the .csv or .xml files any time you need to.

    2. Click Next.

  6. Select the machine from where you intend to perform the query.

    1. Perform the Query from This Computer: Select this option to run the data export processing from the workstation computer. This option accesses the Inventory database on the specified database server and export the data in to a .csv or .xml file.

      Perform the Query on a Remote Server: Select this option to run the data export program from any server that has Workstation Inventory components installed.

      Running the Data Export program from a server is recommended if you are exporting data from a large database with more than 10,000 inventoried workstations or if you have specified complex queries with more than 20 database fields selected for exporting.

    2. If you want to apply default encoding of the machine to the .csv or .xml file, select Default Encoding. The Default Encoding check box is selected by default. To apply Unicode encoding to the .csv or .xml file, select Unicode Encoding.

    3. Click Next.

  7. Select an export option.

    1. Select one the following options:

      Export to CSV: Saves the inventory information in a .csv file.

      Export to XML: Saves the inventory information in a .xml file.

    2. Specify the path and the filename where you want to create the .csv or .xml file.

    3. Click Finish.

77.2.3 Running the Data Export Program From the Inventory Server

Running the Data Export program from a server is recommended if you are exporting information from a large database with more than 10,000 inventoried workstations or if you have specified complex queries with more than 20 database fields selected for exporting.

To run the data export program from the server:

  1. Make sure that you have generated the data configuration files.

    Follow the Step 1 to Step 5 as outlined in Section 77.2.1, Procedure to Export the Inventory Information and make sure that you save the settings in the .exp file.

    When you save a .exp file, a corresponding data configuration file is created in the same directory with the same filename as the .exp file and with the .cfg file extension.

  2. Click Perform the Query on a Remote Server to run the data export program from any server that has Workstation Inventory components installed, then click Finish.

  3. Copy the .exp file and .cfg file to the server.

    These two files should exist in the same directory on the Inventory server. The .cfg file contains the list of the database attributes to be exported.

  4. From the server console, run dbexport.ncf on NetWare servers, dbexport.bat on Windows servers, or /opt/novell/bin/DBExport on Linux servers. To do so, enter

    DBEXPORT “configuration_filename.exp” “csv_filename.csv

    where configuration_filename.exp is an existing file that contains the data export settings. You must enter the configuration_filename.exp and the csv_filename.csv filenames within double quotes. The data exported from the database is stored in csv_filename.csv.

  5. (Conditional) You are prompted whether to overwrite the file or not. In ZENworks Desktop Management SP1 Hot Patch 4 and later versions, if you want the file to be automatically overwritten without being prompted, then do as follows:

    1. Use a text editor to open the saved .exp file.

    2. Change the value of DEExportAutoOverwrite to YES.

      If the .exp file does not contain the entry for DEExportAutoOverwrite, you must manually append the following to the file:

      DEExportAutoOverwrite=YES.

If the .exp and .cfg files are invalid or are older versions, the data export does not proceed. The data export displays the number of inventoried workstations that satisfy the query and filter conditions for export.

77.2.4 An Overview of XML and the Contents of an XML File

Workstation Inventory allows you to export the inventory information from the Inventory database into an Extensible Markup Language (.xml) file by using the Data Export tool.

XML is a markup language that provides a format for describing structured data. An XML document is a text-based format. The XML source is made up of XML elements. The XML tags are not predefined and you must define your own tags.

For more information about XML, see the World Wide Web Consortium (W3C) XML Activity and Information web site.

A sample .xml file is as follows:

<?xml version="1.0" encoding=’UTF-8’?>
<!DOCTYPE InventoryInformation [<!ELEMENT Attribute (value)>
<!ATTLIST Attribute
     name CDATA #REQUIRED
     type (custom | regular) #REQUIRED
     units CDATA #IMPLIED
>
<!ELEMENT Class (Attribute*)>
<!ATTLIST Class
     name CDATA #REQUIRED
     instance CDATA #REQUIRED
>
<!ELEMENT InventoryInformation (Machine+)>
<!ELEMENT Machine (Class+)>
<!ATTLIST Machine
     name CDATA #REQUIRED
>
<!ELEMENT value (#PCDATA)>]
>
<InventoryInformation>
  <Machine name="blr-stl-zen1.blr.novell.com">
    <Class name="Processor" instance="1">
      <Attribute name="Current Clock Speed" type="regular" units="MHz">
        <value>2800</value>
      </Attribute>
      <Attribute name="Processor Family" type="regular">
        <value>"Intel(R) Xeon(TM)"</value>
      </Attribute>
    </Class>
    <Class name="IP" instance="1">
      <Attribute name="IP Address" type="regular">
        <value>164.99.163.9</value>
      </Attribute>
      <Attribute name="Subnet Mask" type="regular">
        <value>255.255.252.0</value>
      </Attribute>
    </Class>
  </Machine>
</InventoryInformation>   

XML uses a Document Type Definition (DTD) to describe the data. The DTD is embedded within the XML document.

A DTD lists the elements, attributes, and entities contained in a document and also, defines the relationship between the elements and attributes.

Following is the DTD embedded in the preceding sample xml file:

<?xml version="1.0" encoding=’UTF-8’?>
<!DOCTYPE InventoryInformation [<!ELEMENT Attribute (value)>
<!ATTLIST Attribute
     name CDATA #REQUIRED
     type (custom | regular) #REQUIRED
     units CDATA #IMPLIED
>
<!ELEMENT Class (Attribute*)>
<!ATTLIST Class
     name CDATA #REQUIRED
     instance CDATA #REQUIRED
>
<!ELEMENT InventoryInformation (Machine+)>
<!ELEMENT Machine (Class+)>
<!ATTLIST Machine
     name CDATA #REQUIRED
>
<!ELEMENT value (#PCDATA)>]
>

The following table explains the elements used in the sample XML file:

Elements Used in the Sample XML File

Description

Class

Device name

Type

Custom or Regular attribute

Units

Unit information

Instance

Device instance count