LibreNMS with Check_MK causing Database errors

Hi All

I have been trying to use Check_MK.
I’ve enabled the Unix check and setup a host with the Check_MK agent.
Once this has been running for a few minutes I found that the database stops responding and shows errors as below, the interface also shows ‘We ran into a problem’:

[previous exception] [object] (PDOException(code: 2006): SQLSTATE[HY000] [2006] MySQL server has gone away at /opt/librenms/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27)

[previous exception] [object] (Doctrine\DBAL\Driver\PDOException(code: 2006): SQLSTATE[HY000] [2006] MySQL server has gone away at /opt/librenms/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31)

production.ERROR: SQLSTATE[HY000] [2006] MySQL server has gone away (SQL: select * from users where users.user_id
= 4 limit 1) at /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php:671)

[previous exception] [object] (PDOException(code: 1040): SQLSTATE[HY000] [1040] Too many connections at /opt/ibrenms/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27)

I took a look at the the MySQL setup monitoring and it is now maxing database connects against the detault max connections setting of 151 in MySQL but this only happened yesterday with this add in enabled.
I have increased the number of max connections to 200 and after a few minutes, that also maxes out as well.

A graph zoomed to the last couple of hours shows the utilization of connections maxed:

Is there some performance tuning I’m missing or settings that should be in place to handle this?

I also checked that the daily update had been run and that the validate ran ok without issues. The only time a validate fails is if the SQL instance has failed and not auto recovered.

Any help appreciated.

Kind regards