Skip to main content
Discussion ongoing

Passing credentials through MySQL/MariaDB service templates to override host's credential macros

Related products:Infra Monitoring - Connectors
  • June 11, 2026
  • 2 replies
  • 7 views

Forum|alt.badge.img+8

Hello.

 

The MySQL/MariaDB connector stores the credentials in the monitored host's macros.

 

The problem is that if I need to have a service that connects to the server of that monitored host but with another user, there is no way to override the "default" credentials from the host's macros.

 

We have several MySQL servers with several databases and users in each that we need to monitor.

 

So for now, you need to create a new monitored host (for the same server) with those credentials or use a modified command based on the one provided by the connector.

 

Could it be possible to add that functionality (overriding the credential stored in the host) to the service templates for the MySQL/MariaDB connector? That also be consistent with how other connectors work, which allow to override macro's values stored in the host with its own macros or passed as options in the EXTRAOPTIONS macro (for example, hostname, protocol, port...).

 

The connector allows to specify a database and port to connect to; it would seem normal it also allows to set the credentials if needed.

 

Regards.

2 replies

lpinsivy
Centreonian
Forum|alt.badge.img+21
  • Centreonian
  • June 12, 2026

Hi ​@emeck,

The definition of macros on hosts or on services depends on the definition of the control command.

Here the App-DB-MySQL-Connection-Time command have the following definition:

$CENTREONPLUGINS$/centreon_mysql.pl --plugin=database::mysql::plugin --host=$HOSTADDRESS$ --username='$_HOSTMYSQLUSERNAME$' --password='$_HOSTMYSQLPASSWORD$' --port='$_HOSTMYSQLPORT$' $_HOSTMYSQLEXTRAOPTIONS$ --mode=connection-time --warning='$_SERVICEWARNING$' --critical='$_SERVICECRITICAL$' $_SERVICEEXTRAOPTIONS$

The MYSQLUSERNAME, MYSQLPASSWORD, MYSQLPORT should be defined on a host or host template.

If you want to overwrite the username and password, you must duplicate the commande, and change $_HOSTMYSQLUSERNAME$ and $_HOSTMYSQLPASSWORD$ by $_SERVICEMYSQLUSERNAME$ and $_SERVICEMYSQLPASSWORD$. Then select this command in your service and define MYSQLUSERNAME, MYSQLPASSWORD macros


lpinsivy
Centreonian
Forum|alt.badge.img+21
  • Centreonian
  • June 12, 2026
Updated idea statusNewDiscussion ongoing