Inventory and CMDB

Inventory

The Inventory feature provides all the necessary utilities to manage the entire set of items available to the company, find out their location, their manufacturer, their support contracts, the contact persons and telephone numbers, references and serial numbers, etc. Inventory items can be associated with tickets, allowing efficient management of the company's material resources.

Within the inventory there are different types of objects, with their own fields. It is possible to create new types and modify, add or delete fields of any type of object.

Create an inventory item type

Inventory item types are used to customize the different fields the item will have. You may manage the object types by clicking on the CMDBObject types option.

An inventory item type has a name, an icon, the minimum value it must have in stock, and a description associated. You may also define whether or not this type will appear as root in the inventory tree view.

Each type of object has a series of custom fields. In the example, the inventory item type called Software will have Version and Manufacturer fields associated with it.

The fields have the following properties:

  • Label.
  • Types: Numeric, text, checkbox, date, combo and external.
  • Reference field of the parent table:
    • Unique :Two inventory items cannot have the same value for this field (similar to an ID).
    • Inherit: It will take the owner, users and company values from the parent item.
    • Show in a list: It shows it in the general list by default.
    • Not allow updates: The field will not update when receiving remote inventory data.

External fields

External fields will show information from additional tables in Integria IMS database, added manually by an administrator.

To configure and be able to use an external field we need to create a new inventory item with the External Type selected and once it is selected, all the necessary fields for its configuration will appear:

  • External table name : Exact name, in the database, of the table where this external field is located. Mandatory
  • Field to be displayed: Name of the column that contains the values that will be finally displayed in our inventory object. Mandatory

To create an external type being the parent of another external item:

  • Primary key: Identifier or “primary key” field, it will usually correspond to the ID column. Only necessary if it is a parent table/field.

To create an external type being the child of another external item:

  • Foreign key: Field of the child table that relates both tables, it corresponds to the Foreign Key in the child table. Only necessary if it is a parent table/field.
  • Parent table name: Name of the parent table. Only necessary if it is a parent table/field.

With this configuration you may now use an external type field. When creating or modifying an inventory item of a type that contains external fields, a modal window will appear showing the information from the external table:

In addition, external fields can be related to each other, creating dependencies. Logically, for that, the two external tables to be used in our two external fields must also be related by one of their columns, which will usually be an ID. Usually, the parent table will have: an ID column that will be its “primary key”, and the child table will have an ID_relation column that will correspond to its foreign key, a column that will relate this child table to its parent table. This will make that depending on the value that you select in the first field, the second field shows different values.

You may see it in more detail in the following case study.

Case study

We have a manually added table, t_location , with two columns: id and location, the first is the unique identifier, the second the useful value that you want to show. To configure an external field that makes use of the information contained in this table, configure it as follows:

As it can be seen, you will first use the name of the t_location table, and secondly the column ubication that you want to display to use in your external type field, Ubication.

Once done, when creating an inventory item of the type that contains this external field, follow the following steps:

  • Inventory item creation: You see the external field as follows:

  • Choosing a value from the external table:

  • After selecting one of the locations shown in the pop up (Madrid), we will see it selected in the item.

  • Now we are going to create a second external field, which will be related to the Ubication field that you just used. To do this, follow similar steps, but completing the additional fields Primary key in the parent field (Ubication), and Foreign key and Parent table name in the child field (Location).
  • Presenting the elements to be used, first you have the external table, in this case called t_location, with three columns: id, location and id_ubication.
  • Now fill in the corresponding fields to relate this table to the previous one. In the parent field add the primary key:
  • And create the child field like this:

As seen in the screenshots, configure the Primary key fields in the parent table with its id column, and Foreign key and Parent table name with the foreign key column id_location of the child table, and the name of its parent table.

If you followed the steps as in the example, you will have created a dependency relationship, and depending on the value you choose in the first custom field, in the second you will have some possibilities or others.

In this example we chose “Madrid” in the Location field and Atocha will appear as the only eligible option as it is the only one that exists with id_location equal to 1:

These external tables are maintained manually by operating with them through SQL sentences, or by using the external table editor provided by Integria IMS.

Editing external tables

In the list of inventory item types, those that have external fields will have an icon for editing tables.

These tables can be used to edit and delete existing data, as well as adding new data.

Creating an inventory item

From the left side menu, click CMDBCreate new object . It will take you to the following form with all the available options to configure the inventory item.

The most important fields in this form are: Owner, Associated Companies, Associated Users, and Public . These fields define who sees the item. That way, the item will be accessible by the owner, the users directly associated with the item, or the users belonging to an associated company. Furthermore, if the Public flag is checked, everyone will be able to see the item.

