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: