Remove router alive check
This commit is contained in:
10
src/app.py
10
src/app.py
@@ -24,15 +24,6 @@ def result():
|
|||||||
def safe():
|
def safe():
|
||||||
app.logger.info('Initializing safe reboot process')
|
app.logger.info('Initializing safe reboot process')
|
||||||
|
|
||||||
# Try to ping the router 50 times
|
|
||||||
for i in range(50):
|
|
||||||
if call(['ping', '-c', '1', url], stdout=DEVNULL, stderr=STDOUT) == 0:
|
|
||||||
app.logger.info('Router is online')
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
app.logger.error('Router is offline')
|
|
||||||
return 'Error: Unable to ping and reboot router automatically!'
|
|
||||||
|
|
||||||
# Try to nslookup 5 different websites to see if DNS is working
|
# Try to nslookup 5 different websites to see if DNS is working
|
||||||
websites = ['www.google.com', 'www.facebook.com', 'www.twitter.com', 'www.reddit.com', 'www.amazon.com']
|
websites = ['www.google.com', 'www.facebook.com', 'www.twitter.com', 'www.reddit.com', 'www.amazon.com']
|
||||||
success = 0
|
success = 0
|
||||||
@@ -74,3 +65,4 @@ def force():
|
|||||||
def grafana():
|
def grafana():
|
||||||
if request.json['state'] == 'alerting':
|
if request.json['state'] == 'alerting':
|
||||||
return safe()
|
return safe()
|
||||||
|
return "State is OK!"
|
||||||
|
Reference in New Issue
Block a user