For the newly installed cacti, in order to detect the accuracy of the monitoring data, as well as with the rrdtool generated by the statistical map to the official show so beautiful, can not wait to click on the tab in the image of a column. The results of the following situation, that is, cacti generation with Chinese pictures have garbled. The RRDtool I installed is the 1.4.5 version.
In order to solve this problem, the Internet to check a pass.
RRDtool 1.4.5 Map Support Chinese method:
finally to solve, in fact, is rrdtool tool can not recognize Chinese. Because viewing RRDtool compiled source code, the default encoding is indeed empty ("C"). You can open the Src/rrd_graph.c file in the RRDtool folder. In line 3496:
The code is as follows |
Copy Code |
SetLocale (Lc_all, "C");
|
The default is null, and you can manually modify it directly to:
The code is as follows |
Copy Code |
SetLocale (Lc_all, "zh_cn.gb2312");
|
or use it in the RRDtool installation directory:
The code is as follows |
Copy Code |
Sed-i ' S/setlocale (lc_numeric, "C")/setlocale (Lc_all, "zh_cn.gb2312")/g ' src/rrd_graph.c
|
Both of these modification methods are OK. is to convert setlocale (lc_numeric, "C") to SetLocale (Lc_all, "Zh_cn.gb2312″").
The code is as follows |
Copy Code |
<span style= "LINE-HEIGHT:18PX;" >make </span> <span style= "LINE-HEIGHT:18PX;" > </span> <span style= "LINE-HEIGHT:18PX;" >MV./src/rrdtool/usr/local/rrdtool/bin/rrdtool </span>
|
Then copy the C:/WINDOWS/FONTS/SIMSUN.TTC in WINDOWS to the/usr/share/fonts/chinese/truetype/directory, and RRDtool can support Chinese.
CP C:/WINDOWS/FONTS/SIMSUN.TTC c:/
then go to/usr/share/fonts/chinese/truetype/in your own way.
then modify the cacti configuration file, set = "Path =" RRDtool default font path: