> For the complete documentation index, see [llms.txt](https://documentation.ocsinventory-ng.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.ocsinventory-ng.org/user-docs/asset-management/inventory-and-templates.md).

# Inventory and Templates

Assets' inventories in OCS are composed of two main elements: the **base inventory** and the **template inventory**.

## Base inventory

The **base inventory** provides a default set of core information about an asset. This inventory is always available and includes the following fields:

* Name
* Description
* Serial Number
* OS Name
* OS Version
* UUID
* IP Address
* Mac Address
* Domain
* Agent Version

## Template inventory

To extend the **base inventory**, OCS uses a **template system**. These templates add extra fields and define what method should be used to retrieve the corresponding data.

### **Preloaded Templates**

By default, OCS includes six preloaded templates, visible at **Configurations** **→** **Inventory** **→** **Templates**:

* **Legacy** (for compatibility with legacy agents, version 2.X)
* **Linux (Debian based)**
* **Linux (RHEL based)**
* **MacOS**
* **Windows**
* **Generic SNMP**

<figure><img src="https://461838061-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtjrEC8kt8LJiJYFBs5CS%2Fuploads%2FZTMThDNOloiEgL00rBSL%2FCapture%20d%E2%80%99%C3%A9cran%20du%202026-04-27%2014-13-18.png?alt=media&amp;token=48e55968-8ac2-4ef6-aa57-ad722e731140" alt="Template fields and their retrieval methods for Linux"><figcaption><p>Template fields and their retrieval methods for Linux</p></figcaption></figure>

{% tabs %}
{% tab title="Example: Retrieving the Serial Number field" %}
Let's check how the SSN value is retrieved within the Linux (Debian based) template.

Here’s where to find this in the console:

{% stepper %}
{% step %}
Navigate to **Configurations → Templates**.
{% endstep %}

{% step %}
Click the **pen icon** in the **Action** column for the Linux (Debian based) template.
{% endstep %}

{% step %}
On the template details page, click the **Bios** section to expand it.

The top table identifies the inventory section and what command should be used to retrieve data, among other options.&#x20;

For this template, the command (**Target** field) is `dmidecode`.&#x20;

The **Retrieval method** field tells us how this command needs to be executed : as a **Bash command** in this instance.&#x20;

The **Retrieval output** tells the agent how the output of this command should be processed to get the relevant data: **Regex processing**.
{% endstep %}

{% step %}
Locate the **SERIAL** **NUMBER** field.&#x20;

The table below lists all the fields for this section.

The **Retrieval value** field contains the key or regex that will be used to retrieve the serial number value from the output of `dmidecode`.
{% endstep %}
{% endstepper %}
{% endtab %}
{% endtabs %}

## Template assignment

### Using Rules (automatic)

Templates are assigned to assets based on their operating systems. OCS uses the **Rule Engine** to determine and apply the correct template when an asset inventories itself for the first time.

Out of the box, OCS provides six predefined rules, evaluated against the **OS Name** or **Agent** field of the base inventory and used to assign Templates automatically:

{% columns %}
{% column width="33.33333333333333%" %}

<p align="center"><strong>Field evaluated</strong></p>

<p align="center">OS Name</p>

<p align="center">OS Name</p>

<p align="center">OS Name</p>

<p align="center">OS Name</p>

<p align="center">Agent</p>

<p align="center">OS Name</p>
{% endcolumn %}

{% column width="41.66666666666667%" %}

<p align="center"><strong>Value(s) expected</strong></p>

<p align="center">Windows</p>

<p align="center">Ubuntu, Debian</p>

<p align="center">Redhat, Centos, Alma, Rocky</p>

<p align="center">Mac</p>

<p align="center">OCS-NG</p>

<p align="center">SNMP</p>
{% endcolumn %}

{% column width="24.999999999999986%" %}

<p align="center"><strong>Template</strong></p>

<p align="center">Windows</p>

<p align="center">Debian based</p>

<p align="center">RHEL based</p>

<p align="center">macOS</p>

<p align="center">Legacy</p>

<p align="center">Generic SNMP</p>
{% endcolumn %}
{% endcolumns %}

{% hint style="info" %}

#### **Notes on automatic assignment:**

* Rules are evaluated with each incoming inventory.
* If no rule matches, the asset will only report using the base inventory.
* Template assignment can also be switched to manual selection per device. More details are available on the [Managing Rules](/administrator-docs/server-setup/configuration/advanced/managing-rules.md) page.
  {% endhint %}

### **Manual Template assignment**

In addition to automatic assignment, templates can also be manually assigned to assets from the asset’s detail page.

#### **Steps to manually assign a Template:**

{% stepper %}
{% step %}
Navigate to the asset's detail page.
{% endstep %}

{% step %}
On the right side, click the **Options** icon.
{% endstep %}

{% step %}
Select **Assign inventory template** from the drop-down.
{% endstep %}

{% step %}
Choose the desired template for the asset from the list.
{% endstep %}
{% endstepper %}

{% hint style="info" %}

### A manually assigned template will never be overridden by Rules.

To switch back to automatic assignment:

1. Open the asset’s detail page.
2. Click the **Options** icon at the top right.
3. In the drop-down menu, select **Reset inventory template**.

The template will be reset, and a new one will be automatically assigned during the next inventory if a Rule matches.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://documentation.ocsinventory-ng.org/user-docs/asset-management/inventory-and-templates.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
