Skip to main content

GLPI - Connect an external GLPI

Applies to: Medulla / GLPI
Medulla version: All
GLPI version: 10 / 11
Environment: On-Premise
Category: GLPI integration

This FAQ has been superseded.
See the updated documentation to connect, verify, and repair an external GLPI with Medulla.

Background

This procedure allows you to automatically configure the connection between Medulla and GLPI using the following script:

change_itsm_parameters.py

This script automatically configures the connection settings between Medulla, the GLPI database, and the REST API.

Important:
Before running the script, several prerequisites must be met in your GLPI environment.


1. Prepare your GLPI environment

Before configuring Medulla with GLPI, follow the dedicated FAQ:

GLPI access for Medulla

This FAQ covers the following topics:

  • Creating a MySQL/MariaDB user dedicated to Medulla
  • Opening network flows between Medulla and GLPI
  • Creating the GLPI API user
  • Choosing the Read-Only or Super-Admin profile
  • Creating the MMC API client
  • Generating the user_token and app_token tokens

Important:
All prerequisites described in this FAQ must be completed before running the ITSM configuration script.


2. Download the configuration script

Download the script:

change_itsm_parameters.py

Or directly via the command line:

wget https://dl.medulla-tech.io/ma/change_itsm_parameters.py

Then make the script executable:

chmod +x change_itsm_parameters.py

3. View the script’s help

To view the available parameters:

./change_itsm_parameters.py --help

The script supports the following parameters:

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]

4. Parameter descriptions

Parameter Required Description
--url Yes Main GLPI URL
--db-host Yes GLPI MySQL/MariaDB server address
--db-port No SQL port (default: 3306)
--db-name Yes GLPI database name
--db-user Yes MySQL/MariaDB user dedicated to Medulla
--db-pass Yes SQL password
--api-url Yes GLPI API URL (/apirest.php/)
--api-user Conditional GLPI API user (required if --readonly=false)
--api-pass Conditional API user password
--readonly No Read-only mode – Medulla will not be able to write to GLPI (default: false)
--crypt-key Conditional Base64-encoded GLPI key – contents of /etc/glpi/glpicrypt.key
--inv-forward No Enables inventory transfer to GLPI (default: true)
--inv-forward-url Conditional Inventory transfer URL
--inv-plugin No Inventory plugin: glpiinventory or fusioninventory
--inv-agent No Workstation-side inventory agent: glpiagent or fusioninventory
--inv-agent-disabled No Disables integration of the inventory agent into the Medulla agent

Note:
The script automatically retrieves the app_token and user_token tokens directly from the GLPI database.

Therefore, it is not necessary to provide these tokens as parameters.

If your version of GLPI encrypts the tokens, you will need to provide:

--crypt-key

5. Usage example

Example of a complete configuration for an external GLPI server:

./change_itsm_parameters.py \
--url https://glpi.mon-domaine.fr/ \
--db-host 10.10.0.101 \
--db-port 3306 \
--db-name GLPI \
--db-user medulla_glpi \
--db-pass yJxI40UzO8Jn7dd7K5Yaml \
--api-url https://glpi.mon-domaine.fr/apirest.php/ \
--api-user medulla_APIUSER \
--api-pass fLN1Zomh877obPhk

Case of a GLPI with encrypted tokens

If your GLPI server contains the file:

/etc/glpi/glpicrypt.key

add the following parameter:

--crypt-key $(base64 -w 0 /etc/glpi/glpicrypt.key)

Example:

./change_itsm_parameters.py \
--url https://glpi.mon-domaine.fr/ \
--db-host 10.10.0.101 \
--db-name GLPI \
--db-user medulla_glpi \
--db-pass motdepasse \
--api-url https://glpi.mon-domaine.fr/apirest.php/ \
--api-user medulla_api \
--api-pass motdepasse \
--crypt-key $(base64 -w 0 /etc/glpi/glpicrypt.key)

6. Verify the GLPI connection and permissions

Once the configuration is complete, it is recommended that you verify that Medulla can communicate properly with GLPI and that the necessary permissions are in place.

A diagnostic script is available to automatically test the main components of the integration:

check_itsm_access.sh

The script directly uses the GLPI configuration stored on the Medulla server.
Therefore, there is no need to re-enter SQL credentials or GLPI authentication information.

Download the script

wget https://dl.medulla-tech.io/nc/check_itsm_access.sh

Then make the script executable:

chmod +x check_itsm_access.sh

Run the diagnostic

./check_itsm_access.sh

The script checks, in particular:

  • the connection to the GLPI MySQL/MariaDB database;
  • access to the GLPI tables required by Medulla;
  • the presence and accessibility of the SQL views used by Medulla;
  • the necessary SQL permissions;
  • accessibility of the GLPI API;
  • authentication using GLPI credentials;
  • authentication using the user_token and app_token.

When all checks pass, the script returns:

==========================================
All checks passed!
==========================================

If one or more checks fail, the script lists the affected checks to facilitate troubleshooting.

==========================================
Some checks failed!
==========================================

In case of an error:
Correct the reported issues and then rerun the script. If the problem persists, send the complete script output to Medulla support, ensuring that no passwords, tokens, or other authentication secrets are included.

The complete diagnostic procedure and interpretation of the various results are available in the following FAQ:

Verify access and permissions between Medulla and GLPI


7. Recommended checks

Before and after running the configuration script, verify:

  • SQL connectivity to GLPI
  • Accessibility of the GLPI REST API
  • The permissions of the Medulla SQL account
  • GLPI API user permissions

Caution:
A network error or authentication issue will prevent Medulla from successfully completing its ITSM configuration.


8. Default values

Item Value
GLPI SQL port 3306
Recommended API client MMC
GLPI API /apirest.php/
Read-only mode false
Inventory transfer true
Inventory plugin glpiinventory
Inventory agent glpiagent
Supported GLPI version 10 / 11

Additional documentation

Setting up GLPI access for Medulla:

GLPI access for Medulla

Diagnosing the Medulla/GLPI connection:

Verify access and permissions between Medulla and GLPI

Diagnostic script:

https://dl.medulla-tech.io/nc/check_itsm_access.sh

New to Medulla? Try Medulla or learn about our SaaS offering hosted in France.