An inventory item may have a “hierarchy” of items (an item may be a child of another). This is defined by choosing a “parent.” In addition to this parent/child relationship, relationships between items can be established.

Integria IMS inventory has a simple stock control system. To manage the stock, all inventory items have a “status” field that allows keeping a stock system. The possible statuses are: New, In use, Not used or Deregistered, in addition to those defined by the user in Pandora FMS inventory configuration menu. You may also record the date of receipt and withdrawal.

Let's look at an example inventory item:

The relationship tab shows the other items related to it. You may associate new items, you just have to choose it from the combo and link it as shown below. That way, other items can be related in addition to the parent item.

The contact tab shows the people associated with that inventory object. You may click on any of them to access their information directly.

The tab of tickets associated to the inventory item indicates which tickets affect that item and what their status is. You may click on any of them to access your information directly.

The tracking label shows the changes that take place in the inventory item such as ownership changes, if an item type is associated with a parent item.

Inventory searches

The inventory search result can be seen in two modes: tree or list.

The tree view shows the inventory items grouped by type. The stock is also displayed, showing:

  • Total units.
  • New.
  • Not used.
  • Minimum stock. If the number of total units is less than the minimum stock, it will be marked in red.

In the list view, information about the inventory is shown, as well as its custom fields that have been marked for display.

The fields through which you may search are:

  • Search (free text field): which refers to the name or description of the inventory if the token is active. This is the case if no custom fields are selected. In this case, the search also limits the value of these fields.
  • Search by description. Add to field Search the item description
  • Type of item. It is possible to select more than one type of item in the search using the selector
  • Owner.
  • Contract.
  • Manufacturer.
  • Status.
  • Associated user.
  • Associated company.
  • Parent item.

You may also export the search results in HTML and CSV to obtain listings to add to any type of report.

Import inventory data from CSV

There is the option to import inventory data from a CSV file. To do this, the file is loaded with a header and a line per inventory item.

The header must be in the first row of our CSV and must contain at least the name column since the name of the inventory item must exist.

Let's see the columns you may add:

  • name: As we have said, it is essential for it to appear in your CSV, since it is not possible to create inventory items without names, the setup option that allows duplicate inventory item names will also be taken into account.
  • owner: This column collects the identifiers of the users who own the item, which must exist in the database. If this column is not entered, the value entered by default will be empty.
  • id_parent: This column will contain the identifier of the parent inventory item, which must exist in the database. By default it is zero (0).
  • id_manufacturer: This column will contain the identifier of the companies each inventory item belongs to, therefore these companies must exist in the database. By default it is zero (0).
  • id_contract: This column will contain the identifier of the contract each inventory item belongs to. By default it is zero (0).
  • status: In this column you may collect the four types of status that Integria IMS defines by default (new, inuse, unused, issued) or a status defined by the user.
  • receipt_date: This column will contain the date of receipt and it must have a valid date format.
  • issue_date: This column will contain the use date and it must have a valid date format.
  • description: This is where the description of the inventory item will go. By default it will be empty.
  • public: It will only admit value 0 or 1 depending on whether you want it to be public or not. By default it is one (1).
  • id_company (Associated companies) Associated companies can be one or more, therefore enter the IDs as follows: [ id1 .id2 .id3 .id4 ]. It is important to use dots to separate elements.
  • associated_user (Associated users): Associated users can be one or more, therefore enter the IDs as follows: [ id1 . id2 .id3 . id4 ]. It is important to use dots to separate the elements.
  • id_object_type (Item Type): This column will contain the identifier of the types of items that must exist in the database. By default it is zero (0).
  • The rest of the columns that are added will correspond to the custom fields of a type of item, in them you may find four different types of fields that must respect the limitations of these fields:
    • Text fields : They have no limitation.
    • Numeric fields: They only allow numbers, therefore the column of this field must contain only numbers.
    • Combo fields: They allow a list of words, therefore the characters entered in this column can only be those that are collected in said list.
    • External fields : These fields allow associating external tables to enter the values, it will be validated that said table and its references exist.

All custom fields must also meet whether they are unique or not. This depends on whether you have selected custom field creation, so this will cause not being able to enter values that already exist in these custom fields.

Let's see an example to understand it better:

As we see in the image, the columns appear ordered but it is not necessary to keep a specific order, in this CSV we will enter two items, (test and test2) were we set all columns fixed up to public. You only need to enter the name, the rest depends on whether you want to fill it out or not. In the event that no columns appear, the default value will be entered, only in the case of wanting to also enter the custom fields of an item type, it will be necessary to enter the id_object_type column to find out what type of item these custom fields belong to.

