Skip to main content

Diagnose the central server and Medulla relays

Applies to: Medulla Server and Relay
Tool version: V1.7
Environment: On-Premise / Debian / Distributed architecture
Category: Diagnostics / Infrastructure / Relay / XMPP / Syncthing
Last update: November 26, 2026

1. Overview

The medulla_diag_relais_V1.7.py script allows you to perform a comprehensive diagnostic of the Medulla infrastructure from the central server.

It automatically analyzes the platform’s architecture, configuration files, databases, services, network communications, and synchronization mechanisms between the various servers.

In particular, it helps identify the following issues:

  • Relays that are unavailable or partially functional.
  • Communication issues between the central server and the relays.
  • Closed or filtered network ports.
  • Inconsistencies in configuration files.
  • DNS resolution issues or problems with the /etc/hosts file configuration.
  • Malfunctions in the ejabberd cluster and the Mnesia database.
  • XMPP federation issues between servers.
  • Syncthing synchronization issues.
  • Accumulation of XMPP configuration accounts.
  • Inconsistencies between the relays declared in the database and the actual architecture.
  • Workstations associated with nonexistent relays.
  • MariaDB configuration issues.
  • Version differences between the central server and the relays.
  • Medulla services not restarted after an update.
  • Issues with certificates, disk space, or time synchronization.

Non-intrusive diagnostics: The script runs in read-only mode. It does not modify configurations, databases, or services on the central server or relays. Corrections are suggested only in the diagnostic summary.

2. Supported architectures

The script automatically detects the various servers that make up the Medulla infrastructure and identifies the type of each relay.

Component Description
Central server Main server hosting Medulla’s central services, XMPP substitutes, the administration console, and—depending on the architecture—the databases.
Classic relay A relay with its own XMPP domain that communicates with the central server via server-to-server (s2s) federation.
DMZ relay A relay belonging to the central server’s XMPP domain, integrated into the ejabberd cluster, and hosting, in particular, the assessor substitute in a standard DMZ architecture.
Remote database server A MariaDB server separate from the central server, identified based on the actual configurations of the Medulla components.

2.1. Classic relay

A classic relay typically has its own XMPP domain. Communications with the central server rely on server-to-server XMPP federation.

The script checks, in particular:

  • Resolution of the relay’s XMPP domain from the central server.
  • Resolution of the pulse name to the central server from the relay.
  • Whether the relay agent’s XMPP session exists on its own ejabberd server.
  • S2S XMPP communications.
  • The absence of an active assessor substitute on the classic relay.
  • The network flows required for Medulla to function.
  • File and package synchronization.

2.2. DMZ relay

In a standard DMZ architecture, the relay shares the central server’s XMPP domain and belongs to the same ejabberd cluster.

The assessor substitute is offloaded to the DMZ relay to allow agents to be configured from external networks.

The script checks, in particular:

  • Whether the relay belongs to the ejabberd cluster.
  • That the state of the Mnesia cluster is consistent between the two servers.
  • The availability of the Erlang communication ports.
  • Whether the ejabberd node names resolve correctly.
  • Whether the assessor substitute is present on the DMZ relay.
  • The absence of a concurrent assessor on the central server.
  • Access permissions to the central MariaDB database.
  • Syncthing synchronization.

Relay classification is based on the XMPP domain of the JID, the domains declared in ejabberd, and actual membership in the cluster. It is not based solely on the relay’s name.

3. Prerequisites

  • Have SSH access to the central Medulla server.
  • Have root or sudo privileges on the central server.
  • Have Python 3 installed.
  • Have wget installed to download the script.
  • Have the standard system tools and components of a Medulla installation.
  • For a complete diagnosis, have SSH access from the central server to the relays.
  • Have an authorized SSH key on the relays.

The script uses standard Python libraries as well as the system tools available on the Medulla platform.

It does not require the prior installation of an additional diagnostic agent on the relays.

If SSH access to a relay is unavailable, the script can perform checks from the central server, but will not be able to fully analyze the relay’s configurations, services, and outbound communications.

4. Downloading and installing the script

4.1. Download the script

The script is available from the Medulla download server.

Download medulla_diag_relais_V1.7.py

Connect via SSH to the central Medulla server, then run the following commands:

sudo -s
cd /root
wget -O medulla_diag_relais_V1.7.py https://dl.medulla-tech.io/ma/medulla_diag_relais_V1.7.py
chmod +x medulla_diag_relais_V1.7.py

Using the -O option preserves the expected filename, even if a copy of this version already exists in the directory.

4.2. Verify the downloaded file

Verify that the file is present:

sudo -s
ls -lh /root/medulla_diag_relais_V1.7.py

Check the Python syntax:

sudo -s
python3 -m py_compile /root/medulla_diag_relais_V1.7.py

If no errors are displayed, the syntax check was successful.

4.3. Display help

sudo -s python3 /root/medulla_diag_relais_V1.7.py --help

4.4. First run

sudo -s python3 /root/medulla_diag_relais_V1.7.py

The script must be downloaded and run on the Medulla central server. It is not necessary to download or install it individually on each relay.

5. Using the script

5.1. Comprehensive infrastructure diagnosis

sudo -s python3 /root/medulla_diag_relais_V1.7.py

The script automatically detects the architecture and known relays, then performs the available checks.

The diagnostic covers:

  1. The platform’s overall architecture.
  2. The central server.
  3. The relays declared in the Medulla database.
  4. Any ejabberd nodes not declared as relays.
  5. Network communications.
  6. Remote configurations accessible via SSH.
  7. Synchronization mechanisms.
  8. Inconsistencies between the various components.

5.2. Diagnose a specific relay

To limit the diagnosis of relays to a specific IP address:

sudo -s python3 /root/medulla_diag_relais_V1.7.py --relais 192.168.1.10

Replace the IP address with that of the relay in question.

5.3. Diagnostics without an SSH connection to the relays

sudo -s python3 /root/medulla_diag_relais_V1.7.py --sans-ssh

