This article covers how to configure disable UTF8 connectivity to the MySQL/MariaDB databases. By default Nagios XI uses UTF8 however sometimes this needs to be disabled to allow MySQL / MariaDB to define the connectivity method.
This configuration ensures that characters from different languages can be correctly stored and retrieved in the databases.
The Nagios XI Configuration Directive
The following configuration directive was added in Nagios XI 5.4.13:
$cfg['db_conn_utf8'] = 0;
To determine if you currently have that directive enabled, establish a terminal session to your Nagios XI server as the root user and execute the following command:
$ grep db_conn_utf8 /usr/local/nagiosxi/html/config.inc.php
If the grep command produces NO output then the directive does not exist in your configuration and it needs to be added. This can be added with the following command:
$ printf "\n\$cfg['db_conn_utf8'] = 0;\n" >> /usr/local/nagiosxi/html/config.inc.php
If the grep command produced output then it can be changed with the following command (sets it to 0):
$sed -i "s/db_conn_utf8'\] =.*/db_conn_utf8'\] = 0;/g" /usr/local/nagiosxi/html/config.inc.php
Defining the directive to 0 will resolve the issue you for garbled or ??? characters.
If you wanted to change it to 1 then use the following command:
$sed -i "s/db_conn_utf8'\] =.*/db_conn_utf8'\] = 1;/g" /usr/local/nagiosxi/html/config.inc.php
The change takes effect immediately.