unioslo / zabbix-cli

Command-line interface for Zabbix
https://unioslo.github.io/zabbix-cli/
GNU General Public License v3.0
201 stars 101 forks source link

[ERROR]:cannot concatenate 'str' and 'exceptions.UnicodeEncodeError' objects #122

Open fauust opened 4 years ago

fauust commented 4 years ago

Hi! First of all, thank you for this great tool!

I am facing a problem when I export template items into a CSV file. Zabbix command-line interface: v2.2.1 Zabbix Version: v4.4.7 Template : official (Template OS Windows by Zabbix agent active).

Here is the command I used:

zabbix-cli -C "show_items \"Template OS Windows by Zabbix agent active\"" >template.txt
zabbix-cli -o csv -C "show_items \"Template OS Windows by Zabbix agent active\"" >template.csv
zabbix-cli -o json -C "show_items \"Template OS Windows by Zabbix agent active\"" >template.json

Here are the exported files: https://paste.debian.net/1141865/ (txt) https://paste.debian.net/1141864/ (csv) https://paste.debian.net/1141863/ (json)

Only the json export seems to work.

The same happens when "piping" the output into less for instance:

zabbix-cli -C "show_items \"Template OS Windows by Zabbix agent active\"" | less

Without redirection in a file (or using a pipe), the export works perfectly on all the output formats.

I can't understand if

Any help really appreciated!

paalbra commented 4 years ago

@fauust Your using exactly this template? https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/os/windows_agent_active/template_os_windows_agent_active.xml

What version of python? What OS are you on? And what's your locale? (it might be useful to know)

fauust commented 4 years ago

Hi @paalbra, yes this is the template I am using and here comes the information requested.

❯ cat /etc/debian_version && uname -a && python -V && env | grep LANG                                    
10.3
Linux laptop 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u2 (2019-11-11) x86_64 GNU/Linux
Python 2.7.16
LANGUAGE=en_US:en
LANG=en_US.UTF-8
fauust commented 3 years ago

Hi! FYI I can't reproduce this anymore on Zabbix 5.0.11 API.