Skip to main content

GLPI - Connecting an External GLPI

Applies to: Medulla / GLPI
Medulla version: All
GLPI version: 10.0.x
Environment: On-Premise
Category: GLPI Integration

Background

This procedure allows you to automatically configure the connection between Medulla and GLPI using the 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 set up in your GLPI environment.


1. Prepare your GLPI environment

Before configuring Medulla with GLPI, follow the dedicated FAQ:

GLPI and Medulla – Creating User Accounts

This FAQ covers the following topics:

  • Creating a MySQL/MariaDB user dedicated to Medulla
  • Opening network connections 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

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

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 options:

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 GLPI main 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 URL for transferring inventory data
--inv-plugin No Inventory plugin: glpiinventory or fusioninventory
--inv-agent No Client-side inventory agent for workstations: glpiagent or fusioninventory
--inv-agent-disabled No Disables integration of the inventory agent with the Medulla agent

Note:
The script automatically retrieves the app_token and user_token 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. Example of use

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 password \
--api-url https://glpi.mon-domaine.fr/apirest.php/ \
--api-user medulla_api \
--api-pass password \
--crypt-key $(base64 -w 0 /etc/glpi/glpicrypt.key)

6. Recommended Checks

Before running the script, verify:

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

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


Default Values

Item Value
GLPI SQL Port 3306
Recommended Client API MMC
GLPI API /apirest.php/
Read-only mode false
Inventory Transfer true
Inventory plugin glpiinventory
Inventory Agent glpiagent
Supported GLPI version 10.0.x