Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Character set problem of Zabbix Monitoring [4]

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

There are three common character set problems encountered in ix monitoring:

1. Chinese garbled codes are displayed in the graphics.

The solution of Zabbix Monitoring to the problem of Chinese garbled in zabbix Diagram [accessory]

Solution:

one

two

three

four

five

six

# 1. Select a font you like, such as mysh.ttf (elegant black), from the window host path C:\ Windows\ Fonts

# 2. Upload the copied font to the fonts directory of the zabbix server web page file and name it

DejaVuSans.ttf

[root@zhu1 ~] # mv / var/www/html/fonts/DejaVuSans.ttf / var/www/html/fonts/DejaVuSans.ttf.old

Mv/var/www/html/fonts/mysh.ttf / var/www/html/fonts/DejaVuSans.ttf

# this can solve the problem of garbled code

two。 There is a question mark garbled in the history record, and it cannot be updated, and the function reports a long garbled error in the database.

This is related to the character set used by the zabbix database, and the solution is as follows:

1. View the current default character set

one

two

three

four

five

six

seven

eight

nine

ten

eleven

twelve

thirteen

fourteen

fifteen

sixteen

seventeen

eighteen

nineteen

twenty

twenty-one

twenty-two

Mysql > show create database zabbix

+-+ +

| | Database | Create Database |

+-+ +

| | zabbix | CREATE DATABASE `zabbix` / *! 40100 DEFAULT CHARACTER SET latin1 * / | |

+-+ +

1 row inset (0.00 sec)

# when three sql files are imported during installation, the character set of the table created in the zabbix database is also latin1

Mysql > show variables like 'character%'

+-+

| | Variable_name | Value |

+-+

| | character_set_client | latin1 |

| | character_set_connection | latin1 |

| | character_set_database | latin1 |

| | character_set_filesystem | binary |

| | character_set_results | latin1 |

| | character_set_server | latin1 |

| | character_set_system | utf8 |

| | character_sets_dir | / usr/share/mysql/charsets/ |

+-+

8 rows inset (0.00 sec)

two。 This is due to the fact that the character set is not utf8, and there are now two solutions:

When there is a certain data solution in the current zabbix database

1) back up zabbix database

one

[root@zhu1] # mysqldump-uroot-p123456 zabbix > zabbix.sql

2) modify backup files

one

[root@zhu1 ~] # sed-I's hand latin1 zabbix.sql UTF 8 Universe

3) Delete zabbix database

one

Mysql > drop database zabbix

4) close the mysql database and set the default character set

one

two

three

four

five

six

[root@zhu1 ~] # vim / etc/my.cnf

[mysqld]

Log-bin

Datadir=/var/lib/mysql

Socket=/var/lib/mysql/mysql.sock

Default-character-set= utf8 # add this or

Character-set-server=utf8

5) start mysql and restore zabbix database

one

[root@zhu1] # mysql-uroot-p123456 zabbix

< zabbix.sql 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 mysql>

Show create database zabbix

+-+ +

| | Database | Create Database |

+-+ +

| | zabbix | CREATE DATABASE `zabbix` / *! 40100 DEFAULT CHARACTER SET utf8 * / | |

+-+ +

1 row inset (0.00 sec)

Mysql > show variables like 'character%'

+-+

| | Variable_name | Value |

+-+

| | character_set_client | latin1 |

| | character_set_connection | latin1 |

| | character_set_database | utf8 |

| | character_set_filesystem | binary |

| | character_set_results | latin1 |

| | character_set_server | utf8 |

| | character_set_system | utf8 |

| | character_sets_dir | / usr/share/mysql/charsets/ |

+-+

8 rows inset (0.00 sec)

6) visit the page

two。 When discovered after installation, you can:

one

two

three

# 1. Delete zabbix database

# 2. Set the default character set of mysql database to utf8

# 3. Recreate the zabbix database and import three sql files

Summary:

two

one

two

three

four

five

six

seven

eight

nine

ten

eleven

twelve

-- with-charset=CHARSET

Default character set, use one of:

Binary

Armscii8 ascii big5 cp1250 cp1251 cp1256 cp1257

Cp850 cp852 cp866 cp932 dec8 eucjpms euckr gb2312 gbk geostd8

Greek hebrew hp8 keybcs2 koi8r koi8u

Latin1 latin2 latin5 latin7 macce macroman

Sjis swe7 tis620 ucs2 ujis utf8

-- with-extra-charsets=CHARSET,CHARSET,...

Use charsets inaddition to default (none, complex

All, or a list selected from the above sets)

# the above two parameters are set by compiling and installing MySQL to the character set. When not set, the default is latin1.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report