Newer
Older
Checks that the webserver is running.
'''
import os
import requests
import sys
if not os.path.exists('/etc/nginx'):
print('Nginx dir does not exists, test skipped.')
else:
print('Checking http://127.0.0.1:1080/nginx_status response.')
req = requests.get('http://127.0.0.1:1080/nginx_status', proxies={'http': '', 'https': ''}, timeout=5)
if req.status_code != 200:
raise Exception('Request failed with status code %s.' % req.status_code)
if 'Active connections' not in req.text:
raise Exception('Invalid response from nginx status url.')
except Exception as e:
print(str(e))
sys.exit(1)