NagiosEnterprises / nrpe

NRPE Agent
GNU General Public License v2.0
263 stars 134 forks source link

Read from mysql generated garbled #167

Closed xuejipeng closed 7 years ago

xuejipeng commented 7 years ago

I wrote a plugin, read the Chinese characters from the mysql database, but read the results are '??????' my version is 3.1.1 I try to upgrade him to 3.2.1, or will happen the same Problem, but I dropped it to 2.1.2 when the problem is gone, this is the version of the problem or I use the problem?

hedenface commented 7 years ago

Back up a teensy bit, please.

Your version of what is 3.1.1? What are you upgrading to 3.2.1? And let's see your plugin.

xuejipeng commented 7 years ago

sorry.... my server is centos7.2 my nrpe version is 3.1.1 ,I installed nrpe 3.2.1 from another server I have a script in the sql statement as follows, it is implemented in the shell and through the implementation of the results of nrpe not the same

mysql -N -e" SELECT mac_attr FROM devbox.Anloq_equipments WHERE (eqp_name NOT LIKE'呵呵%' AND eqp_name NOT LIKE '哈哈%') AND is_deleted=0 "

jomann09 commented 7 years ago

You may have to set your charset to utf-8 when you connect to mysql, how are you connecting to it?

xuejipeng commented 7 years ago

Ok i solved this problem and I added it in the configuration file [client] default-character-set = utf8

[mysql] default-character-set = utf8

thank you very much! sorry for my stupid

jomann09 commented 7 years ago

Awesome, glad that solved your issue. Feel free to make another if you have any other problems.