Disabling database UTF8 connectivity is quite easy. We can accomplish it by just running few commands.
Here at Bobcares, we have seen several such Nagios-related queries as part of our Server Management Services for web hosts and online service providers.
Today, let us see how to disable UTF8 connectivity to the MySQL/MariaDB databases for Nagios XI.
know more 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.
In this article, let us see how to disable UTF8 connectivity to the MySQL/MariaDB databases for Nagios XI.
Disabling database UTF8 connectivity
Now let us see how our Support Engineers 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.
[Need any further assistance with Nagios-related queries? – We are here to help you]
Today, we saw how our Support Engineers configure disable UTF8 connectivity to the MySQL/MariaDB databases