This mode allows you to perform an initial diagnosis when remote SSH access is unavailable or not permitted.

Central server checks and network tests performed from the central server remain available.

5.4. Save the report to a text file

sudo -s python3 /root/medulla_diag_relais_V1.7.py --sortie /root/diagnostic-relais.txt

5.5. Save the report in JSON format

sudo -s python3 /root/medulla_diag_relais_V1.7.py --json /root/diagnostic-relais.json

The JSON format allows you to use the results in an external analysis tool or in an automated process.

5.6. Generate both report formats

sudo -s python3 /root/medulla_diag_relais_V1.7.py --sortie /root/diagnostic-relais.txt --json /root/diagnostic-relais.json

Recommended command: Use this command when a comprehensive diagnostic needs to be performed and sent to Medulla support.

5.7. Run the diagnostic in a persistent session

For an infrastructure with multiple relays, it is recommended to use a screen session, if this tool is installed.

sudo -s
cd /root
screen -S medulla-relais
python3 medulla_diag_relais_V1.7.py --sortie diagnostic-relais.txt --json diagnostic-relais.json

To temporarily exit the session without interrupting the diagnostic, press Ctrl+A, then D.

To resume the session:

sudo -s screen -r medulla-relais

6. Available options

Option Description
--help Displays help and available parameters.
--relais ADRESSE Limits relay diagnostics to the specified relay.
--sans-ssh Disables remote collection via SSH.
--avec-syncthing-depl Also analyzes the syncthing-depl instance, which is ignored by default starting with version 1.7.
--ssh-user UTILISATEUR Allows you to specify the SSH user.
--ssh-cle CHEMIN Allows you to specify a specific SSH private key.
--ssh-strict Enables strict verification of SSH host keys.
--sortie FICHIER Saves the report in text format.
--json FICHIER Saves the report in JSON format.

The legacy option --ssh-accepter-cle is retained for compatibility. As of version 1.3, it is no longer required for the default SSH behavior.

7. How SSH connections work

Since version 1.3, the script uses the same connection method as Medulla’s Ansible installation procedures.

By default, it uses the central server’s SSH key:

/root/.ssh/id_rsa

It attempts a connection with the root user, then with the medulla user, and performs a non-interactive privilege escalation via sudo -n.

Data collection commands are sent directly to the relay via SSH. No permanent diagnostic script is installed on the relay.

7.1. Use a different SSH key

sudo -s python3 /root/medulla_diag_relais_V1.7.py --ssh-cle /root/.ssh/id_ed25519

7.2. Specify an SSH user

sudo -s python3 /root/medulla_diag_relais_V1.7.py --ssh-user medulla

7.3. Strictly verify host keys

sudo -s python3 /root/medulla_diag_relais_V1.7.py --ssh-strict

By default, the script accepts SSH host keys without saving them to the known_hosts file.

SSH security: For a production environment, it is recommended to verify the identity of the relays beforehand, register their host keys using a secure procedure, and use the --ssh-strict option.

8. Automatic architecture analysis

The script is not limited to the relays declared in the Medulla database. It reconstructs a representation of the architecture based on the various available configuration sources.

The identified servers are grouped by IP address, along with their names, their inferred roles, and the sources used to identify them.

8.1. Analyzed configuration sources

