Open bison529 opened 3 years ago
Hey bison529 It's because you are using Python version 3.6 you need Python 3.7 or more.
Try running the script with 3.7+ :)
nice is work.
but in my case I have used only sub-domian for https://plex.domain.xyz. your script check all ports and hosts think is for plex server:
INFO: "2021-05-30 05:21:53,029 - Setting config from config file... DEBUG: "2021-05-30 05:21:53,030 - Starting new HTTPS connection (1): plex.tv:443 DEBUG: "2021-05-30 05:21:53,727 - https://plex.tv:443 "POST /users/sign_in.xml HTTP/1.1" 201 None INFO: "2021-05-30 05:21:53,727 - Connecting to Plex... DEBUG: "2021-05-30 05:21:53,835 - https://plex.tv:443 "GET /api/resources?includeHttps=1&includeRelay=1 HTTP/1.1" 200 None DEBUG: "2021-05-30 05:21:53,837 - Starting new HTTPS connection (1): 172-18-0-28.714dc59a55564cb6a3bb256c269809a7.plex.direct:32400 DEBUG: "2021-05-30 05:21:53,837 - Starting new HTTP connection (1): 172.18.0.28:32400 DEBUG: "2021-05-30 05:21:53,838 - Starting new HTTP connection (1): plex.domain.xyz:80 DEBUG: "2021-05-30 05:21:53,839 - Starting new HTTPS connection (1): plex.domain.xyz:443 DEBUG: "2021-05-30 05:21:53,841 - http://172.18.0.28:32400 "GET / HTTP/1.1" 200 3918 DEBUG: "2021-05-30 05:21:53,841 - Starting new HTTPS connection (1): 0.0.0.0.714dc59a55564cb6a3bb256c269809a7.plex.direct:443 DEBUG: "2021-05-30 05:21:53,842 - Starting new HTTP connection (1): plex.domain.xyz:80 DEBUG: "2021-05-30 05:21:53,844 - Starting new HTTP connection (1): plex.domain.xyz:443 DEBUG: "2021-05-30 05:21:53,844 - Starting new HTTP connection (1): 0.0.0.0:443 DEBUG: "2021-05-30 05:21:53,845 - http://0.0.0.0:443 "GET / HTTP/1.1" 400 256 ERROR: "2021-05-30 05:21:53,846 - http://0.0.0.0:443: (400) bad_request; http://0.0.0.0:443/ 400 The plain HTTP request was sent to HTTPS port400 Bad Request<$ DEBUG: "2021-05-30 05:21:53,847 - https://172-18-0-28.714dc59a55564cb6a3bb256c269809a7.plex.direct:32400 "GET / HTTP/1.1" 200 3918 ERROR: "2021-05-30 05:21:53,854 - https://0.0.0.0.714dc59a55564cb6a3bb256c269809a7.plex.direct:443: HTTPSConnectionPool(host='0.0.0.0.714dc59a55564cb6a3bb256c269809a7.plex.direct', port=443): Max retries exceeded with u$ DEBUG: "2021-05-30 05:21:53,855 - http://plex.domain.xyz:443 "GET / HTTP/1.1" 400 256 ERROR: "2021-05-30 05:21:53,856 - http://plex.domain.xyz:443: (400) bad_request; http://plex.domain.xyz:443/ <400 The plain HTTP request was sent to HTTPS port400 Ba$ DEBUG: "2021-05-30 05:21:53,856 - http://plex.domain.xyz:80 "GET / HTTP/1.1" 200 3918 DEBUG: "2021-05-30 05:21:53,857 - http://plex.domain.xyz:80 "GET / HTTP/1.1" 200 3918 DEBUG: "2021-05-30 05:21:53,866 - https://plex.domain.xyz:443 "GET / HTTP/1.1" 200 3918 DEBUG: "2021-05-30 05:21:53,896 - https://172-18-0-28.714dc59a55564cb6a3bb256c269809a7.plex.direct:32400 "GET /library HTTP/1.1" 200 288 DEBUG: "2021-05-30 05:21:53,900 - https://172-18-0-28.714dc59a55564cb6a3bb256c269809a7.plex.direct:32400 "GET /library/sections HTTP/1.1" 200 2886 ERROR: "2021-05-30 05:21:53,902 - Plex is down! INFO: "2021-05-30 05:21:53,902 - Restarting container... INFO: "2021-05-30 05:21:58,425 - Successfully restarted container... ITS ALIVE
here error : ERROR: "2021-05-30 05:21:53,856 - http://plex.domain.xyz:443: ... must be add https for port 443. how can check only if sub-domian https://plex.domain.xyz is down and restart plex docker.
Made a few changes. Try pulling the latest version. It should work as long as it gets to connect to any server on http or https. it checks https first but http should work.
Let me know how it goes :)
Hi gylli251,
thank you for updating, but still face error, I have stopped docker plex for tried your script:
INFO: "2021-05-31 07:33:51,128 - Setting config from config file... DEBUG: "2021-05-31 07:33:51,129 - Starting new HTTPS connection (1): plex.tv:443 DEBUG: "2021-05-31 07:33:51,538 - https://plex.tv:443 "POST /users/sign_in.xml HTTP/1.1" 201 None INFO: "2021-05-31 07:33:51,539 - Getting servers from plex... DEBUG: "2021-05-31 07:33:51,662 - https://plex.tv:443 "GET /api/resources?includeHttps=1&includeRelay=1 HTTP/1.1" 200 None DEBUG: "2021-05-31 07:33:51,664 - Starting new HTTP connection (1): 172.18.0.28:32400 DEBUG: "2021-05-31 07:33:51,665 - Starting new HTTP connection (1): plex.domain.xyz:80 DEBUG: "2021-05-31 07:33:51,666 - Starting new HTTPS connection (1): 172-18-0-28.714dc59a55564cb6a3bb256c269809a7.plex.direct:32400 DEBUG: "2021-05-31 07:33:51,667 - Starting new HTTPS connection (1): plex.domain.xyz:443 DEBUG: "2021-05-31 07:33:51,669 - Starting new HTTP connection (1): plex.domain.xyz:443 DEBUG: "2021-05-31 07:33:51,669 - Starting new HTTPS connection (1): 0-0-0-0.714dc59a55564cb6a3bb256c269809a7.plex.direct:32400 DEBUG: "2021-05-31 07:33:51,674 - Starting new HTTP connection (1): 0.0.0.0:32400 DEBUG: "2021-05-31 07:33:51,675 - Starting new HTTP connection (1): plex.domain.xyz:80 ERROR: "2021-05-31 07:33:51,675 - http://172.18.0.28:32400: HTTPConnectionPool(host='172.18.0.28', port=32400): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9763a5c850>: Failed to establish a new connection: [Errno 111] Connection refused')) ERROR: "2021-05-31 07:33:51,675 - https://172-18-0-28.714dc59a55564cb6a3bb256c269809a7.plex.direct:32400: HTTPSConnectionPool(host='172-18-0-28.714dc59a55564cb6a3bb256c269809a7.plex.direct', port=32400): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f9763a68410>: Failed to establish a new connection: [Errno 111] Connection refused')) DEBUG: "2021-05-31 07:33:51,676 - http://plex.domain.xyz:80 "GET / HTTP/1.1" 503 198 DEBUG: "2021-05-31 07:33:51,676 - http://plex.domain.xyz:443 "GET / HTTP/1.1" 400 256 ERROR: "2021-05-31 07:33:51,676 - http://0.0.0.0:32400: HTTPConnectionPool(host='0.0.0.0', port=32400): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9760209f50>: Failed to establish a new connection: [Errno 111] Connection refused')) ERROR: "2021-05-31 07:33:51,677 - https://195-201-61-47.714dc59a55564cb6a3bb256c269809a7.plex.direct:32400: HTTPSConnectionPool(host='195-201-61-47.714dc59a55564cb6a3bb256c269809a7.plex.direct', port=32400): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f9766f79ed0>: Failed to establish a new connection: [Errno 111] Connection refused')) ERROR: "2021-05-31 07:33:51,677 - http://plex.domain.xyz:80: (503) service_unavailable; http://plex.domain.xyz:80/
503 Service Temporarily Unavailable 503 Service Temporarily Unavailable
nginx/1.19.10
DEBUG: "2021-05-31 07:33:51,677 - http://plex.domain.xyz:80 "GET / HTTP/1.1" 503 198 ERROR: "2021-05-31 07:33:51,678 - http://plex.domain.xyz:443: (400) bad_request; http://plex.domain.xyz:443/
ERROR: "2021-05-31 07:33:51,678 - http://plex.domain.xyz:80: (503) service_unavailable; http://plex.domain.xyz:80/
ERROR: "2021-05-31 07:33:51,685 - https://plex.domain.xyz:443: HTTPSConnectionPool(host='plex.domain.xyz', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1076)')))
when running script show me this error:
2021-05-31 07:33:51 download-server PLEX-DOCTOR[19627] INFO Setting config from config file...
2021-05-31 07:33:51 download-server PLEX-DOCTOR[19627] INFO Getting servers from plex...
Traceback (most recent call last):
File "plex_doctor.py", line 86, in
Hey bison, can you show your config file without username/password?
On Mon, May 31, 2021, 04:42 bison529 @.***> wrote:
when running script show me this error:
2021-05-31 07:33:51 download-server PLEX-DOCTOR[19627] INFO Setting config from config file... 2021-05-31 07:33:51 download-server PLEX-DOCTOR[19627] INFO Getting servers from plex... Traceback (most recent call last): File "plex_doctor.py", line 86, in test_health_plex_and_reboot(config["servername"], config["os"]) File "plex_doctor.py", line 55, in test_health_plex_and_reboot plex = account.resource(servername).connect(timeout=8) File "/usr/local/lib/python3.7/dist-packages/plexapi/myplex.py", line 998, in connect return _chooseConnection('Resource', self.name, results) File "/usr/local/lib/python3.7/dist-packages/plexapi/myplex.py", line 1343, in _chooseConnection raise NotFound('Unable to connect to %s: %s' % (ctype.lower(), name)) plexapi.exceptions.NotFound: Unable to connect to resource: Server 00
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gylli251/PlexDoctor/issues/1#issuecomment-851166545, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACPFWHJCJS7Z6WCLI67EEFTTQMHTHANCNFSM45YDXLPQ .
{ "username": "XXX@gmail.com", "password": "XXX", "servername": "Server 00", "os" : "docker", "plex_path_location" : "path to your plexmediaserver, ONLY NEED TO USE THIS IF YOU HAVE LINUX OR WINDOWS" }
Hi gylli251,
any update
Hi gylli251. can you contact me at Discord : AbOoOdY#9944
Hi,
I just install your scrip on ubuntu 18.05 docker plex , but facing error when try restart docker.
`$ sudo python3 plex_doctor.py 2021-05-29 12:28:42 download-server PLEX-DOCTOR[7831] INFO Setting config from config file... 2021-05-29 12:28:43 download-server PLEX-DOCTOR[7831] INFO Connecting to Plex... 2021-05-29 12:28:46 download-server PLEX-DOCTOR[7831] ERROR Plex is down! 2021-05-29 12:28:46 download-server PLEX-DOCTOR[7831] INFO Restarting container... Traceback (most recent call last): File "plex_doctor.py", line 54, in test_health_plex_and_reboot plex = account.resource(servername).connect(timeout=8) File "/home/admin/.local/lib/python3.6/site-packages/plexapi/myplex.py", line 998, in connect return _chooseConnection('Resource', self.name, results) File "/home/admin/.local/lib/python3.6/site-packages/plexapi/myplex.py", line 1343, in _chooseConnection raise NotFound('Unable to connect to %s: %s' % (ctype.lower(), name)) plexapi.exceptions.NotFound: Unable to connect to resource: Server 00
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "plex_doctor.py", line 69, in
test_health_plex_and_reboot(config["servername"], config["os"])
File "plex_doctor.py", line 60, in test_health_plex_and_reboot
restart_docker()
File "plex_doctor.py", line 30, in restart_docker
result = subprocess.run(["docker", "restart", "plex"], capture_output=True)
File "/usr/lib/python3.6/subprocess.py", line 423, in run
with Popen(*popenargs, **kwargs) as process:
TypeError: init() got an unexpected keyword argument 'capture_output'`
can you help me to fix ?