# GLPI - Connect an external GLPI

<p class="callout info">**Applies to**: Medulla/GLPI  
**Medulla version**: all  
**GLPI version**: 10.0.x  
**Environment**: On-Premise  
**Category**: Medulla</p>

#### Prerequisites

Before configuring the integration between Medulla and GLPI, ensure that the following items are available and properly configured.

Download the script here: [https://dl.medulla-tech.io/ma/change\_itsm\_parameters.py](https://dl.medulla-tech.io/ma/change_itsm_parameters.py)

##### 1. GLPI database access

<span style="color:rgb(45,194,107);">Create a dedicated MySQL/MariaDB user for Medulla with the following permissions:</span>

\- Read-only (`READ ONLY`) or read/write as needed  
\- Access to the entire GLPI database

##### 2. Network connectivity

Allow communication between the Medulla server and the GLPI database server:

<span style="color:rgb(185,106,217);">- Port `3306` open (or a custom port depending on your configuration)</span>

##### 3. Creating a GLPI API user

Create a GLPI user dedicated to API calls with a name of your choice:

<p class="callout info">In GLPI under `Administration &gt; Users`</p>

<span style="color:rgb(230,126,35);">- Type: standard user (username / password)</span>  
\- Recommended profile:  
\- `Read-Only` or `Super-Admin`  
\- Assignment:  
\- Root entity  
\- Recursive mode enabled

Then generate a user API token (`user\_token`)

##### 4. Creating a GLPI API client

Create an API client named `MMC`.

<p class="callout info">In GLPI, go to `Configuration &gt; General &gt; API`</p>

Then generate the application token (`app\_token`)

##### 5. Import SQL views into your GLPI database

In your GLPI database, you must import the file downloaded here:

[https://dl.medulla-tech.io/nc/glpi-100.sql](https://dl.medulla-tech.io/nc/glpi-100.sql)

\---

#### Using the script

##### Help command

> ./change\_itsm\_parameters.py --help
> 
> usage: change\_itsm\_parameters.py \[-h\] --url URL --db-host DB\_HOST \[--db-port DB\_PORT\] --db-name DB\_NAME --db-user DB\_USER --db-pass DB\_PASS --api-url API\_URL \[--api-user API\_USER\] \[--api-pass API\_PASS\] \[--readonly READONLY\] \[--crypt-key CRYPT\_KEY\] \[--inv-forward INV\_FORWARD\] \[--inv-forward-url INV\_FORWARD\_URL\] \[--inv-plugin INV\_PLUGIN\] \[--inv-agent INV\_AGENT\] \[--inv-agent-disabled INV\_AGENT\_DISABLED\]
> 
> Update ITSM parameters
> 
> options:  
>  -h, --help display this help message and exit  
> \--url URL ITSM provider URL  
> \--db-host DB\_HOST ITSM provider database host  
> \--db-port DB\_PORT ITSM provider database port  
> \--db-name DB\_NAME ITSM provider database name  
> \--db-user DB\_USER ITSM provider database user  
> \--db-pass DB\_PASS ITSM provider database password  
> \--api-url API\_URL ITSM provider API URL  
> \--api-user API\_USER ITSM provider API user  
> \--api-pass API\_PASS ITSM provider API password  
> \--readonly READONLY Whether the ITSM provider database is read-only for Medulla (optional)  
> \--crypt-key CRYPT\_KEY  
>  Decoded GLPI crypt key file - base64 /etc/glpi/glpicrypt.key (optional)  
> \--inv-forward INV\_FORWARD  
>  Whether to forward inventory data to the ITSM provider (optional)  
> \--inv-forward-url INV\_FORWARD\_URL  
>  URL to forward inventory data to (optional)  
> \--inv-plugin INV\_PLUGIN  
>  Inventory plugin to use - glpiinventory or fusioninventory (optional)  
> \--inv-agent INV\_AGENT  
>  Inventory agent to use on the client machine - glpiagent or fusioninventory (optional, required if --inv-forward is true)  
> \--inv-agent-disabled INV\_AGENT\_DISABLED  
>  Whether to include the inventory agent in the Medulla agent (optional)

##### Usage examples:

> ./change\_itsm\_parameters.py \\  
> \--url https://glpi.mon-domaine.fr/ \\  
> \--db-host 10.10.0.101 \\  
>  <span style="color:rgb(185,106,217);">--db-port 3306 \\</span>  
> \--db-name GLPI \\  
> <span style="color:rgb(45,194,107);"> --db-user medulla\_glpi \\</span>  
> <span style="color:rgb(45,194,107);"> --db-pass yJxI40UzO8Jn7dd7K5Yaml \\</span>  
> \--api-url https://glpi.mon-domaine.fr/apirest.php/ \\  
> <span style="color:rgb(230,126,35);"> --api-user medulla\_APIUSER \\</span>  
> <span style="color:rgb(230,126,35);"> --api-pass fLN1Zomh877obPhk \\</span>