Navigation

    Kopano
    • Register
    • Login
    • Search
    • Categories
    • Get Official Kopano Support
    • Recent
    Statement regarding the closure of the Kopano community forum and the end of the community edition

    kopano-cachestat not working

    Scripting
    1
    1
    301
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • sultansofswing
      sultansofswing last edited by

      Hi, I’m using Kopano 8.7.5 (UCS integration). Upgraded from 8.7.1. Since upgrade, monitoring by a self-written check_mk plugin does not return any data.
      Analyzed it and found that check_mk agent clears locale data on invocation:

      unset LANG
      export LC_ALL=C
      

      calling kopano-cachestat this way returns:

      root@hostname:/usr/lib/check_mk_agent/local# LANG= LC_ALL=C /usr/sbin/kopano-cachestat
      Traceback (most recent call last):
        File "/usr/sbin/kopano-cachestat", line 18, in <module>
          server = kopano.Server(options=options, auth_user='SYSTEM', auth_pass='')
        File "/usr/lib/python3/dist-packages/kopano/server.py", line 241, in __init__
          config = _config.Config(None, filename=config_file)
        File "/usr/lib/python3/dist-packages/kopano/config.py", line 103, in __init__
          self._parse_config(fh)
        File "/usr/lib/python3/dist-packages/kopano/config.py", line 115, in _parse_config
          for line in fh:
        File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
          return codecs.ascii_decode(input, self.errors)[0]
      UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 193: ordinal not in range(128)
      

      Looking into kopano-cachestat I found that the third column of the query

      table = server.table(PR_EC_STATSTABLE_SYSTEM, columns=[PR_DISPLAY_NAME_W, PR_EC_STATS_SYSTEM_VALUE, PR_EC_STATS_SYSTEM_DESCRIPTION])
      

      returns localized strings (the server is set up in de_DE.UTF-8 locale) even in the absence of LANG, and LC_ALL=C. I would propose stripping the third column from the query, given that it is not processed in any way:

      for row in table.rows():
          name, value, _ = row
      

      (and the ‘_’ variable not used anywhere in the script). With the proposed changes, the script starts working again under the given environment.

      Regards, sultansofswing.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post