Cacti (RRDTOOL) Chinese garbled text and statistical graph garbled problem solution

Source: Internet
Author: User
Tags rrdtool
For the installed Cacti, to check whether the monitoring data is accurate and whether the statistical chart generated with rrdtool is as beautiful as officially shown, you can't wait to click the image column on the tab. The result is garbled, that is, Cacti generates a graph with Chinese characters.

The rrdtool I installed is 1.4.5. To solve this problem, I checked it online.

Rrdtool 1.4.5 supports the Chinese method for plotting:
Finally, the solution is solved. In fact, RRDTOOL cannot recognize Chinese characters. Because the source code compiled by rrdtool is checked, the default encoding is indeed empty ("C "). You can open the src/rrd_graph.c file in the rrdtool folder. In row 3:

Copy codeThe code is as follows: setlocale (LC_ALL, "C ");
The default value is null. you can manually change it:

Copy codeThe code is as follows: setlocale (LC_ALL, "zh_CN.gb2312 ");
Or use the following command in the rrdtool installation directory:

Copy codeThe code is as follows:
Sed-I's/setlocale (LC_NUMERIC, "C")/setlocale (LC_ALL, "zh_CN.gb2312")/g' src/rrd_graph.c

Both methods can be modified. It is to change setlocale (LC_NUMERIC, "C") to setlocale (LC_ALL, "zh_CN.gb2312 ″).

Copy codeThe code is as follows:
Make
Mv./src/rrdtool/usr/local/rrdtool/bin/rrdtool

Copy C: \ windows \ Fonts \ simsun. ttc in WINDOWS to the/usr/share/fonts/chinese/TrueType/Directory. rrdtool supports chinese characters.

Copy codeThe code is as follows: cp C: \ WINDOWS \ Fonts \ simsun. ttc C :\
Then, upload it to/usr/share/fonts/chinese/TrueType/in your own method.
Next, modify the Cacti configuration file and set = path = RRDTool's default font path:

Then we can see the following statistical chart without garbled characters:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.