[ZBX-14410] Invalid byte sequence for encoding "UTF8": 0xa1 Created: 2018 May 29  Updated: 2024 Apr 10  Resolved: 2018 Aug 09

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: None
Fix Version/s: 3.0.20rc1, 3.4.12rc1, 4.0.0alpha9, 4.0 (plan)

Type: Problem report Priority: Trivial
Reporter: Albertsalva Assignee: Michael Veksler
Resolution: Fixed Votes: 0
Labels: calculateditems, lld
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File error.png    
Team: Team A
Team: Team A
Sprint: Sprint 36, Sprint 37, Sprint 39, Sprint 40
Story Points: 0.5

 Description   

Hi, 

I'm getting this issue in my Zabbix but I couldn't find some way to troubleshoot this issue,

I attach the log that I'm getting anytime:

10955:20180518:074213.367 [Z3005] query failed: [0] PGRES_FATAL_ERROR:ERROR: invalid byte sequence for encoding "UTF8": 0xa1
[update items set error='Cannot create item: ¡Ÿ­Ì.
Cannot create item: ¡Ÿ­Ì.
Cannot create item: ¡Ÿ­Ì.
Cannot create item: ¡Ÿ­Ì.
Cannot create item: ¡Ÿ­Ì.
Cannot create item: ¡Ÿ­Ì.
Cannot create item: ¡Ÿ­Ì.
Cannot create item: ¡Ÿ­Ì.
Cannot create item: ¡Ÿ­Ì.
Cannot create item: ¡Ÿ­Ì.
Cannot create item: ¡Ÿ­Ì.
Cannot create item: ¡Ÿ­Ì.
Cannot create item: ¡Ÿ­Ì.
Cannot create item: ¡Ÿ­Ì.
Cannot create item: ¡Ÿ­Ì.
' where itemid=128094]

Best regards,



 Comments   
Comment by Aigars Kadikis [ 2018 May 29 ]

Hello, Albertsalva

Please authorize in MySQL and show the charset and collation of the database 'zabbix' :

SELECT SCHEMA_NAME 'database', default_character_set_name 'charset', DEFAULT_COLLATION_NAME 'collation' FROM information_schema.SCHEMATA\G

Regards,

Comment by Albertsalva [ 2018 May 29 ]

Hi, It's Postgres Database 9.3

I think I should change the client encoding parameter but not sure because if I type SHOW client_encoding; looks like utf8

List of databases
Name | Owner | Encoding | Collate | Ctype |
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
zabbix | zabbix | UTF8 | en_US.UTF-8 | en_US.UTF-8 |

17707:20180529:081413.718 [Z3005] query failed: [0] PGRES_FATAL_ERROR:ERROR: invalid byte sequence for encoding "UTF8": 0xa1

postgres=# SHOW client_encoding;
client_encoding
-----------------
UTF8
(1 row)
postgres=#

Inside the file /etc/postgresql/9.3/main/postgresql.conf I can see that parameters looks like default:

#client_encoding = sql_ascii # actually, defaults to database

  1. encoding
  1. These settings are initialized by initdb, but they can be changed.
    lc_messages = 'en_US.UTF-8' # locale for system error message
  2. strings
    lc_monetary = 'en_US.UTF-8' # locale for monetary formatting
    lc_numeric = 'en_US.UTF-8' # locale for number formatting
    lc_time = 'en_US.UTF-8' # locale for time formatting
Comment by Elina Kuzyutkina (Inactive) [ 2018 May 29 ]

Hello, Albertsalva

What value of default_charset you have in php.ini?

Regards,

Elina

Comment by Albertsalva [ 2018 May 29 ]

Hi,

It's the default in php.in

; PHP's default character set is set to empty.
; http://php.net/default-charset
;default_charset = "UTF-8"

Comment by Elina Kuzyutkina (Inactive) [ 2018 May 29 ]

What Zabbix version do you use?

This error happens when you create a specific item or any? (possibly you can provide screenshot?)

Do you have some directive like override_charset in nginx or AddDefaultCharset in apache?

Regards,

Elina

Comment by Albertsalva [ 2018 May 29 ]

Hi, 

I'm using version 3.4.9 

I have hosts added, so any time is updating this error to var/log/zabbix_Server.log

Also, I don't  have some directive like override_charset in nginx or AddDefaultCharset in apache

root@zabbix:~# zabbix_server -V
zabbix_server (Zabbix) 3.4.9
Revision 80550 9 May 2018, compilation time: May 9 2018 10:06:19

Copyright (C) 2018 Zabbix SIA

Comment by Elina Kuzyutkina (Inactive) [ 2018 May 29 ]

I correctly understood that you get that error in your zabbix_server.log everytime you add any item to specific host?

Provide screenshot of your item configuration, please.

Regards,

Elina

Comment by Glebs Ivanovskis [ 2018 May 31 ]

Lowercase SQL queries are produced by server, not by frontend. I guess that

select flags from items where itemid=128094;

will reveal that this is a low-level discovery rule. Dear albertsalva, can you reveal a JSON this LLD rule is receiving before you get error messages?

Is caused by the fact that zbx_function_find() does not always provide an error message when it returns FAIL.

Steps to reproduce:

  1. Create LLD rule of type Zabbix trapper
  2. Create calculated item prototype with formula like
    ffjffjghfj
    
  3. Send LLD JSON:
    $ zabbix_sender -s host -k lld -o '{"data":[{"{#M}":"1"}]}'

Result:
Observe a funny error message like

Expected:
Server should produce a decent error message.

P.S. Ideally frontend/API should prevent creation of calculated items and item prototypes with invalid formulas.

Comment by Michael Veksler [ 2018 Jun 29 ]

Available in:

  • 3.0.20rc1 r82362
  • 3.4.12rc1 r82364
  • 4.0.0alpha9 (trunk) r82366
Generated at Tue Apr 16 19:59:54 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.