|
13 | 13 | for server in data["servers"]:
|
14 | 14 | print(server["name"])
|
15 | 15 |
|
16 |
| - for endpoint in server["endpoints"]: |
17 |
| - print("Checking " + endpoint + "...") |
| 16 | + for endpoint in server["endpoints"]: |
| 17 | + print("Checking " + endpoint + "...") |
18 | 18 |
|
19 |
| - result = subprocess.run(["nslookup", endpoint, "1.1.1.1"], timeout=5) |
20 |
| - print("DNS: " + "OK" if result.returncode == 0 else "Fail") |
| 19 | + result = subprocess.run(["nslookup", endpoint, "1.1.1.1"], timeout=5) |
| 20 | + print("DNS: " + "OK" if result.returncode == 0 else "Fail") |
21 | 21 |
|
22 |
| - if result.returncode != 0: |
23 |
| - continue |
| 22 | + if result.returncode != 0: |
| 23 | + continue |
24 | 24 |
|
25 |
| - result = subprocess.run(["ntpdig", "-j", "-t 5", endpoint, timeout=5]) |
26 |
| - print("ntpdig success?: " + "Yes" if result.returncode == 0 else "No") |
| 25 | + result = subprocess.run(["ntpdig", "-j", "-t 5", endpoint, timeout=5]) |
| 26 | + print("ntpdig success?: " + "Yes" if result.returncode == 0 else "No") |
27 | 27 |
|
28 |
| - if result.returncode != 0 |
29 |
| - continue |
| 28 | + if result.returncode != 0 |
| 29 | + continue |
30 | 30 |
|
31 |
| - ntpout = json.loads(result.stdout) |
32 |
| - |
33 |
| - print("Host: %s, IP: %s, Stratum: %s" % (ntpout["host"], ntpout["ip"], ntpout["stratum")) |
| 31 | + ntpout = json.loads(result.stdout) |
| 32 | + print("Host: %s, IP: %s, Stratum: %s" % (ntpout["host"], ntpout["ip"], ntpout["stratum")) |
34 | 33 |
|
0 commit comments