# Printers / Network Inventory

GLPI allows you to automatically inventory your switches, printers, routers, etc... This part requires the installation of the GLPI Inventory plugin available in the marketplace and a GLPI agent installed in the park.

## How it works

Inventory takes place in 2 stages:

* network discovery, which scans the network for detected devices.
* An SNMP inventory, to provide the SNMP information authorized by the manufacturer (serial number, OS, etc.) for each type of equipment.

These 2 actions will be managed by tasks. The principle for network hardware and printers is the same. In this example, a printer will be remounted to demonstrate the principle.

## Prerequisites

* GLPI Inventory installed and up to date (from marketplace),
* a GLPI agent installed in the park (also up to date with the necessary modules installed),
* Inventory enabled (administration > inventory enable)
* network hardware or printer capable of accepting SNMP requests (preferably V3, but V1 and V2 are also accepted).

## Sequence

***

### SNMP identifiers

Make sure you have correctly configured your SNMP identifiers on the machine side. Refer to the official hardware documentation if necessary.

* Go to **`administration`** > **`inventory`** > **`SNMP credentials`**

!!! info In **SNMP V3**, identifiers must be configured. In **V2c and V1**, only the name of the **community** is required. We recommend that you upgrade to V3 as far as possible to ensure maximum security for exchanges between GLPI and your agents.

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-ad702ca2d217254b80759590aa43a2227a4c1bf0%2Fsnmp-1.png?alt=media)

Then click on **`add`**

* Enter the name you prefer
* Select the SNMP version you want (here V3)
* Next, specify the identifiers and encryption methods for authentication and data:

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-b3803f37d316c24f985773ef2fd3cf128be1f300%2Fsnmp-3.png?alt=media)

* Clock on **`Save`**

***

### Equipment import and link rules

By default, rules are created to ensure that detected equipment is created if it does not exist, or merged if it is already in the park. You'll find these rules in **`administration`** > **`Rules`** > **`Equipment import and link rules`**. You can modify these rules to match the elements you need (serial number, machine name, etc.).

***

#### Business rules for equipment

This part is optional. As each instance is different, this step is specific to your needs and must be adapted. Here, the simplest case will be explained. Here we're going to define that everything in the `192.168.1.1 /24` network is brought up in the inventory (provided that the SNMP configuration has been applied to the equipment brought up).

We will therefore create the following rule:

* **`criterion`**: If my IP address contains 192.168.1
* **`action`**: Assign to the entity Paris Office
* Go to **`administration`** > **`Rules`**
* Click on **`Rules on the computer entity`** (this menu also takes into account the rules for other hardware)

<div align="left"><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-17abb15dc6a22acabb665f7e25f5663fe11f4d8f%2Fsnmp-4.png?alt=media" alt="Alt text"></div>

* Then create your rule(s) :

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-92ac3826b9cf056daef19762454f90ce3fc75f34%2Fsnmp-5.png?alt=media)

***

### IP range

In order to perform the network scan, GLPI needs to know which IP range(s) it should scan.

* Go to **`administration`** > **`GLPI Inventory`** > **`Networking`** > **`IP ranges`**.

<div align="left"><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-0bc55080456f6398787ef390dcf727a66b2d644f%2Fsnmp-6.png?alt=media" alt="Alt text"></div>

* Click on **`add`**
* Add your IP range(s) :

<div align="left"><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-d6d8705130796e6e09dda7f3da0436dd0f81ea15%2Fsnmp-7.png?alt=media" alt="Alt text"></div>

* In Associated SNMP identifiers, add the identifiers created earlier.

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-1db40aa3f1d2b540907aeae6885a0f6e73026974%2Fsnmp-8.png?alt=media)

{% hint style="success" %}
**To know**

This step is important, if you don't associate the SNMP identifiers, your network discovery won't succeed correctly
{% endhint %}

* Remember to save your changes

***

### Agent authorization

A GLPI agent will be dedicated to managing tasks. Once the tasks have been created, the agent will check, during its next inventory, that one or more tasks are available. It is therefore necessary to activate the modules it will need to carry out its tasks correctly.

* In **`administration`** > **`GLPI Inventory`** > **`General`** > **`Agent Management`**, select the agent that will be dedicated to performing the tasks.
* In the agent's modules tab, select **`network discovery`** and **`network inventory (SNMP)`**
* Click **`update`**.

<div align="left"><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-4c6362d2bd9909927456ca10b0d3eab5c8b31afd%2Fsnmp-9.png?alt=media" alt="Alt text"></div>

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-6cc2459867bc0f6d800cd9ab507f32c0ae62724b%2Fsnmp-10.png?alt=media)

***

### Creating tasks

***

#### Network discovery

As explained above, you first need to discover the network in order to locate the equipment in your fleet.

* In **`administration`** > **`GLPI Inventory`** > **`Tasks`** > **`Task management`** create a new task:

<div align="left"><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-55328541979d714319ec25d9f2518cc1817580a8%2Fsnmp-11.png?alt=media" alt="Alt text"></div>

* Name this task then click on **`add`** (you can also choose the option **`Allows the task to be re-prepared after it has been run`** so that it can be reloaded and ready for the next run). If required, you can also add scheduled start options or slots in which these tasks can be launched.

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-2b302fd3bce66005ba88ccf07c054d4f376d32f3%2Fsnmp-12.png?alt=media)

{% hint style="warning" %}
**Attention point**

Make sure you tick the **`Active`** box so that your task can be executed
{% endhint %}

* In job configuration, enter a name
* Select **`Network discovery`** from the drop-down list.

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-6873b01957316eb8c4cc093eb8cd2e6d27f2364f%2Fsnmp-13.png?alt=media)

When you click on add, a new insert will appear. The last configuration step is job.

* Click on next to **`target`**
* Add the IP range created earlier.
* Do the same with actors, and select the agent configured for network discovery above.

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-bcad6878603c5cbbf1d81ec0c8f191c097c6abb9%2Fsnmp-14.png?alt=media)

* Once this information has been entered, you can force the task to be prepared using the option in **`task management`**.

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-1d68c9a71dac7cba67e38b95ff71c56db372f7c6%2Fsnmp-15.png?alt=media)

!!! Warning "Caution" This option prepares the task but does not execute it. The designated agent will execute the task the next time it is inventoried.

You will notice that it is in **`prepared`** status in **`job execution`**.

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-dc41d095d86b280d17d1391395eda115407c26a2%2Fsnmp-16.png?alt=media)

***

#### SNMP inventory

The SNMP inventory will allow you to retrieve information such as cartridges, counters and other information authorised by the hardware manufacturer.

* Go back to **`task management`**
* Add a new task
* Proceed in the same way as before and **remember to activate the task**.

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-fd187c6036fb985cf9a7b15df5fb3fcf32292a45%2Fsnmp-17.png?alt=media)

In **`job configuration`** enter a name and this time select **`network inventory (SNMP)`**.

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-b1857ee414b066f46fc0251ff5d33e098b4eee67%2Fsnmp-18.png?alt=media)

* By clicking on add, do as before and add a **target** (IP address) and a **actor** (the agent dedicated to the SNMP inventory).

You can again force the start but GLPI will tell you that no target is detected, which is normal because the discovery has not yet been executed.

***

### Task execution

The agent is now waiting to be launched so that it can carry out the tasks we have assigned to it. There are several ways to launch the agent:

* Via the web interface where the agent is located, by logging on **`http://localhost:62354/`** and clicking on **`force an inventory`**.
* By restarting the scheduled task or the glpi-agent service.
* If you have installed [agent monitoring](https://github.com/glpi-project/glpi-agentmonitor/releases), click on **`force an inventory`**.

The job changes to **`in progress`**.

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-5850bcd10575dab33c5d4c85059cbea38d17a3c9%2Fsnmp-19.png?alt=media)

Then to **`successful`**

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-307cb6dbcb815c3d2ccbcc8121be2e71237dc6cf%2Fsnmp-20.png?alt=media)

Now that the 2 tasks have been executed, you can return to printer (for our example) and see that our hardware has been implemented in the printer tab, in the entity corresponding to our rule:

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-6324a49e7bd8218e83ee3101dcfc0b7121fa2f67%2Fsnmp-21.png?alt=media)

if your printer supports it, you can also see the status of the cartridges and the page counter

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-901d32f362b3b445d1e3d62158fd44f6fa2998e6%2Fsnmp-22.png?alt=media)

![Alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-6b122c85c06791463b1df563fbd47865e5b3eaa0%2Fsnmp-23.png?alt=media)


---

# Agent Instructions: 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:

```
GET https://help.glpi-project.org/tutorials/inventory/snmp_inventory.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
