NagiosEnterprises / ncpa

Nagios Cross-Platform Agent
Other
177 stars 95 forks source link

utf8 problem on process check on german Windows Server #770

Open theMithyQuin opened 3 years ago

theMithyQuin commented 3 years ago

Hi,

my configuration

if I use the following command

C:\Daten\nagios>python check_ncpa.py -H myServerDE -t myToken -P 5693 -M processes -w 220 -c 250 -v
Connecting to: https://myServerDE :5693/api/processes/?token=myToken&warning=220&critical=250&check=1
An error occurred:
UNKNOWN: An error occured connecting to API. (HTTP error: '500 INTERNAL SERVER ERROR')

C:\Daten\nagios>python check_ncpa_ase.py -H myServerDE  -t myToken-P 5693 -M processes -w 220 -c 250 -v -l
Connecting to: https://myServerDE :5693/api/processes/?token=myToken
An error occurred:
'utf-8' codec can't decode byte 0xc4 in position 1116: invalid continuation byte

in the log on der Server I found

2021-05-15 09:33:52,441:ERROR:app:Exception on /api/processes/ [GET]
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\flask\app.py", line 1817, in wsgi_app
  File "C:\Python27\lib\site-packages\flask\app.py", line 1477, in full_dispatch_request
  File "C:\Python27\lib\site-packages\flask\app.py", line 1381, in handle_user_exception
  File "C:\Python27\lib\site-packages\flask\app.py", line 1475, in full_dispatch_request
  File "C:\Python27\lib\site-packages\flask\app.py", line 1461, in dispatch_request
  File "C:\ncpa\agent\listener\server.py", line 292, in token_auth_decoration
  File "C:\ncpa\agent\listener\server.py", line 1099, in api
  File "C:\ncpa\agent\listener\processes.py", line 420, in run_check
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 359: ordinal not in range(128)

I supose that the ncpa client hat a problem with "username" thät is "NT-AUTORITÄT\SYSTEM" { "username": "NT-AUTORIT�T\SYSTEM", "mem_percent": [ 0.45, "%" ], "exe": "Registry", "name": "Registry", "cpu_percent": [ 0.0, "%" ], "mem_vms": [ 0.01, "GB" ], "cmd": "Unknown", "pid": 124, "mem_rss": [ 0.08, "GB" ] },

ccztux commented 3 years ago

This is a known issue and should be fixed with version 3.0.0: