monit causing errors in mysql logs

Summary

When using monit to monitor mysql (mariadb) and you enable mysql error.log (which should be enabled by default), then mysql logs the following each minute:

2025-02-05 14:18:26 569 [Warning] Aborted connection 569 to db: 'unconnected' user: 'unauthenticated' host: 'localhost' (This connection closed normally without authentication)

Steps to reproduce

  1. install ISPconfig with monit using perfect server tutorial

Correct behaviour

No errors should appear in mysql logs because of monitoring tools.

Environment

Server OS + version: Ubuntu 22.04.5 LTS

ISPConfig version: 3.2.12p1

Software version of the related software:

Monit version 5.31.0
MariaDB 10.6.18-MariaDB

Proposed fix

Add an username and password for monit to mysql during installation and use it in monit scripts to authenticate against mysql when doing checks in /etc/monit/conf-enabled/mariadb:

...
if failed host 127.0.0.1 port 3306 protocol mysql username "monit" password "somestrongpassword" then restart
if failed unixsocket /var/run/mysqld/mysqld.sock protocol mysql username "monit" password "somestrongpassword" for 3 times within 4 cycles then restart
...

Related log entries

/var/log/mysql/error.log:

2025-02-05 14:18:26 569 [Warning] Aborted connection 569 to db: 'unconnected' user: 'unauthenticated' host: 'localhost' (This connection closed normally without authentication)
Edited by rush131