SSH Checks no longer works
Hello,
I have autosuspend running on a headless server, I run checks on SMB, SSH and check whether plex is playing a file.
The Plex check work and the server remains on while a file is being played and the SMB checks also works, however, the SSH check doesn't work anymore and the server shutdown when I am connected to it.
Below the result of '$ autosuspend -a' returning an error about subcommand and the config file.
$ autosuspend -a
usage: autosuspend [-h] [-c FILE] [-l FILE | -d] {version,daemon,presuspend} ...
autosuspend: error: the following arguments are required: subcommand
GNU nano 8.2 /etc/autosuspend.conf
## This is an exemplary documentation file that mainly serves as a syntax explanation.
## For a list of available options and checks, please refer to `man autosuspend.conf` or the online documentation.
[general]
interval = 300
idle_time = 90
#interval = 5
#idle_time = 2
#suspend_cmd = echo failed
suspend_cmd = /usr/bin/systemctl poweroff
wakeup_cmd = sh -c 'echo 0 > /sys/class/rtc/rtc0/wakealarm && echo {timestamp:.0f} > /sys/class/rtc/rtc0/wakealarm'
woke_up_file = /var/run/autosuspend-just-woke-up
lock_file = /var/lock/autosuspend.lock
lock_timeout = 300
# Can be used to call a command before suspending, either with scheduled wake up or not.
# notify_cmd_wakeup = su myuser -c notify-send -a autosuspend 'Suspending the system. Wake up at {iso}'
# notify_cmd_no_wakeup = su myuser -c notify-send -a autosuspend 'Suspending the system.'
# This check is disabled.
[check.Smb]
enabled = true
# Example for a custom check name.
# This will use the Users check with the custom name RemoteUsers.
# Custom names are necessary in case a check class is used multiple times.
# Custom names can also be used for clarification.
[check.RemoteUsers]
class = Users
enabled = true
name = .*
terminal = .*
host = [0-9].*
# Check PyLoad
[check.ExternalCommand]
enabled = true
command = sh /home/sweetth/autosuspend_script/pyload_autosuspend.sh
# Checks to determine Plex-Media-Server activity
[check.Plex-Media-Server]
class = XPath
enabled = true
url = http://127.0.0.1:32400/status/sessions?X-Plex-Token=uhAnKcne6vRwJ2bs9m7a
xpath = /MediaContainer[@size > 0]
# Check Jellyfin
#[check.JsonPath]
#enabled = true
#url = http://127.0.0.1:8096/Sessions?api_key=4d006f18c20247babdeaa8744777ed22
#jsonpath = [*].NowPlayingItem
# Apart from this, wake up checks reuse the same configuration mechanism.
autosuspend -a does not exists anymore since many versions. You need to use autosuspend daemon -a.
Hi,
thank you for your reply, see below the result - the system is up to date.
$ autosuspend daemon -a
Traceback (most recent call last):
File "/usr/bin/autosuspend", line 8, in <module>
sys.exit(main())
^^^^^^
File "/usr/lib/python3.12/site-packages/autosuspend/__init__.py", line 805, in main
args.func(args, config)
File "/usr/lib/python3.12/site-packages/autosuspend/__init__.py", line 787, in main_daemon
loop(
File "/usr/lib/python3.12/site-packages/autosuspend/__init__.py", line 377, in loop
_do_loop_iteration(processor, woke_up_file, lock_file, lock_timeout)
File "/usr/lib/python3.12/site-packages/autosuspend/__init__.py", line 331, in _do_loop_iteration
with portalocker.Lock(lock_file, timeout=lock_timeout):
File "/usr/lib/python3.12/site-packages/portalocker/utils.py", line 302, in __enter__
return self.acquire()
^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/portalocker/utils.py", line 256, in acquire
fh = self._get_fh()
^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/portalocker/utils.py", line 313, in _get_fh
return open( # noqa: SIM115
^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/var/lock/autosuspend.lock'
I suspect you usually run autosuspend via systemd as root and if you try that now as your normal user, you don't have permissions to some necessary files.
So please try again via sudo or as root.
Hi,
See below - it seems to only check for pyload and plex? Although, as mentioned above it works when there is a SMB connection.
$ sudo autosuspend daemon -a
[sudo] password for sweetth:
+ curl -c cookie.txt -d 'username=pyload&password=*****' http://192.168.1.90:8000/api/login
{"_permanent": true, "authenticated": true, "id": 1, "name": "pyload", "role": 0, "perms": 0, "template": "default", "_flashes": [["message", "Logged in successfully"]]}++ curl -b cookie.txt http://192.168.1.90:8000/api/statusServer
++ jq -r .active
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 122 100 122 0 0 55912 0 --:--:-- --:--:-- --:--:-- 61000
+ SessionStatus=0
+ '[' 0 -ge 1 ']'
+ exit 1
Is that all output?
In any case, if you are missing success for the SSH check, is there a chance that you now have IPv6 connectivity and your host pattern doesn't match?
Yes, that's all the output.
I am connecting to the server via ipv4 ssh connection - ssh [email protected]
Is your logging config redirecting autosuspend logs to a file? In that case, you probably find the log messages in that file.
Right,
I have just tested the server whilst being connected through SSH and below is the journalctl: at 13.48 it just boot, I am assuming all the errors are due to pyload and plex services not being starter quite yet. At 13.53 it's the 5 minutes mark that prompt the checks, there is no error or mentioned of the remote user checks.
$ journalctl -b -1 -u autosuspend.service
Oct 14 13:48:36 pbertol.duckdns.org systemd[1]: Started A daemon to suspend your server in case of inactivity.
Oct 14 13:48:36 pbertol.duckdns.org autosuspend[428]: 2024-10-14 13:48:36,726 - autosuspend - INFO - Configuring check Smb with class Smb from module autosuspend.checks.activity using config parameters {'enabled': 'true'}
Oct 14 13:48:36 pbertol.duckdns.org autosuspend[428]: 2024-10-14 13:48:36,943 - autosuspend - INFO - Configuring check RemoteUsers with class Users from module autosuspend.checks.activity using config parameters {'class': 'Users', 'ena>
Oct 14 13:48:36 pbertol.duckdns.org autosuspend[428]: 2024-10-14 13:48:36,943 - autosuspend - INFO - Configuring check ExternalCommand with class ExternalCommand from module autosuspend.checks.activity using config parameters {'enabled>
Oct 14 13:48:36 pbertol.duckdns.org autosuspend[428]: 2024-10-14 13:48:36,943 - autosuspend - INFO - Configuring check Plex-Media-Server with class XPath from module autosuspend.checks.activity using config parameters {'class': 'XPath'>
Oct 14 13:48:36 pbertol.duckdns.org autosuspend[428]: 2024-10-14 13:48:36,944 - autosuspend.Processor - INFO - Starting new check iteration
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[440]: + curl -c cookie.txt -d 'username=pyload&password=*******' http://192.168.1.90:8000/api/login
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[441]: % Total % Received % Xferd Average Speed Time Time Time Current
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[441]: Dload Upload Total Spent Left Speed
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[441]: [158B blob data]
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[441]: curl: (7) Failed to connect to 192.168.1.90 port 8000 after 0 ms: Could not connect to server
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: 2024-10-14 13:48:37,110 - autosuspend.Processor - WARNING - Check Plex-Media-Server[class=XPathActivity] failed. Ignoring...
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: Traceback (most recent call last):
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/site-packages/urllib3/connection.py", line 174, in _new_conn
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: conn = connection.create_connection(
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/site-packages/urllib3/util/connection.py", line 95, in create_connection
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: raise err
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/site-packages/urllib3/util/connection.py", line 85, in create_connection
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: sock.connect(sa)
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: ConnectionRefusedError: [Errno 111] Connection refused
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: During handling of the above exception, another exception occurred:
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: Traceback (most recent call last):
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/site-packages/urllib3/connectionpool.py", line 716, in urlopen
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: httplib_response = self._make_request(
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: ^^^^^^^^^^^^^^^^^^^
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/site-packages/urllib3/connectionpool.py", line 416, in _make_request
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: conn.request(method, url, **httplib_request_kw)
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/site-packages/urllib3/connection.py", line 244, in request
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: super(HTTPConnection, self).request(method, url, body=body, headers=headers)
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/http/client.py", line 1336, in request
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: self._send_request(method, url, body, headers, encode_chunked)
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/http/client.py", line 1382, in _send_request
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: self.endheaders(body, encode_chunked=encode_chunked)
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/http/client.py", line 1331, in endheaders
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: self._send_output(message_body, encode_chunked=encode_chunked)
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/http/client.py", line 1091, in _send_output
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: self.send(msg)
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/http/client.py", line 1035, in send
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: self.connect()
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/site-packages/urllib3/connection.py", line 205, in connect
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: conn = self._new_conn()
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: ^^^^^^^^^^^^^^^^
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/site-packages/urllib3/connection.py", line 186, in _new_conn
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: raise NewConnectionError(
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x744d872ba690>: Failed to establish a new connection: [Errno 111] Connection refused
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: During handling of the above exception, another exception occurred:
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: Traceback (most recent call last):
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/site-packages/requests/adapters.py", line 667, in send
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: resp = conn.urlopen(
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: ^^^^^^^^^^^^^
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/site-packages/urllib3/connectionpool.py", line 802, in urlopen
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: retries = retries.increment(
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: ^^^^^^^^^^^^^^^^^^
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/site-packages/urllib3/util/retry.py", line 594, in increment
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: raise MaxRetryError(_pool, url, error or ResponseError(cause))
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /status/sessions?X-Plex-Token=uhAnKcne6vRwJ2bs9m7a (Caused by NewC>
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: During handling of the above exception, another exception occurred:
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: Traceback (most recent call last):
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/site-packages/autosuspend/checks/util.py", line 100, in request
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: reply = session.get(
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: ^^^^^^^^^^^^
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/site-packages/requests/sessions.py", line 602, in get
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: return self.request("GET", url, **kwargs)
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: resp = self.send(prep, **send_kwargs)
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: r = adapter.send(request, **kwargs)
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/site-packages/requests/adapters.py", line 700, in send
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: raise ConnectionError(e, request=request)
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /status/sessions?X-Plex-Token=uhAnKcne6vRwJ2bs9m7a (Caused by N>
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: The above exception was the direct cause of the following exception:
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: Traceback (most recent call last):
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/site-packages/autosuspend/__init__.py", line 119, in _safe_execute_activity
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: return check.check()
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: ^^^^^^^^^^^^^
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/site-packages/autosuspend/checks/xpath.py", line 59, in check
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: if self.evaluate():
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: ^^^^^^^^^^^^^^^
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/site-packages/autosuspend/checks/xpath.py", line 44, in evaluate
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: reply = self.request().content
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: ^^^^^^^^^^^^^^
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: File "/usr/lib/python3.12/site-packages/autosuspend/checks/util.py", line 119, in request
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: raise TemporaryCheckError(error) from error
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: autosuspend.checks.TemporaryCheckError: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /status/sessions?X-Plex-Token=uhAnKcne6vRwJ2bs9m7a (Caused b>
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: 2024-10-14 13:48:37,113 - autosuspend.Processor - INFO - System is idle since 2024-10-14 12:48:36.944330+00:00
Oct 14 13:48:37 pbertol.duckdns.org autosuspend[428]: 2024-10-14 13:48:37,114 - autosuspend.Processor - INFO - Desired idle time of 90.0 s not reached yet. Currently idle since 0.0 s
Oct 14 13:53:37 pbertol.duckdns.org autosuspend[428]: 2024-10-14 13:53:37,114 - autosuspend.Processor - INFO - Starting new check iteration
Oct 14 13:53:37 pbertol.duckdns.org autosuspend[655]: + curl -c cookie.txt -d 'username=pyload&password=******' http://192.168.1.90:8000/api/login
Oct 14 13:53:37 pbertol.duckdns.org autosuspend[656]: % Total % Received % Xferd Average Speed Time Time Time Current
Oct 14 13:53:37 pbertol.duckdns.org autosuspend[656]: Dload Upload Total Spent Left Speed
Oct 14 13:53:37 pbertol.duckdns.org autosuspend[656]: [158B blob data]
Oct 14 13:53:37 pbertol.duckdns.org autosuspend[656]: {"_permanent": true, "authenticated": true, "id": 1, "name": "pyload", "role": 0, "perms": 0, "template": "default", "_flashes": [["message", "Logged in successfully"]]}
Oct 14 13:53:37 pbertol.duckdns.org autosuspend[658]: ++ curl -b cookie.txt http://192.168.1.90:8000/api/statusServer
Oct 14 13:53:37 pbertol.duckdns.org autosuspend[659]: ++ jq -r .active
Oct 14 13:53:37 pbertol.duckdns.org autosuspend[658]: % Total % Received % Xferd Average Speed Time Time Time Current
Oct 14 13:53:37 pbertol.duckdns.org autosuspend[658]: Dload Upload Total Spent Left Speed
Oct 14 13:53:37 pbertol.duckdns.org autosuspend[658]: [158B blob data]
Oct 14 13:53:37 pbertol.duckdns.org autosuspend[655]: + SessionStatus=0
Oct 14 13:53:37 pbertol.duckdns.org autosuspend[655]: + '[' 0 -ge 1 ']'
Oct 14 13:53:37 pbertol.duckdns.org autosuspend[655]: + exit 1
Oct 14 13:53:37 pbertol.duckdns.org autosuspend[428]: 2024-10-14 13:53:37,255 - autosuspend.Processor - INFO - System is idle since 2024-10-14 12:48:36.944330+00:00
Oct 14 13:53:37 pbertol.duckdns.org autosuspend[428]: 2024-10-14 13:53:37,255 - autosuspend.Processor - INFO - System is idle long enough.
Oct 14 13:53:37 pbertol.duckdns.org autosuspend[428]: 2024-10-14 13:53:37,255 - autosuspend.Processor - INFO - Going to suspend. Resetting state
Oct 14 13:53:37 pbertol.duckdns.org autosuspend[428]: 2024-10-14 13:53:37,255 - autosuspend - INFO - No suitable notification command configured.
Oct 14 13:53:37 pbertol.duckdns.org autosuspend[428]: 2024-10-14 13:53:37,255 - autosuspend - INFO - Suspending using command: /usr/bin/systemctl poweroff with next wake up at None
Oct 14 13:53:37 pbertol.duckdns.org systemd[1]: Stopping A daemon to suspend your server in case of inactivity...
Oct 14 13:53:37 pbertol.duckdns.org systemd[1]: autosuspend.service: Deactivated successfully.
Oct 14 13:53:37 pbertol.duckdns.org systemd[1]: Stopped A daemon to suspend your server in case of inactivity.
Oct 14 13:53:37 pbertol.duckdns.org systemd[1]: autosuspend.service: Consumed 386ms CPU time, 87.4M memory peak.
The pasted log has cut off long lines. I can't verify the config of the checks being used here.
That should include all the details:
Thank you for your assistance
Oct 14 14:38:55 pbertol.duckdns.org systemd[1]: Started A daemon to suspend your server in case of inactivity.
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: 2024-10-14 14:38:55,577 - autosuspend - INFO - Configuring check Smb with class Smb from module autosuspend.checks.activity using config parameters {'enabled': 'true'}
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: 2024-10-14 14:38:55,799 - autosuspend - INFO - Configuring check RemoteUsers with class Users from module autosuspend.checks.activity using config parameters {'class': 'Users', 'enabled': 'true', 'name': '.*', 'terminal': '.*', 'host': '[0-9].*'}
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: 2024-10-14 14:38:55,800 - autosuspend - INFO - Configuring check ExternalCommand with class ExternalCommand from module autosuspend.checks.activity using config parameters {'enabled': 'true', 'command': 'sh /home/sweetth/autosuspend_script/pyload_autosuspend.sh'}
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: 2024-10-14 14:38:55,800 - autosuspend - INFO - Configuring check Plex-Media-Server with class XPath from module autosuspend.checks.activity using config parameters {'class': 'XPath', 'enabled': 'true', 'url': 'http://127.0.0.1:32400/status/sessions?X-Plex-Token=uhAnKcne6vRwJ2bs9m7a', 'xpath': '/MediaContainer[@size > 0]'}
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: 2024-10-14 14:38:55,800 - autosuspend.Processor - INFO - Starting new check iteration
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[442]: + curl -c cookie.txt -d 'username=pyload&password=******' http://192.168.1.90:8000/api/login
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[443]: % Total % Received % Xferd Average Speed Time Time Time Current
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[443]: Dload Upload Total Spent Left Speed
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[443]: [158B blob data]
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[443]: curl: (7) Failed to connect to 192.168.1.90 port 8000 after 0 ms: Could not connect to server
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: 2024-10-14 14:38:55,973 - autosuspend.Processor - WARNING - Check Plex-Media-Server[class=XPathActivity] failed. Ignoring...
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: Traceback (most recent call last):
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/urllib3/connection.py", line 174, in _new_conn
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: conn = connection.create_connection(
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/urllib3/util/connection.py", line 95, in create_connection
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: raise err
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/urllib3/util/connection.py", line 85, in create_connection
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: sock.connect(sa)
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: ConnectionRefusedError: [Errno 111] Connection refused
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: During handling of the above exception, another exception occurred:
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: Traceback (most recent call last):
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/urllib3/connectionpool.py", line 716, in urlopen
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: httplib_response = self._make_request(
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^^^^^^^^
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/urllib3/connectionpool.py", line 416, in _make_request
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: conn.request(method, url, **httplib_request_kw)
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/urllib3/connection.py", line 244, in request
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: super(HTTPConnection, self).request(method, url, body=body, headers=headers)
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/http/client.py", line 1336, in request
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: self._send_request(method, url, body, headers, encode_chunked)
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/http/client.py", line 1382, in _send_request
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: self.endheaders(body, encode_chunked=encode_chunked)
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/http/client.py", line 1331, in endheaders
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: self._send_output(message_body, encode_chunked=encode_chunked)
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/http/client.py", line 1091, in _send_output
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: self.send(msg)
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/http/client.py", line 1035, in send
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: self.connect()
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/urllib3/connection.py", line 205, in connect
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: conn = self._new_conn()
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^^^^^
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/urllib3/connection.py", line 186, in _new_conn
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: raise NewConnectionError(
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x745b0e87b860>: Failed to establish a new connection: [Errno 111] Connection refused
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: During handling of the above exception, another exception occurred:
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: Traceback (most recent call last):
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/requests/adapters.py", line 667, in send
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: resp = conn.urlopen(
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^^
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/urllib3/connectionpool.py", line 802, in urlopen
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: retries = retries.increment(
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^^^^^^^
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/urllib3/util/retry.py", line 594, in increment
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: raise MaxRetryError(_pool, url, error or ResponseError(cause))
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /status/sessions?X-Plex-Token=uhAnKcne6vRwJ2bs9m7a (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x745b0e87b860>: Failed to establish a new connection: [Errno 111] Connection refused'))
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: During handling of the above exception, another exception occurred:
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: Traceback (most recent call last):
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/autosuspend/checks/util.py", line 100, in request
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: reply = session.get(
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/requests/sessions.py", line 602, in get
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: return self.request("GET", url, **kwargs)
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: resp = self.send(prep, **send_kwargs)
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: r = adapter.send(request, **kwargs)
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/requests/adapters.py", line 700, in send
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: raise ConnectionError(e, request=request)
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /status/sessions?X-Plex-Token=uhAnKcne6vRwJ2bs9m7a (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x745b0e87b860>: Failed to establish a new connection: [Errno 111] Connection refused'))
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: The above exception was the direct cause of the following exception:
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: Traceback (most recent call last):
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/autosuspend/__init__.py", line 119, in _safe_execute_activity
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: return check.check()
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^^
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/autosuspend/checks/xpath.py", line 59, in check
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: if self.evaluate():
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^^^^
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/autosuspend/checks/xpath.py", line 44, in evaluate
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: reply = self.request().content
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^^^
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/autosuspend/checks/util.py", line 119, in request
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: raise TemporaryCheckError(error) from error
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: autosuspend.checks.TemporaryCheckError: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /status/sessions?X-Plex-Token=uhAnKcne6vRwJ2bs9m7a (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x745b0e87b860>: Failed to establish a new connection: [Errno 111] Connection refused'))
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: 2024-10-14 14:38:55,976 - autosuspend.Processor - INFO - System is idle since 2024-10-14 13:38:55.800583+00:00
Oct 14 14:38:55 pbertol.duckdns.org autosuspend[430]: 2024-10-14 14:38:55,976 - autosuspend.Processor - INFO - Desired idle time of 90.0 s not reached yet. Currently idle since 0.0 s
Oct 14 14:43:55 pbertol.duckdns.org autosuspend[430]: 2024-10-14 14:43:55,976 - autosuspend.Processor - INFO - Starting new check iteration
Oct 14 14:43:56 pbertol.duckdns.org autosuspend[656]: + curl -c cookie.txt -d 'username=pyload&password=*****' http://192.168.1.90:8000/api/login
Oct 14 14:43:56 pbertol.duckdns.org autosuspend[657]: % Total % Received % Xferd Average Speed Time Time Time Current
Oct 14 14:43:56 pbertol.duckdns.org autosuspend[657]: Dload Upload Total Spent Left Speed
Oct 14 14:43:56 pbertol.duckdns.org autosuspend[657]: [158B blob data]
Oct 14 14:43:56 pbertol.duckdns.org autosuspend[657]: {"_permanent": true, "authenticated": true, "id": 1, "name": "pyload", "role": 0, "perms": 0, "template": "default", "_flashes": [["message", "Logged in successfully"]]}
Oct 14 14:43:56 pbertol.duckdns.org autosuspend[659]: ++ curl -b cookie.txt http://192.168.1.90:8000/api/statusServer
Oct 14 14:43:56 pbertol.duckdns.org autosuspend[660]: ++ jq -r .active
Oct 14 14:43:56 pbertol.duckdns.org autosuspend[659]: % Total % Received % Xferd Average Speed Time Time Time Current
Oct 14 14:43:56 pbertol.duckdns.org autosuspend[659]: Dload Upload Total Spent Left Speed
Oct 14 14:43:56 pbertol.duckdns.org autosuspend[659]: [158B blob data]
Oct 14 14:43:56 pbertol.duckdns.org autosuspend[656]: + SessionStatus=0
Oct 14 14:43:56 pbertol.duckdns.org autosuspend[656]: + '[' 0 -ge 1 ']'
Oct 14 14:43:56 pbertol.duckdns.org autosuspend[656]: + exit 1
Oct 14 14:43:56 pbertol.duckdns.org autosuspend[430]: 2024-10-14 14:43:56,116 - autosuspend.Processor - INFO - System is idle since 2024-10-14 13:38:55.800583+00:00
Oct 14 14:43:56 pbertol.duckdns.org autosuspend[430]: 2024-10-14 14:43:56,116 - autosuspend.Processor - INFO - System is idle long enough.
Oct 14 14:43:56 pbertol.duckdns.org autosuspend[430]: 2024-10-14 14:43:56,116 - autosuspend.Processor - INFO - Going to suspend. Resetting state
Oct 14 14:43:56 pbertol.duckdns.org autosuspend[430]: 2024-10-14 14:43:56,116 - autosuspend - INFO - No suitable notification command configured.
Oct 14 14:43:56 pbertol.duckdns.org autosuspend[430]: 2024-10-14 14:43:56,116 - autosuspend - INFO - Suspending using command: /usr/bin/systemctl poweroff with next wake up at None
Oct 14 14:43:56 pbertol.duckdns.org systemd[1]: Stopping A daemon to suspend your server in case of inactivity...
Oct 14 14:43:56 pbertol.duckdns.org systemd[1]: autosuspend.service: Deactivated successfully.
Oct 14 14:43:56 pbertol.duckdns.org systemd[1]: Stopped A daemon to suspend your server in case of inactivity.
Oct 14 14:43:56 pbertol.duckdns.org systemd[1]: autosuspend.service: Consumed 385ms CPU time, 86.8M memory peak.
You should probably create a new plex token now. It is included in the logs here.
I think I understand what is happening here. autosuspend stops the check iteration after the first failing check. That's not exactly ideal in this case here. I should probably run all checks and report errors afterwards while still using the result of all other checks.
Right, thank you.
I have updated the token, but I am getting the same error. I searched online, and changed my password - but the token remained the same and the error remained there. I will seek advice from Plex directly - the 'funny' thing is that when watching a movie or show on Plex - Autosuspend does work and keep the server running?!
Following instruction from Plex community, I have changed my password again and checked the options to "Sign out connected devices after password change" to get a new token.
That works and a new token was generated, the .conf file was updated - unfortunately the error remain, could it be due to an update in python?
Thank you for your assistance and time.
Below journalctl log:
Oct 15 16:47:18 pbertol.duckdns.org systemd[1]: Started A daemon to suspend your server in case of inactivity.
Oct 15 16:47:18 pbertol.duckdns.org autosuspend[430]: 2024-10-15 16:47:18,733 - autosuspend - INFO - Configuring check Smb with class Smb from module autosuspend.checks.activity using config parameters {'enabled': 'true'}
Oct 15 16:47:18 pbertol.duckdns.org autosuspend[430]: 2024-10-15 16:47:18,964 - autosuspend - INFO - Configuring check RemoteUsers with class Users from module autosuspend.checks.activity using config parameters {'class': 'Users', 'enabled': 'true', 'name': '.*', 'terminal': '.*', 'host': '[0-9].*'}
Oct 15 16:47:18 pbertol.duckdns.org autosuspend[430]: 2024-10-15 16:47:18,965 - autosuspend - INFO - Configuring check ExternalCommand with class ExternalCommand from module autosuspend.checks.activity using config parameters {'enabled': 'true', 'command': 'sh /home/sweetth/autosuspend_script/pyload_autosuspend.sh'}
Oct 15 16:47:18 pbertol.duckdns.org autosuspend[430]: 2024-10-15 16:47:18,965 - autosuspend - INFO - Configuring check Plex-Media-Server with class XPath from module autosuspend.checks.activity using config parameters {'class': 'XPath', 'enabled': 'true', 'url': 'http://127.0.0.1:32400/status/sessions?X-Plex-Token=******NewToken*****', 'xpath': '/MediaContainer[@size > 0]'}
Oct 15 16:47:18 pbertol.duckdns.org autosuspend[430]: 2024-10-15 16:47:18,965 - autosuspend.Processor - INFO - Starting new check iteration
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[442]: + curl -c cookie.txt -d 'username=pyload&password=******' http://192.168.1.90:8000/api/login
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[443]: % Total % Received % Xferd Average Speed Time Time Time Current
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[443]: Dload Upload Total Spent Left Speed
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[443]: [158B blob data]
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[443]: curl: (7) Failed to connect to 192.168.1.90 port 8000 after 0 ms: Could not connect to server
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: 2024-10-15 16:47:19,143 - autosuspend.Processor - WARNING - Check Plex-Media-Server[class=XPathActivity] failed. Ignoring...
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: Traceback (most recent call last):
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/urllib3/connection.py", line 174, in _new_conn
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: conn = connection.create_connection(
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/urllib3/util/connection.py", line 95, in create_connection
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: raise err
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/urllib3/util/connection.py", line 85, in create_connection
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: sock.connect(sa)
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: ConnectionRefusedError: [Errno 111] Connection refused
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: During handling of the above exception, another exception occurred:
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: Traceback (most recent call last):
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/urllib3/connectionpool.py", line 716, in urlopen
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: httplib_response = self._make_request(
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^^^^^^^^
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/urllib3/connectionpool.py", line 416, in _make_request
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: conn.request(method, url, **httplib_request_kw)
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/urllib3/connection.py", line 244, in request
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: super(HTTPConnection, self).request(method, url, body=body, headers=headers)
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/http/client.py", line 1336, in request
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: self._send_request(method, url, body, headers, encode_chunked)
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/http/client.py", line 1382, in _send_request
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: self.endheaders(body, encode_chunked=encode_chunked)
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/http/client.py", line 1331, in endheaders
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: self._send_output(message_body, encode_chunked=encode_chunked)
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/http/client.py", line 1091, in _send_output
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: self.send(msg)
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/http/client.py", line 1035, in send
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: self.connect()
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/urllib3/connection.py", line 205, in connect
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: conn = self._new_conn()
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^^^^^
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/urllib3/connection.py", line 186, in _new_conn
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: raise NewConnectionError(
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x76ba581efce0>: Failed to establish a new connection: [Errno 111] Connection refused
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: During handling of the above exception, another exception occurred:
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: Traceback (most recent call last):
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/requests/adapters.py", line 667, in send
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: resp = conn.urlopen(
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^^
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/urllib3/connectionpool.py", line 802, in urlopen
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: retries = retries.increment(
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^^^^^^^
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/urllib3/util/retry.py", line 594, in increment
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: raise MaxRetryError(_pool, url, error or ResponseError(cause))
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /status/sessions?X-Plex-Token=******NewToken***** (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x76ba581efce0>: Failed to establish a new connection: [Errno 111] Connection refused'))
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: During handling of the above exception, another exception occurred:
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: Traceback (most recent call last):
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/autosuspend/checks/util.py", line 100, in request
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: reply = session.get(
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/requests/sessions.py", line 602, in get
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: return self.request("GET", url, **kwargs)
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: resp = self.send(prep, **send_kwargs)
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: r = adapter.send(request, **kwargs)
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/requests/adapters.py", line 700, in send
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: raise ConnectionError(e, request=request)
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /status/sessions?X-Plex-Token=******NewToken***** (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x76ba581efce0>: Failed to establish a new connection: [Errno 111] Connection refused'))
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: The above exception was the direct cause of the following exception:
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: Traceback (most recent call last):
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/autosuspend/__init__.py", line 119, in _safe_execute_activity
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: return check.check()
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^^
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/autosuspend/checks/xpath.py", line 59, in check
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: if self.evaluate():
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^^^^
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/autosuspend/checks/xpath.py", line 44, in evaluate
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: reply = self.request().content
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: ^^^^^^^^^^^^^^
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: File "/usr/lib/python3.12/site-packages/autosuspend/checks/util.py", line 119, in request
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: raise TemporaryCheckError(error) from error
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: autosuspend.checks.TemporaryCheckError: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /status/sessions?X-Plex-Token=******NewToken***** (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x76ba581efce0>: Failed to establish a new connection: [Errno 111] Connection refused'))
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: 2024-10-15 16:47:19,146 - autosuspend.Processor - INFO - System is idle since 2024-10-15 15:47:18.965546+00:00
Oct 15 16:47:19 pbertol.duckdns.org autosuspend[430]: 2024-10-15 16:47:19,146 - autosuspend.Processor - INFO - Desired idle time of 90.0 s not reached yet. Currently idle since 0.0 s
The error you see is probably not related to the token. The check for the token would only happen after a connection has been established but the exception tells that no connection to plex can be established at all. Are you sure that that the URL to plex is correct? You can test that manually with curl on the same machine.
See below the result from curl with a no file playing and a file playing:
No error.
$ curl -s -H "Accept: application/json" "http://127.0.0.1:32400/status/sessions?X-Plex-Token=PlexToken" | jq '.MediaContainer.size' 0
$ curl -s -H "Accept: application/json" "http://127.0.0.1:32400/status/sessions?X-Plex-Token=PlexToken" | jq '.MediaContainer.size' 1
I really can't tell from here why connections are refused. I'd suspect something unrelated to autosuspend for the moment.
But I'll use this ticket as an opportunity to prevent skipping further checks one errors.
Right, would it be better to then used the curl command to return the plex status (the above command) to avoid the issue?
Sorry, missed the last comment. I can tell from here what the reason for the failures is. Therefore I don't know if curl will be more reliable.
Closing this in favor of #589 with the same fix for failing checks