-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmonitorar-propagacao.py
More file actions
52 lines (40 loc) · 1.49 KB
/
Copy pathmonitorar-propagacao.py
File metadata and controls
52 lines (40 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import requests
import time
PROJETOS = [
{"nome": "AWS Services", "url": "https://aws-services.sstechnologies-cloud.com"},
{"nome": "Ritech", "url": "https://ritech-fechaduras-digitais.sstechnologies-cloud.com"},
{"nome": "AWS Cert", "url": "https://aws-certification-platform.sstechnologies-cloud.com"}
]
print("="*60)
print("MONITORANDO PROPAGACAO CLOUDFRONT")
print("="*60)
print("Verificando a cada 60 segundos...\n")
tentativa = 1
max_tentativas = 10
while tentativa <= max_tentativas:
print(f"\n[Tentativa {tentativa}/{max_tentativas}] - {time.strftime('%H:%M:%S')}")
todos_online = True
for projeto in PROJETOS:
try:
response = requests.get(projeto['url'], timeout=10)
if response.status_code == 200:
print(f" [OK] {projeto['nome']:20} | 200 ONLINE")
else:
print(f" [XX] {projeto['nome']:20} | {response.status_code}")
todos_online = False
except Exception as e:
print(f" [ER] {projeto['nome']:20} | ERRO")
todos_online = False
if todos_online:
print("\n" + "="*60)
print("TODOS OS PROJETOS ONLINE!")
print("="*60)
break
if tentativa < max_tentativas:
print("\nAguardando 60 segundos...")
time.sleep(60)
tentativa += 1
if not todos_online:
print("\n" + "="*60)
print("Tempo limite atingido. Alguns projetos ainda offline.")
print("="*60)