Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

non-ASCII character in service name is perhaps tripping up the api/services requests #1221

Open
iszl-mt opened this issue Oct 30, 2024 · 1 comment

Comments

@iszl-mt
Copy link

iszl-mt commented Oct 30, 2024

NCPA 3.1.1 on Windows Server 2019

  • Using the web GUI and looking at api/services results in three-dots and no service content loading
  • In Nagios, the following status is returned for all service running checks for this server: "UNKNOWN: An error occurred connecting to API. (HTTP error: '500 INTERNAL SERVER ERROR')"
  • the offending service seems to have a non-ASCII character in both the Service Name and the Display Name
  • logs from the ncpa_listener log file are below ("example.com" replaces the real server name)

image

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "flask\app.py", line 1473, in wsgi_app
File "flask\app.py", line 882, in full_dispatch_request
File "flask\app.py", line 880, in full_dispatch_request
File "flask\app.py", line 865, in dispatch_request
File "listener\server.py", line 317, in token_auth_decoration
File "listener\server.py", line 1507, in api
File "listener\services.py", line 354, in run_check
File "listener\services.py", line 18, in wrapper
File "listener\services.py", line 112, in get_services_via_psutil
File "psutil_pswindows.py", line 628, in status
File "psutil_pswindows.py", line 558, in _query_status
File "contextlib.py", line 158, in exit
File "psutil_pswindows.py", line 583, in _wrap_exceptions
psutil.NoSuchProcess: service 'SNAP Live²' does not exist (name='SNAP Live²')
2024-10-30 15:26:53,115 listener INFO before_request() - request.url: https://snaps:5693/api/disk/logical/C:|/used_percent/?token=********&warning=80&critical=90&check=1
2024-10-30 15:27:11,553 listener INFO before_request() - request.url: https://snaps:5693/api/cpu/count/?token=********&check=1
2024-10-30 15:27:32,803 listener INFO before_request() - request.url: https://snaps:5693/api/system/version/?token=********&check=1
2024-10-30 15:27:33,897 listener INFO Did not receive normal values. Unable to find meaningful check.
2024-10-30 15:27:49,834 listener INFO before_request() - request.url: https://example.com:5693/gui/
2024-10-30 15:27:54,084 listener INFO before_request() - request.url: https://example.com:5693/gui/checks
2024-10-30 15:27:58,194 listener INFO before_request() - request.url: https://example.com:5693/gui/api
2024-10-30 15:27:58,412 listener INFO before_request() - request.url: https://example.com:5693/api
2024-10-30 15:28:01,397 listener INFO before_request() - request.url: https://example.com:5693/api/services
2024-10-30 15:28:01,491 listener.server ERROR Exception on /api/services [GET]
Traceback (most recent call last):
File "psutil_pswindows.py", line 570, in _wrap_exceptions
File "psutil_pswindows.py", line 559, in _query_status
OSError: [WinError 1060] The specified service does not exist as an installed service: '(originated from OpenService)'

@ne-bbahn
Copy link
Contributor

NCPA was built to support any UTF-8 characters (a superset of ASCII), so NCPA will likely break if non-UTF-8 characters are used for checks. That said, the ² character is within UTF-8, so it shouldn't be breaking things unless there is an encoding issue. I will investigate when I get the opportunity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants