Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: UnicodeDecodeError with link_vmware_host_vm.py

  1. #1
    Junior Member
    Join Date
    Feb 2013
    Posts
    6

    UnicodeDecodeError with link_vmware_host_vm.py

    Hi everyone,

    I need your help regarding the setup of VMWare_auto_linking module.

    In fact, when I try to run the script from the command line :

    Code:
    /opt/shinken/libexec/link_vmware_host_vm.py -x '/opt/shinken/libexec/check_esx3.pl' -V 'xxx.xxx.xxx.xxx' -u 'xxxxxx\shinken' -p 'xxxxxxxx' -r 'lower|nofqdn' -o /tmp/vmware_mapping_file.json
    I get the following output :

    Code:
    Listing host esx03.hmc-pa.adm
    Listing host esx07.xxx-xx.xxx
    Listing host esx04.xxx-xx.xxx
    Listing host esx05.xxx-xx.xxx
    Listing host esx06.xxx-xx.xxx
    Listing host esx08.xxx-xx.xxx
    Created 77 links
    Traceback (most recent call last):
     File "/opt/shinken/libexec/link_vmware_host_vm.py", line 186, in <module>
      main(**opts.__dict__)
     File "/opt/shinken/libexec/link_vmware_host_vm.py", line 144, in main
      write_output(r, output)
     File "/opt/shinken/libexec/link_vmware_host_vm.py", line 122, in write_output
      buf = json.dumps(r)
     File "/usr/lib/python2.6/json/__init__.py", line 230, in dumps
      return _default_encoder.encode(obj)
     File "/usr/lib/python2.6/json/encoder.py", line 367, in encode
      chunks = list(self.iterencode(o))
     File "/usr/lib/python2.6/json/encoder.py", line 306, in _iterencode
      for chunk in self._iterencode_list(o, markers):
     File "/usr/lib/python2.6/json/encoder.py", line 204, in _iterencode_list
      for chunk in self._iterencode(value, markers):
     File "/usr/lib/python2.6/json/encoder.py", line 306, in _iterencode
      for chunk in self._iterencode_list(o, markers):
     File "/usr/lib/python2.6/json/encoder.py", line 204, in _iterencode_list
      for chunk in self._iterencode(value, markers):
     File "/usr/lib/python2.6/json/encoder.py", line 306, in _iterencode
      for chunk in self._iterencode_list(o, markers):
     File "/usr/lib/python2.6/json/encoder.py", line 204, in _iterencode_list
      for chunk in self._iterencode(value, markers):
     File "/usr/lib/python2.6/json/encoder.py", line 294, in _iterencode
      yield encoder(o)
    UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 27: invalid continuation byte
    I think I understand it's an encoding problem, but I dont know where.

    Does someone has already encountered this problem and can help me?

    Thank you all in advance.

    PS : I work with the version 1.2.4 of shinken on debian 6 x64.

    PPS : Sorry for my very bad english, i'm french

  2. #2
    Junior Member
    Join Date
    Feb 2013
    Posts
    6

    Re: UnicodeDecodeError with link_vmware_host_vm.py

    I just did some tests and I think I found where the problem originates.

    When i launch :

    Code:
    /opt/shinken/libexec/check_esx3.pl -D xxx.xxx.xxx.xxx -H esx01..xxx-xx.xxx -u 'xxxxxx\shinken' -p xxxxxxx -l runtime -s list
    The script displays a result with incorrect characters :

    Code:
    MYSQL Centralis?(OK)
    It seems that the script does not like accents.

    Is there any way to fix this without rename virtual machines?

  3. #3
    Shinken project leader
    Join Date
    May 2011
    Location
    Bordeaux (France)
    Posts
    2,130

    Re: UnicodeDecodeError with link_vmware_host_vm.py

    You means your VM got é in their names?
    No direct support by personal message. Please open a thread so everyone can see the solution

  4. #4
    Junior Member
    Join Date
    Feb 2013
    Posts
    6

    Re: UnicodeDecodeError with link_vmware_host_vm.py

    [quote author=naparuba link=topic=783.msg4362#msg4362 date=1361450986]
    You means your VM got é in their names?
    [/quote]

    Yes it is

    Here, the name of the Virtual Machine is "XXX-XXX - PROD - MYSQL Centralisé". The script outputs "XXX-XXX - PROD - MYSQL Centralis?".

  5. #5
    Shinken project leader
    Join Date
    May 2011
    Location
    Bordeaux (France)
    Posts
    2,130

    Re: UnicodeDecodeError with link_vmware_host_vm.py

    Can you try to launch:
    Code:
    export LANG=en_US.UTF-8
    Before running the script? If not work, the script will need some dev to fix it
    No direct support by personal message. Please open a thread so everyone can see the solution

  6. #6
    Junior Member
    Join Date
    Feb 2013
    Posts
    6

    Re: UnicodeDecodeError with link_vmware_host_vm.py

    Same problem unfortunately :

    Code:
    export LANG=en_US.UTF-8
    root@shinken:~# /opt/shinken/libexec/check_esx3.pl -D xxx.xxx.xxx.xxx -H esx07.xxx-xx.xxx -u 'XXX-XXX.XXX\shinken' -p xxxxxxxx -l runtime -s list
    perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_US.UTF-8"
      are supported and installed on your system.
    perl: warning: Falling back to the standard locale ("C").
    Code:
    XXX-XXX - PROD - MYSQL Centralis?(OK)
    :'(

  7. #7
    Shinken project leader
    Join Date
    May 2011
    Location
    Bordeaux (France)
    Posts
    2,130

    Re: UnicodeDecodeError with link_vmware_host_vm.py

    Installes les locales UTF8.EN_US sur ton serveur de supervision, qui seront de toute manière nécessaires à un bon fonctionnement de Shinken côté daemon. Je me demande même si on ne devrait pas le mettre par défaut à l'installation de Shinken, et forcer cette locale globalement.
    No direct support by personal message. Please open a thread so everyone can see the solution

  8. #8
    Junior Member
    Join Date
    Feb 2013
    Posts
    6

    Re: UnicodeDecodeError with link_vmware_host_vm.py

    Je n'ai plus d'erreur au lancement du script :

    Code:
    export LANG=en_US.UTF-8
    /opt/shinken/libexec/check_esx3.pl -D xxx.xxx.xxx.xxx -H esx07.xxx-xx.xxx -u 'XXX-XX.XXX\shinken' -p xxxxxxxxxx -l runtime -s list
    Mais j'ai toujours le souci d'encodage des accents :

    Code:
    CHECK_ESX3.PL OK - 22/24 VMs up: [...] HBG-PA09 - PROD - MYSQL Centralis?(OK) [...] | vmcount=22units;;
    Je commence à craindre que le problème ne vienne du script d'OP5, auquel cas j'ai peur que seuls ces derniers ne puissent corriger ce souci.

    [hr]

    I have no more errors in the beginning of script :

    Code:
    export LANG=en_US.UTF-8
    /opt/shinken/libexec/check_esx3.pl -D xxx.xxx.xxx.xxx -H esx07.xxx-xx.xxx -u 'XXX-XX.XXX\shinken' -p xxxxxxxxxx -l runtime -s list
    But I still have issue with encoding :

    Code:
    CHECK_ESX3.PL OK - 22/24 VMs up: [...] HBG-PA09 - PROD - MYSQL Centralis?(OK) [...] | vmcount=22units;;
    I begin to fear that the issue comes from the OP5's script, in which case I'm afraid that They are only ones that can correct the problem.



    PS : Merci Jean pour Shinken qui est une magistrale démonstration de ce que peut être un logiciel libre.
    Tu as simplifié ma vie d'admin , je ne jure plus que par lui pour la supervision. :-*

  9. #9
    Shinken project leader
    Join Date
    May 2011
    Location
    Bordeaux (France)
    Posts
    2,130

    Re: UnicodeDecodeError with link_vmware_host_vm.py

    Check your shell encoding (putty?). Put it in UTF8 and look if the value is still "strange". But maybe it's the vSphere encoding/check_esx3.pl that got a problem with this, and so yes, we will have a problem to solve it

    And you're welcome
    No direct support by personal message. Please open a thread so everyone can see the solution

  10. #10
    Junior Member
    Join Date
    Feb 2013
    Posts
    6

    Re: UnicodeDecodeError with link_vmware_host_vm.py

    Yes, my shell (putty) is already in UTF8.

    So, as you said, i have a problem...

    Does the check_esx3.pl version installed with Shinken is the last one ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •