Midclt remotely

I would like to use midclt to create nagios health checks.
Midclt works fine on the server but not remotely
http → https redirect is enabled, If disabled I have the same error only the ValueError changes to “scheme http is invalid”

midclt -U nagios -P test --uri ws://10.10.10.10/websocket call system.info
Websocket client error: ValueError('scheme https is invalid')
Traceback (most recent call last):
  File "/home/nagios/truenas_api_client/truenas_api_client/bin/midclt", line 33, in <module>
    sys.exit(load_entry_point('truenas-api-client==0.0.0', 'console_scripts', 'midclt')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nagios/truenas_api_client/truenas_api_client/lib64/python3.11/site-packages/truenas_api_client/__init__.py", line 895, in main 
    with Client(uri=args.uri) as c:
         ^^^^^^^^^^^^^^^^^^^^
  File "/home/nagios/truenas_api_client/truenas_api_client/lib64/python3.11/site-packages/truenas_api_client/__init__.py", line 93, in __init__
    self.__client = client_class(uri, reserved_ports, py_exceptions, log_py_exceptions, call_timeout, verify_ssl)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nagios/truenas_api_client/truenas_api_client/lib64/python3.11/site-packages/truenas_api_client/legacy.py", line 230, in __init__
    raise ClientException(self._connection_error)
truenas_api_client.exc.ClientException: WebSocket connection closed with code=None, reason=None

What version of TrueNAS are you trying to communicate with?

midclt call system.info | jq '.version'
"TrueNAS-SCALE-24.10.0.2"

Solved, after testing with an app key ( -K ) and password reset (same password)

1 Like