In the image, columns (Field text) are custom fields, these fields belong to the item identifier 18 but it is not necessary to enter all the field columns, that is, if your item type has 8 custom fields and you only want to take into account two of them, only add the columns of those two. In case it is necessary to name them exactly the same as the name the field has because you custom field has that name. For example, this image is called Field text because this custom field has that name, if we enter “Fieldtext1”, since it is not the exact name of the custom field, it would cause an error.

Remote inventory based on Pandora FMS agents

This Enterprise feature allows you to retrieve custom inventory information from any device and operating system.

The remote inventory is based on the use of Pandora FMS software agents that are installed on the machines from which the information is to be retrieved. The agents collect inventory information through scripts and send it to the server where Integria IMS is running. Once the information is received, Integria will process it and create the according inventory items based on the data received.

Unlike Inventory Synchronization with Pandora FMS, to use remote Inventory based on Pandora FMS agents, it is not necessary to install Pandora FMS application, it is only necessary to install the agents on the machines you wish.

Inner workings of remote inventory

Pandora FMS agents send an XML file with the inventory information to the server that supports Integria IMS. Integria IMS processes these files using the maintenance script: files are processed every 5 minutes. These XMLs must be received in the /attachment/inventory directory located within Integria IMS directory.

With the inventory information sent in the XML, several inventory items will be created. So if an agent sends information about 12 applications installed on the system, 13 inventory items will be created (one for the agent and 12 for the different installed applications).

When information is received about a device or inventory item, two things can happen:

  1. The item exists: then the inventory information will be updated.
  2. The item does not exist: in this case, a new inventory item will be created only if the associated item type is defined in Integria.

It is important to define the types of items that you will use before you start doing the inventory, the following explains how data acquisition works in detail and you may see how types are associated with the different elements.

Pandora FMS agents are associated to the type called Pandora agents, so for the inventory to work, it must be defined. The other inventory items are associated with their types as explained below.

The following XML with the inventory information could be sent by a Pandora FMS agent.

<?xml version='1.0' encoding='UTF-8'?>
<agent_data description='' group='' os_name='linux' os_version='"CentOS release 6.4
(Final)"' interval='300' version='7.0NG' timestamp='2021/10/22 09:27:38'
agent_name='sample_linux_host' timezone_offset='0' address='192.168.70.163'>
 <inventory>
  <inventory_module>
    <name><![CDATA[Users]]></name>
    <datalist>
      <data><![CDATA[root]]></data>
    </datalist>
  </inventory_module>
  <inventory_module>
    <name><![CDATA[Process]]></name>
    <datalist>
      <data><![CDATA[COMMAND]]></data>
      <data><![CDATA[/sbin/init]]></data>
      <data><![CDATA[[kthreadd|]]]></data>
      <data><![CDATA[[migration/0|]]]></data>
      <data><![CDATA[[ksoftirqd/0|]]]></data>
      <data><![CDATA[[scsi_eh_6|]]]></data>
      <data><![CDATA[sh -c ps -eo command |  tr -d "" ]]></data>
      <data><![CDATA[ps -eo command]]></data>
      <data><![CDATA[tr -d ]]></data>
    </datalist>
  </inventory_module>
  <inventory_module>
    <name><![CDATA[Software]]></name>
    <datalist>
      <data><![CDATA[acl;2.2.49;Access control list utilities]]></data>
      <data><![CDATA[acpid;1.0.10;ACPI Event Daemon]]></data>
      <data><![CDATA[alsa-lib;1.0.22;The Advanced Linux Sound Architecture (ALSA)
      library]]></data>
      <data><![CDATA[alsa-plugins-pulseaudio;1.0.21;Alsa to PulseAudio backend]]>
      </data>
      <data><![CDATA[zenity;2.28.0;Display dialog boxes from shell scripts]]></data>
      <data><![CDATA[zip;3.0;A file compression and packaging utility compatible
      with PKZIP]]></data>
      <data><![CDATA[zlib;1.2.3;The zlib compression and decompression library]]>
      </data>
    </datalist>
  </inventory_module>
  <inventory_module>
    <name><![CDATA[File system]]></name>
    <datalist>
      <data><![CDATA[tmpfs;0;244M;/dev/shm]]></data>
      <data><![CDATA[/dev/sda1;34M;426M;/boot]]></data>
    </datalist>
  </inventory_module>
 </inventory>
 </agent_data>
Integria will create an item for the agent that reported the XML and then process the different inventory modules separately, for example:
  <inventory_module>
    <name><![CDATA[Software]]></name>
    <datalist>
      <data><![CDATA[acl;2.2.49;Access control list utilities]]></data>
      <data><![CDATA[acpid;1.0.10;ACPI Event Daemon]]></data>
      <data><![CDATA[alsa-lib;1.0.22;The Advanced Linux Sound Architecture (ALSA)
      library]]></data>
      <data><![CDATA[alsa-plugins-pulseaudio;1.0.21;Alsa to PulseAudio backend]]>
      </data>
      <data><![CDATA[zenity;2.28.0;Display dialog boxes from shell scripts]]></data>
      <data><![CDATA[zip;3.0;A file compression and packaging utility compatible
      with PKZIP]]></data>
      <data><![CDATA[zlib;1.2.3;The zlib compression and decompression library]]>
      </data>
    </datalist>
  </inventory_module>

The name of the inventory module defined in the XML will be chosen, in this case Software, to identify the type of item associated with these elements.

Afterwards, inventory items with this type will be created for each of the elements reported in the XML:

<datalist>
  <data><![CDATA[acl;2.2.49;Access control list utilities]]></data>
  <data><![CDATA[acpid;1.0.10;ACPI Event Daemon]]></data>
  <data><![CDATA[alsa-lib;1.0.22;The Advanced Linux Sound Architecture (ALSA)
  library]]></data>
  <data><![CDATA[alsa-plugins-pulseaudio;1.0.21;Alsa to PulseAudio backend]]>
  </data>
  <data><![CDATA[zenity;2.28.0;Display dialog boxes from shell scripts]]></data>
  <data><![CDATA[zip;3.0;A file compression and packaging utility compatible
  with PKZIP]]></data>
  <data><![CDATA[zlib;1.2.3;The zlib compression and decompression library]]>
  </data>
</datalist>

Inventory items separate information by character ;. The information would be broken down as you can see below:

<data><![CDATA[acl;2.2.49;Access control list utilities]]></data>

acl     2.2.49     Access control list utilities

The first component defines the name for the new inventory item. The rest of the components will be associated with the item type fields in the same order in which they appear in the inventory item definition. In this case, the second element is associated with Version and the third with Description.

In addition, all the items corresponding to the elements will have as their parent the agent that reported them through the XML. The final result for the inventory item created for that XML element will look like this image:

In the inventory, along with all the items that have been created based on the different XML inventory modules, an item will appear for the agent, in this case called localhost.localdomain

By default, Integria IMS has the main inventory modules predefined for Windows agents: Software, Patches, HD, Video, CPU, Services and RAM. Below we can see an example of how it should look.

Remote inventory setup

Automatic inventory configuration is found in the Setup menu on Pandora FMS Inventory tab. Within this section you will see a section called Remote Inventory.

The configurable fields are:

  • Default owner: Default owner of the new inventory item.
  • Associated company: Default companies for the new inventory item.
  • Associated user: Default users for the new inventory item.

The Default owner field is mandatory, if it is not configured, inventory items will not be created. The other fields are used for the purpose of configuring ACLs for accessing and displaying items.

In addition to the configuration of the aforementioned fields, it is necessary to enable the maintenance script. You may see how to install this script in the “Maintenance script installation” section.

If you do not enable the maintenance script, the files sent by Pandora FMS agents will not be processed.

Files are sent through a TCP connection to port 41121. For this reason, for this feature to work properly, you may have to review the routing rules or firewalls of your network.

Pandora FMS agent configuration

To retrieve information from devices, install Pandora FMS agents. You may see the compatibility of Pandora FMS agents with your systems in section “Software agent requirements of Pandora FMS manual”.

There are Pandora FMS software agent versions available for multiple platforms and each one has its installation process, all information about installation processes is available in section “Installation of Pandora FMS agents of Pandora FMS manual”.

The additional parameters to configure in the agent are the following:

  • server_ip: IP address of the server running Integria IMS.
  • server_path: Directory to receive files from the server.
  • module_plugin: Policy to run scripts to retrieve the inventory information.

All the information on the configuration of the software agent is in section “Pandora FMS software agents” within Pandora FMS manual.

By default, Pandora FMS agents have a plugin module to retrieve inventory information, you may execute it with the following directive:

module_plugin inventory 1 cpu ram video nic hd cdrom software
init_services filesystem users process ip route

Inventory customization

If you wish to customize the information collected you may modify this script or create your own.

In “Creating local inventory modules” section of Pandora FMS manual you may see the XML structure of the inventory modules and examples of how to create inventory modules for GNU/Linux® and MS Windows® platforms.

Go back to Integria IMS Documentation Index