Source Information sought
/etc/hosts Server names, IP addresses, aliases, and resolution inconsistencies.
/etc/mmc/*.ini General configuration of MMC components.
/etc/mmc/plugins/*.ini Configuration of plugins and database connections.
/etc/mmc/pulse2/ Configuration of Pulse2 services and the package server.
/etc/pulse-xmpp-agent/ Network configuration of the relay agent, excluding the agentconf.ini file.
/etc/pulse-xmpp-agent-substitute/ XMPP substitute configuration.
/etc/ejabberd/ejabberd.yml XMPP domains and ejabberd architecture settings.
/etc/ejabberd/ejabberdctl.cfg Erlang identity and cluster settings.
/etc/mysql/ MariaDB configuration, listening interfaces, replication, and Galera.
Apache configurations ServerName, ServerAlias, and ProxyPass destinations.
guacamole.properties Hosts used by remote control components.
Syncthing configurations Instances, devices, listening addresses, and shared folders.
Ansible INI inventories Servers and groups declared during installation.
Medulla database Relays, substitutes, clusters, and workstation assignments.

8.2. Handling .ini.local files

Medulla uses main configuration files and local override files.

When a .ini.local file exists, its settings take precedence over those in the corresponding .ini file.

Example of a main configuration:

# relayconf.ini
[connection]
server = @@XMPP_SERVER@@

Example of a local override:

# relayconf.ini.local
[connection]
server = pulse

In this example, the actual value analyzed by the script is pulse.

The script merges the main and local configurations to determine the values actually used by Medulla. This rule applies to both the central server and the relays.

8.3. Consistency checks

In particular, the script checks for:

  • A single server name associated with multiple IP addresses.
  • Names referenced in the configurations but not resolved.
  • Unreachable remote database servers.
  • Unreachable remote XMPP servers.
  • MMC plugins using different databases.
  • Differences between the addresses declared in the configurations and those stored in the database.
  • Relays present in Ansible inventories but missing from the Medulla database.
  • Differences between the relay type declared in Ansible and the type detected.
  • Relays missing from Syncthing configurations.
  • Configuration parameters that still contain unreplaced template values.

Since version 1.5, local names resolved to the Debian address 127.0.1.1 are correctly mapped to the central server’s primary IP address in the architecture representation.

8.4. Analysis of Ansible inventories

The script searches for Ansible inventories in INI format in the following directories:

  • /root
  • /home
  • /opt
  • /srv
  • /etc/ansible

The search is limited to a depth of four levels.

The mmcmain, ars, and dmzars groups are used, in particular, to identify the roles declared during installation.

This information is compared with the relays declared in the Medulla database and the nodes of the ejabberd cluster.

9. Central server diagnostics

9.1. System and services

The script collects the following information:

  • Server name and IP addresses.
  • Medulla package versions.
  • Medulla services started before the packages were updated.
  • Status of system and Medulla services.
  • Status of XMPP services.
  • Status of substitutes.
  • MariaDB status.
  • Status of Syncthing services.
  • Status of Apache and Tomcat services.
  • Time synchronization.
  • File system usage.
  • Status of ejabberd certificates.

9.2. Main services checked

Service Function
ejabberd XMPP communications.
mariadb Database.
mmc-agent MMC central services.
pulse-xmpp-agent-relay Relay agent.
pulse-package-watching Package monitoring.
pulse2-package-server Package server.
syncthing@syncthing Main synchronization.
syncthing@syncthing-depl Deployment synchronization.
syncthing-relaysrv Syncthing relay service.
syncthing-discosrv Syncthing discovery service.
apache2 Web server.
tomcat9 Java application services.
ssh SSH access.

9.3. XMPP substitutes

The following ten substitutes are supported:

Substitute Primary function
registration Agent registration.
inventory Inventory processing.
logger Log processing.
monitoring Monitoring.
assessor Agent configuration and assignment.
reconfigurator Reconfiguration of agents.
deployment Deployment management.
subscription XMPP subscription management.
updates Processing updates.
master Core coordination functions.

The script analyzes their status, configurations, and associated XMPP sessions.

In particular, it checks for missing essential sessions and duplicate sessions.

In a standard DMZ architecture, the absence of an active assessor on the central server is normal if it has been properly offloaded to the DMZ relay.

9.4. Checking the /etc/hosts file

In particular, the script verifies that the name pulse correctly points to the central server in its configuration.

It also checks for:

  • An incorrect association of the name pulse with a DMZ relay.
  • An association of the name pulse with the address 127.0.1.1.
  • Names appearing multiple times with different addresses.
  • The presence of the ANSIBLE MEDULLA HOSTS block.

Manual verification commands:

sudo -s
cat /etc/hosts
getent hosts pulse
hostname -f
ip -br addr

10. XMPP and ejabberd diagnostics

10.1. General status of ejabberd

The script analyzes:

  • The status of the ejabberd service.
  • The name of the Erlang node.
  • The configured XMPP domains.
  • The FIREWALL_WINDOW parameter.
  • The Erlang distribution ports.
  • Active XMPP sessions.
  • Server-to-server connections.
  • Certificates.
  • Events in the ejabberd logs.

Manual verification commands:

sudo -s
systemctl status ejabberd
ejabberdctl status
ejabberdctl connected_users
epmd -names

10.2. Mnesia cluster diagnostics

For DMZ architectures, the script compares the view of the ejabberd cluster from the central server and from the relays accessible via SSH.

In particular, it checks:

  • The list of nodes belonging to the cluster.
  • The nodes that are running.
  • Nodes that are stopped or missing.
  • The consistency of the node list across servers.
  • Erlang name resolution.
  • The availability of distribution ports.
  • The presence of any cluster nodes not declared as Medulla relays.

Verification commands to run on the central server and the DMZ relay:

sudo -s
ejabberdctl list_cluster
ejabberdctl mnesia info
epmd -names

An active ejabberd service does not guarantee that the cluster is functioning properly. Each node may continue to operate locally even while communication with other cluster members is interrupted.

10.3. XMPP sessions of Medulla components

The script checks for XMPP sessions for the master_* substitutes and the rs* relay agents.

A missing session may indicate a service, configuration, or network communication issue.

A duplicate session may indicate that multiple instances of the same substitute are active simultaneously.

In a standard DMZ architecture, the presence of multiple master_asse sessions may indicate that the assessor is active on both the central server and the DMZ relay.

sudo -s
ejabberdctl connected_users | grep master_asse
ejabberdctl connected_users | grep master_
ejabberdctl connected_users | grep '^rs'

10.4. Accumulation of conf_ XMPP accounts

When an agent attempts to configure itself, a temporary XMPP configuration account may be created.

These accounts generally use a name in the following format:

conf_<machine>_<identifier>

A significant accumulation of accounts on a single computer may indicate that the agent is regularly attempting to configure itself without successfully completing the configuration process.

The script groups these accounts by computer and flags accumulations that reach the threshold of 50 accounts.

Possible causes include:

  • Assessor unavailable.
  • XMPP communication issue.
  • ejabberd cluster failure.
  • Incorrect relay configuration.
  • Agent stuck in a configuration loop.

The accumulation of conf_ accounts is an indicator of a malfunction. It is recommended to identify and correct the cause before considering deleting these accounts. The script does not perform any automatic cleanup.

11. Network communications diagnostics

The script tests TCP communications between the central server and the relays based on their type.

When SSH access is available, it also performs tests from the relay to the central server.

11.1. Interpreting the results

Status Meaning Recommended action
OUVERT (open) The TCP connection was successfully established. No immediate network action required.
REFUSÉ (refused) The connection was explicitly denied. Check the service, its listening interface, and the firewall's rejection rules.
FILTRÉ (filtered) The connection did not succeed within the allotted time. Check the firewalls, routing, ACLs, and the availability of the destination.

An open port confirms that a TCP connection can be established. It does not guarantee that the application protocol is functioning correctly. Similarly, a filtered port alone does not prove that a firewall is the cause.

11.2. Flows checked for a classic relay

Direction TCP ports checked
Central server to relay 22, 5269, 5555, 8081, 9990, 22000, 5222
Relay to central server 22, 5269, 7080, 8443, 9999, 22067, 22000

11.3. Flows checked for a DMZ relay

Direction TCP ports checked
Central server to DMZ relay 22, 4369, 4370-4380, 5269, 8081, 22000, 5222
DMZ relay to central server 22, 3306, 4369, 4370-4380, 5269, 7080, 8443, 9999, 22067, 22000

11.4. Main ports checked

TCP port Function
22 SSH.
3306 MariaDB access, particularly from the DMZ assessor to the central database.
4369 epmd, Erlang node discovery.
4370-4380 Erlang distribution and ejabberd cluster communications.
5222 XMPP connections for agents.
5269 Server-to-server XMPP communications.
5555 Medulla service.
7080 Medulla service.
8081 Medulla service.
8443 HTTPS service, including Syncthing discovery depending on the configuration.
9990 Medulla service.
9999 Medulla synchronization.
22000 Syncthing synchronization.
22067 Syncthing relay service.
23000 Direct listening port of the syncthing-depl instance in certain configurations.

Syncthing’s direct listening ports are also analyzed based on the actual configuration of the instances.

This list corresponds to the checks performed by the script. It is not an exhaustive list of network flows for all Medulla features. Network openings must be adapted to the architecture and the services actually in use.

11.5. Why must Erlang flows work in both directions?

An Erlang connection established between two nodes enables bidirectional communication.

It is therefore possible for an ejabberd cluster to function even if connections can only be initiated in one direction.

However, after a network outage or a reboot, only the node authorized to initiate the connection will be able to reestablish it.

This situation compromises the cluster’s stability.

In a DMZ architecture, TCP flows on ports 4369 and 4370 through 4380 must be allowed between ejabberd cluster members in both directions, in accordance with the Medulla network configuration. These ports should not be exposed to the Internet unnecessarily.

12. Database diagnostics

12.1. Supporting a remote database

The script analyzes the actual configuration of xmppmaster.ini to determine whether the database is local or remote.

When a remote database server is configured, diagnostic queries are sent to that server using the existing connection settings.

Passwords are not displayed in the reports.

12.2. Medulla data checks

Table or information Check performed
relayserver Declared relays, IP addresses, JIDs, and connection parameters.
substituteconf Assignment of substitutes to relays.
machines Status of relay agents and workstation assignments.
has_cluster_ars Relays’ membership in a Medulla cluster.
cluster_ars Declared relay clusters.
pkgs_rules_global Existence of global rules associated with relay clusters.
mysql.user MariaDB accounts that allow remote connections.

The script also identifies:

  • Workstations associated with a relay JID that no longer exists in the relayserver table.
  • Relays that do not have an associated cluster.
  • Duplicate nameserver values.
  • Inconsistencies between the package server configurations and the Medulla database.

12.3. MariaDB configuration

The checks focus in particular on:

  • The MariaDB listening address.
  • The availability of port 3306 when necessary.
  • Accounts that allow connections from DMZ relays.
  • The permissions associated with ALLOW_FROM_HOSTS.
  • The replication configuration.
  • The status of Galera when it is enabled.

Starting with version 1.2, the status of the Galera cluster is checked only when Galera is actually enabled. A standalone MariaDB server therefore no longer generates an unjustified Galera alert.

12.4. Relays and visibility in the package console

In Medulla, global package distribution rules are associated with relay clusters rather than directly with individual relays.

A relay may therefore be correctly connected via XMPP but not visible in certain package management functions if its cluster membership or the associated rules are incorrect.

The script checks:

  • Whether a cluster is associated with the relay.
  • Whether global rules exist for that cluster.
  • Consistency between the package server addresses and the information stored in the database.

13. Syncthing diagnostics

Starting with version 1.3, the script performs an in-depth analysis of the Syncthing instances on the central server and on the relays.

13.1. The two Syncthing instances on Medulla

Instance Usual local interface Function
syncthing 127.0.0.1:8384 Synchronization of Medulla files and resources, including Windows downloads and updates.
syncthing-depl 127.0.0.1:8385 Synchronization used for deployment operations.

Starting with version 1.7, the syncthing-depl instance is ignored by default: it is no longer analyzed and no longer generates any findings. Its service can be disabled on the central server and on the relays (see 16.9). To analyze it anyway, use the --avec-syncthing-depl option.

These two instances are independent and may have different operational statuses.

The proper functioning of the syncthing instance does not guarantee the proper functioning of syncthing-depl. The two instances must be analyzed separately.

13.2. Services checked

sudo -s
systemctl status syncthing@syncthing
systemctl status syncthing@syncthing-depl

On the central server, the script also checks the following services:

sudo -s
systemctl status syncthing-relaysrv
systemctl status syncthing-discosrv

13.3. Information collected

For each instance, the script analyzes:

  • The local Syncthing identifier.
  • Declared devices.
  • Connection status.
  • The date of the last available contact.
  • Devices that have never been connected.
  • Listening addresses.
  • Discovery servers.
  • Syncthing relay usage.
  • Shared folders.
  • Faulty or paused folders.
  • Data remaining to be synced.

Information is collected from configuration files and Syncthing's local REST API when it is accessible.

Syncthing API keys are not displayed.

13.4. Comparison between the central server and the relays

For each instance, the script compares the configurations on both sides.

In particular, it checks:

  • Whether the relay’s identifier is present in the central server’s configuration.
  • Whether the central server’s identifier is present in the relay’s configuration.
  • Consistency of the discovery settings.
  • Consistency in the use of Syncthing relays.
  • The availability of direct listening ports when this mode is used.
  • The mutual presence of shared folders.
  • Any synchronization errors.

Starting with version 1.4, Syncthing findings are grouped by instance and by relay to avoid redundant alerts.

Starting with version 1.5, the recommended action is listed first, followed by any alternative solutions.

13.5. syncthing-depl discovery issue

In some installations, the relay’s syncthing-depl instance may have the following configuration:

  • Listening directly on TCP port 23000.
  • Syncthing relays disabled.
  • No discovery server configured.
  • Device addresses configured in dynamic mode.

In this situation, devices may be correctly declared but may fail to discover each other and establish a connection.

The issue may stem from the order in which configurations are generated during the Ansible installation.

Possible consequences include:

  • syncthing-depl instance disconnected.
  • Device reported as never having been connected.
  • Deployments affected when they require this synchronization.

13.6. Recommended fix for discovery

When the relay can reach the central server’s listening port but has no discovery server available, the script recommends, as a priority, setting the globalAnnounceServer parameter on the relay.

The value must correspond to the Syncthing discovery service of the Medulla infrastructure.

It is recommended to use the actual configuration of the discovery server used by the functional Syncthing instance, after verifying its compatibility with the deployment instance.

Other possible solutions, depending on the architecture, are:

  • Configure static addresses for the devices.
  • Allow the necessary direct communications.
  • Configure a suitable Syncthing relay service.

It is not always necessary to open port 23000 in both directions. When the relay can initiate a connection to the central server, a correct discovery configuration may suffice. The choice must take network security policies into account.

13.7. Missing folders in syncthing-depl

The absence of permanent shared folders in the syncthing-depl instance is not necessarily abnormal.

Unlike the main instance, certain deployment folders are created dynamically by the relay agent based on ongoing operations.

It is important to distinguish between the absence of folders at rest and an actual synchronization error during a deployment.

14. Additional checks

14.1. Version consistency between the central server and relays

The script compares the versions of the packages installed on the central server and on each relay accessible via SSH, whether it is a classic relay or a DMZ relay.

Component Classic relay DMZ relay
Medulla packages (pulse*, medulla*, python3-mmc*, mmc-*) ALERTE (alert) if version differs ALERTE if version differs
pulse-xmpp-agent-relay missing from the relay ALERTE ALERTE
pulse-xmpp-master-substitute missing from the relay Not checked ALERTE (remote assessor)
ejabberd INFO (s2s federation) CRITIQUE (critical, Mnesia cluster)
syncthing, mariadb-server INFO INFO

Medulla version discrepancies for the same relay are grouped into a single finding, which lists each package along with the relay’s version and the central server’s version.

In a DMZ architecture, all nodes in the ejabberd cluster must use the same version of ejabberd. A version discrepancy is therefore flagged as critical.

Services not restarted after an update

An update to a Medulla package does not always restart the services it provides. The service then continues to run with the old code loaded into memory, even though the new version is installed.

For each active Medulla service (pulse-xmpp-*, mmc-agent, pulse2-*, pulse-package-*), the script compares:

  • The service’s startup date.
  • The installation date of the package that provides this service.

A service that was started before its package was installed is flagged as ALERTE, along with the restart command to be executed. This check is performed on the central server and on each relay.

Manual verification commands:

sudo -s
dpkg-query -W | grep -Ei 'medulla|pulse'
systemctl show -p ActiveEnterTimestamp pulse-xmpp-agent-relay pulse-xmpp-master-substitute-assessor

14.2. Time synchronization

The script compares the time on the central server with that of the accessible relays.

A discrepancy of more than 60 seconds is reported.

Time desynchronization can affect certificates, log analysis, and certain authentication mechanisms.

sudo -s
date
timedatectl status

14.3. Disk space

The script checks the disk usage of the central server and accessible relays.

Insufficient disk space can, in particular, disrupt:

  • The download of Windows updates.
  • Syncthing synchronization.
  • Package storage.
  • System image management.
  • Databases.
  • Service logs.
sudo -s
df -h
df -i

14.4. Certificates

The script analyzes the ejabberd certificates available on the central server and on accessible relays.

An expired or invalid certificate can disrupt XMPP connections and inter-server communications.

14.5. Checking forwarding URLs

The script checks certain URLs declared in the Medulla configurations, particularly the url_to_forward parameter.

An HTTP 404 response may indicate an incorrect URL or a configuration issue with the destination service, particularly when forwarding inventory data to GLPI.

The script reports this issue without modifying the configuration.

14.6. SSH configuration and XMPP connections

During remote data collection, the script also analyzes information related to the SSH configuration of the relays, including settings associated with reverse tunnels and XMPP connections on port 5222.

15. Reading and interpreting the report

The report presents the collected information and a summary of findings classified by severity level.

Severity Meaning Priority
CRITIQUE (critical) Issue likely to significantly affect the operation of the infrastructure. Priority handling.
ALERTE (alert) An anomaly, inconsistency, or degradation requiring verification. Handling to be scheduled based on the impact.
INFO Information useful for understanding the architecture or diagnosis. Analysis as needed.

Each finding is accompanied, whenever possible, by a recommended action.

15.1. Example summary

Illustrative example of a diagnosis:

SYNTHESE DU DIAGNOSTIC

CRITIQUE : 2
ALERTE   : 3
INFO     : 3

CRITIQUE
- Port 4369 filtré du central vers le relais DMZ.
- Port de distribution Erlang inaccessible.

ALERTE
- Versions Medulla différentes entre le central et le relais.
- Composants du relais à mettre à jour.
- Instance syncthing-depl non connectée.

INFO
- Informations complémentaires sur l'architecture.

In this example, priority should be given to addressing the ejabberd cluster’s communications, followed by version differences and the Syncthing configuration.

15.2. Script return codes

Code Meaning
0 No critical issues or alerts.
1 At least one alert, but no critical issues.
2 At least one critical issue.

These codes make it possible, in particular, to integrate the diagnostic results into a monitoring tool or an automated process.

sudo -s
python3 /root/medulla_diag_relais_V1.7.py
echo $?

A return code of 0 means that no critical anomalies or alerts were identified by the checks performed. It does not constitute a comprehensive certification of the infrastructure’s operation.

16. Frequently asked questions and troubleshooting

16.1. The relay appears in Medulla but the script cannot connect to it via SSH

The operation of the XMPP relay agent and SSH access are two independent mechanisms.

A relay can be connected to Medulla while still being inaccessible via SSH from the central server.

Check:

  • The IP address used to reach the relay.
  • The availability of TCP port 22.
  • The central server’s SSH key.
  • SSH connection permissions.
  • The sudo privileges of the medulla user.
sudo -s
ssh -o BatchMode=yes root@192.168.1.10

If the root user is not authorized:

sudo -s
ssh -o BatchMode=yes medulla@192.168.1.10

Then, on the relay:

sudo -n true

If this last command fails, check the user’s sudo permissions.

16.2. The relay’s public IP address is inaccessible from the central server

In some architectures, a relay has a public IP address intended for external agents and a private IP address intended for internal communications.

The central server may not necessarily be able to reach the relay’s public address.

The script searches for a usable address based on database information and name resolution.

An unreachable public address may therefore be reported for informational purposes even when another address can be used to reach the relay.

16.3. The name pulse points to the DMZ relay instead of the central server

This situation may result from an incorrect configuration of the /etc/hosts file during installation or when adding a DMZ relay.

Check the resolution from the central server:

sudo -s
getent hosts pulse
cat /etc/hosts

The name pulse must point to the central server in the central server’s configuration.

Before making any changes, also verify the names of the ejabberd nodes and the actual configurations of the agents and substitutes.

If necessary, correct the Ansible configuration source to prevent the issue from recurring when the playbook is run again.

16.4. The ejabberd cluster is broken

Compare the cluster status from each server:

sudo -s
ejabberdctl list_cluster
ejabberdctl mnesia info
epmd -names

Then verify:

  • Erlang node name resolution.
  • TCP flows 4369 and 4370 through 4380 in both directions.
  • The ejabberd configuration on the various servers.
  • Version compatibility.
  • The events in the logs.
sudo -s
journalctl -u ejabberd -n 200 --no-pager

Caution: Do not automatically restart a join_cluster operation to repair a cluster. This operation may overwrite the Mnesia data on the node joining the cluster and result in the loss of XMPP accounts created while the cluster was broken.

Before performing any reintegration operation, perform a backup of the ejabberd data on the affected nodes.

Example of a backup command to run on each affected node, using a path accessible to the service:

sudo -s
ejabberdctl backup /var/lib/ejabberd/backup-avant-cluster.backup

Verify that the backup was created correctly and contact Medulla support if you have any doubts about which reference node to keep.

16.5. Multiple master_asse sessions are present

In a standard DMZ architecture, the assessor substitute is offloaded to the DMZ relay.

If the assessor also remains active on the central server, multiple sessions may be present simultaneously.

Check the service status on both servers:

sudo -s
systemctl status pulse-xmpp-master-substitute-assessor
ejabberdctl connected_users | grep master_asse

Then verify the assessor’s assignment in the Medulla database and in the actual configurations.

The correction must be tailored to the actual deployed architecture. Do not disable an assessor without first identifying which one is responsible for configuring the agents.

16.6. Hundreds or thousands of conf_ accounts are present

This situation may indicate that one or more agents are attempting to configure themselves in a loop.

Check the following first:

  • An unavailable assessor.
  • A broken ejabberd cluster.
  • A misconfigured relay.
  • A network communication issue.
  • A missing computer account following a cluster failure.

The script summary helps identify the computers affected by significant accumulations.

Once the cause has been resolved, a diagnostic check of the affected agents can be performed using the Medulla agent diagnostic tool.

See the FAQ: Diagnosing and fixing Medulla agents.

16.7. A relay is connected but does not appear in package management

Verify that the relay belongs to a Medulla cluster and that a global distribution rule is associated with that cluster.

The following tables are particularly relevant:

  • relayserver
  • has_cluster_ars
  • cluster_ars
  • pkgs_rules_global

Also verify that the public_ip parameter of the package server matches the package_server_ip field stored in the database.

16.8. Workstations are linked to a nonexistent relay

This situation may occur after:

  • The deletion of a relay.
  • Changing a relay’s XMPP domain.
  • Changing a relay’s JID.
  • An infrastructure migration.
  • A relay reinstallation.

The script compares the workstation assignments with the JIDs known to the relays, without taking the XMPP resource into account.

Identify the affected workstations using the information and queries provided in the report.

You should then verify their assignments and, if necessary, reconfigure them using the appropriate Medulla tools.

16.9. Syncthing is running but syncthing-depl is disconnected

The syncthing-depl instance can be ignored and its service disabled. Starting with version 1.7, the script no longer analyzes it by default.

To disable the service, on the central server and on each relay:

sudo -s systemctl disable --now syncthing@syncthing-depl

For a relay, from the central server:

sudo ssh root@RELAY_IP 'systemctl disable --now syncthing@syncthing-depl'

If, on the other hand, you wish to diagnose this instance, rerun the script with the --avec-syncthing-depl option, then perform the checks below.

Check the two instances separately.

sudo -s
systemctl status syncthing@syncthing
systemctl status syncthing@syncthing-depl

Check the logs for the deployment instance:

sudo -s
journalctl -u syncthing@syncthing-depl -n 200 --no-pager

Then check the following settings:

  • Identifiers of declared devices.
  • Listening addresses.
  • Discovery server.
  • Syncthing relay activation.
  • Availability of the direct listening port.

If the report indicates that there is no discovery server, prioritize implementing the recommendation appropriate for this configuration.

16.10. Syncthing devices disappear after re-running Ansible

In some versions of the installation roles, the configuration file for the syncthing-depl instance may be regenerated when the playbook is run again.

This regeneration may result in the loss of settings or dynamically added devices.

Before re-running a playbook, it is recommended that you verify the behavior of the role being used and perform a backup of the relevant Syncthing configurations.

16.11. A port is filtered while the relay is running

Some services may continue to function thanks to connections that have already been established or initiated in the opposite direction.

This situation is particularly possible for Erlang and Syncthing communications.

You should verify whether the flow is necessary for the architecture, then determine whether the absence of this flow could affect reconnection after an interruption.

Do not systematically modify firewall rules without analyzing the port’s role and the required direction of communication.

16.12. The central server and the relays are not using the same version

The script flags version differences between the central server and each relay.

A relay can be updated from the central server via SSH using the key already authorized on the relays. Replace RELAY_IP with the address used by the central server to connect to the relay.

1. List the Medulla packages to be updated:

sudo ssh root@RELAY_IP 'apt-get update -q && apt list --upgradable 2>/dev/null | grep -E "^(pulse|medulla)"'

2. Back up the ejabberd database and the relay’s configurations:

sudo ssh root@RELAY_IP 'ejabberdctl backup /var/lib/ejabberd/avant-maj.backup && tar czf /root/etc-medulla-avant-maj.tgz /etc/pulse-xmpp-agent /etc/pulse-xmpp-agent-substitute /etc/ejabberd'

The /etc/mmc directory does not exist on a relay: it should not be included in the archive.

3. Update only the listed packages, while preserving the existing configurations:

sudo ssh root@RELAY_IP 'DEBIAN_FRONTEND=noninteractive apt-get install -y --only-upgrade -o Dpkg::Options::="--force-confold" pulse-xmpp-agent-relay pulse-xmpp-master-substitute'

Adjust the list of packages based on the result of step 1. The settings defined in the .ini.local files are preserved.

4. Restart the Medulla services on the relay:

sudo ssh root@RELAY_IP 'systemctl restart pulse-xmpp-agent-relay pulse-xmpp-master-substitute-assessor'

On a classic relay, restart only the services that are present (the assessor is not normally active there).

Workstations connected to the relay will lose their connection for a few seconds during the restart. Choose a time when activity is low.

5. Verify:

sudo ssh root@RELAY_IP 'dpkg-query -W pulse-xmpp-agent-relay pulse-xmpp-master-substitute; systemctl show -p ActiveEnterTimestamp pulse-xmpp-agent-relay pulse-xmpp-master-substitute-assessor'
sudo ejabberdctl mnesia info | grep -E "running db nodes|stopped db nodes"

For a DMZ relay, the relay must appear in running db nodes, and stopped db nodes must be empty.

Then rerun the diagnostic: any findings of version mismatches or services that were not restarted should have disappeared.

For a simple package update, opt for this targeted update rather than running the relay installation playbook again in its entirety, which may regenerate certain configurations (see 16.10).

16.13. The report indicates a configuration value that has not been replaced

Some configurations generated by Ansible contain variables of the form:

@@XMPP_SERVER@@
@@server_fqdn@@

If an actual value still contains a template that should have been replaced during installation, this may indicate an incomplete configuration.

The script distinguishes between template values and parameters normally used at runtime, including certain Guacamole URL parameters.

Since version 1.5, hostnames containing unreplaced templates no longer generate false DNS resolution findings.

16.14. MariaDB does not use Galera

It is perfectly possible to use MariaDB without a Galera cluster.

Since version 1.2, the script checks that Galera is enabled before analyzing its status.

A standalone MariaDB server should therefore not be considered faulty simply because it does not belong to a Galera cluster.

16.15. Can the script automatically fix problems?

No.

The script is intended solely for diagnosing the infrastructure and making recommendations.

In particular, it does not perform any of the following operations:

  • Modifying configuration files.
  • Modifying firewall rules.
  • Modifying databases.
  • Restarting services.
  • Reintegrating an ejabberd node into a cluster.
  • Deleting XMPP accounts.
  • Modifying Syncthing configurations.
  • Upgrading Medulla components.

Corrections must be made by an administrator after reviewing the report.

16.16. How do I download the script again?

To re-download version 1.7 of the script, run the following commands from the central server:

sudo -s
cd /root
wget -O medulla_diag_relais_V1.7.py https://dl.medulla-tech.io/ma/medulla_diag_relais_V1.7.py
chmod +x medulla_diag_relais_V1.7.py

The local file with the same name will be replaced.

If the download fails, check DNS resolution, outbound HTTPS access, and the availability of the Medulla download server.

17. Recommended diagnostic procedure

If a distributed Medulla infrastructure malfunctions, it is recommended that you follow this procedure:

  1. Download the version of the script specified in this documentation.
  2. Run a full diagnostic from the central server.
  3. Save the text and JSON reports.
  4. Analyze the critical findings.
  5. Check name resolution and network communications.
  6. Verify the operation of the ejabberd cluster for DMZ architectures.
  7. Verify substitutes, particularly the assessor.
  8. Verify the relay configurations and assignments in the database.
  9. Verify the two Syncthing instances.
  10. Verify the consistency of Medulla versions.
  11. Apply the necessary corrections after validation.
  12. Run the diagnostic again to verify the results of the corrections.

17.1. Compare diagnostics before and after corrections

Before corrections:

sudo -s python3 /root/medulla_diag_relais_V1.7.py --sortie /root/diagnostic-avant.txt --json /root/diagnostic-avant.json

After corrections:

sudo -s python3 /root/medulla_diag_relais_V1.7.py --sortie /root/diagnostic-apres.txt --json /root/diagnostic-apres.json

To compare text reports:

sudo -s
diff -u /root/diagnostic-avant.txt /root/diagnostic-apres.txt

Reports may also contain normal differences related to the time of the diagnostic run, active sessions, or changes in synchronization operations.

18. Submitting information to Medulla support

When opening a ticket with Medulla support, it is recommended that you provide the following:

  • The diagnostic report in text format.
  • The diagnostic report in JSON format.
  • The central server version.
  • The version of the affected relays.
  • The architecture type: classic, DMZ, or mixed.
  • Description of the observed malfunction.
  • The date the problem occurred.
  • Any recent network changes or updates.
  • Any corrections already made.

To generate the reports:

sudo -s
cd /root
python3 medulla_diag_relais_V1.7.py --sortie diagnostic-relais.txt --json diagnostic-relais.json

To combine the two reports into a single archive:

sudo -s
cd /root
tar -czf diagnostic-relais-$(hostname)-$(date +%Y%m%d).tar.gz diagnostic-relais.txt diagnostic-relais.json

Then send the generated archive to Medulla support as part of your support ticket.

The reports may contain information about your infrastructure, including server names, IP addresses, technical identifiers, and configuration paths. They should only be shared with authorized individuals or Medulla support.

19. Security and privacy

The script was designed to minimize the risks associated with collecting technical information.

  • Checks are read-only.
  • No changes are applied automatically.
  • Diagnostic queries do not modify the databases.
  • Passwords are masked in the results.
  • Syncthing API keys are not displayed.
  • Sensitive information in Guacamole URLs is masked.
  • The agentconf.ini file is excluded from configuration collection.
  • No permanent scripts are installed on the relays.
  • No SSH host keys are automatically added to the known_hosts file.
  • Text and JSON reports are saved when the corresponding options are requested.

Network tests and SSH connections may, however, generate events in the logs of the relevant services.

Diagnostic reports are not encrypted by the script. Masking secrets does not eliminate the need to protect the generated files and control their distribution.

20. Scope and limitations

The script analyzes the information available at the time of execution.

The following limitations must be taken into account:

  • Remote checks depend on the availability of SSH access.
  • A service accessible on its TCP port may have an application malfunction that is not detected by a simple network test.
  • Ansible inventories in INI format are supported. YAML inventories are not analyzed in this version.
  • Architectures with multiple DMZ relays or cascaded relays may require additional analysis.
  • The script does not automatically compare Erlang cookie fingerprints across nodes.
  • The script does not automatically compare certificate fingerprints across cluster members.
  • Detailed diagnostics of Windows, Linux, or macOS agents require additional tools.
  • The script does not perform throughput measurements or load testing on the infrastructure.
  • The script does not perform agent deployment on workstations.

This tool is a diagnostic aid. Recommendations should be interpreted in light of the actual architecture, the features in use, and the organization’s security policies.

21. Version history

Version 1.7 — November 26, 2026

  • The syncthing-depl instance is ignored by default: no more findings or associated port tests.
  • Added the --avec-syncthing-depl option to analyze it if necessary.

Version 1.6 — November 25, 2026

  • Comparison of all Medulla packages between the central server and each relay, whether classic or DMZ.
  • Grouping of Medulla version discrepancies for a single relay into a single finding.
  • Detection of essential packages missing from relays.
  • Checking the ejabberd version: critical in a DMZ cluster, informational for a classic relay.
  • Detection of Medulla services started before their packages were updated, on the central server and on the relays.

Version 1.5 — November 25, 2026

  • Improved detection of templates not replaced in URLs.
  • Removal of false DNS resolution findings related to names containing configuration variables.
  • Handling of central server names resolved to the Debian address 127.0.1.1.
  • Improved presentation of Syncthing recommendations.
  • Prioritizes the recommended action, followed by alternative solutions.
  • Validation on a Medulla platform consisting of a central server and a DMZ relay.

Version 1.4 — November 25, 2026

  • Improved merging of .ini and .ini.local files on relays.
  • Analysis of the actual values of relayconf and the package server.
  • Improved distinction between unreplaced templates and parameters used at runtime.
  • Grouping of Syncthing findings by instance and by relay.
  • Removed redundant Syncthing alerts.
  • Improved recommendations regarding syncthing-depl discovery.

Version 1.3 — November 25, 2026

  • Aligned SSH behavior with Ansible Medulla installation procedures.
  • Use of the central server’s SSH key.
  • Support for root and medulla users.
  • Support for non-interactive sudo.
  • Added the --ssh-strict option.
  • Comprehensive analysis of both Syncthing instances.
  • Comparison of devices and shared folders between the central server and the relays.
  • Analysis of Syncthing's direct listening ports.
  • Analysis of network configurations and name resolution from the relays.

Version 1.2 — November 25, 2026

  • Improved automatic classification of DMZ relays.
  • Support for different ejabberd domains on the central server.
  • Accounts for actual membership in the ejabberd cluster.
  • Removal of false Galera findings when Galera is not enabled.
  • Excludes the local Syncthing device from disconnection findings.
  • Improved detection of workstations associated with nonexistent relays.
  • Reduced false positives in architecture analysis.

Version 1.1 — November 25, 2026

  • Added the automatic architecture analysis section.
  • Analysis of MMC, Apache, MariaDB, ejabberd, Guacamole, and Syncthing configurations.
  • Analysis of Ansible INI inventories.
  • Cross-referencing information between configuration files and databases.
  • Support for remote databases.
  • Monitoring of relay clusters and package distribution rules.
  • Detection of workstations associated with nonexistent relays.

Version 1.0 — Initial release

  • Diagnostics for the central Medulla server.
  • Automatic detection of classic and DMZ relays.
  • Service monitoring.
  • Network communication diagnostics.
  • ejabberd and Mnesia diagnostics.
  • Analysis of XMPP substitutes.
  • Detection of conf_ account accumulations.
  • Remote data collection via SSH.
  • Analysis of configurations and databases.
  • Summary of findings by severity level.
  • Export of reports in text and JSON formats.

22. Download and additional documentation

22.1. Download

22.2. Documentation

23. Summary — Quick start

The medulla_diag_relais_V1.7.py script allows you to centralize diagnostics for Medulla infrastructures consisting of one or more relays.

In particular, it helps identify issues related to architecture, network communication, XMPP configuration, ejabberd clusters, databases, and Syncthing synchronization.

To download the script and immediately run a comprehensive diagnostic from the central server, execute the following commands:

sudo -s
cd /root
wget -O medulla_diag_relais_V1.7.py https://dl.medulla-tech.io/ma/medulla_diag_relais_V1.7.py
chmod +x medulla_diag_relais_V1.7.py
python3 medulla_diag_relais_V1.7.py --sortie diagnostic-relais.txt --json diagnostic-relais.json

The reports are available in the following files:

File Usage
/root/diagnostic-relais.txt Reading and analyzing the diagnostic results by an administrator.
/root/diagnostic-relais.json Structured analysis of the results and forwarding to support.

Key takeaway: The diagnostic can be rerun after each intervention to verify changes in the findings, without modifying the configurations or services of the Medulla infrastructure.