Disabling database UTF8 connectivity is quite easy. We can accomplish it by just running few commands.
In this context, we shall look into how to disable UTF8 connectivity to the MySQL/MariaDB databases for Nagios XI.
More information about UTF-8 encoding ?
The UTF-8 encoding represents every symbol in the Unicode character set. It ranges from U+000000 to U+10FFFF.
Also, UTF-8 is a variable-width encoding; it encodes each symbol using one to four 8-bit bytes.
Symbols with lower numerical code point values are encoded using fewer bytes. This way, UTF-8 is optimized for the common case where ASCII characters and other BMP symbols are used — while still allowing astral symbols to be stored.
Here, you will learn how to disable UTF8 connectivity to the MySQL/MariaDB databases for Nagios XI.
How to disable database UTF8 connectivity ?
Here, you will see how our Support Experts disable database utf8 connectivity.
The Nagios XI Configuration Directive
In Nagios XI 5.4.13, the following configuration directive was added:
$cfg[‘db_conn_utf8’] = 0;
In order to determine if the directive is enabled or not, we establish a terminal session to Nagios XI server as the root user.
Then we 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 our configuration and we need to add it.
We can add it using the following command:
$ printf “\n\$cfg[‘db_conn_utf8’] = 0;\n” >> /usr/local/nagiosxi/html/config.inc.php
If the grep command produces output, then we can change it 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 for garbled or ??? characters.
If we want to change it to 1, we 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.