Created
November 27, 2019 14:25
-
-
Save sergiopena/e0f08a5372f626e1b491a42dc07a16e8 to your computer and use it in GitHub Desktop.
Spinnaker github local installation script to check microservices status
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import pdb | |
import yaml | |
import requests | |
from termcolor import colored | |
with open("spinnaker.yml", 'r') as stream: | |
try: | |
config=yaml.safe_load(stream) | |
except yaml.YAMLError as exc: | |
print(exc) | |
for service in config['services']: | |
if service == 'redis': | |
continue | |
baseUrl = config['services'][service]['baseUrl'] | |
try: | |
response = requests.get(baseUrl+'/health') | |
status_code = response.status_code | |
content = response.content | |
if service == 'deck' and status_code == 404: | |
status_code = 200 | |
except requests.exceptions.ConnectionError: | |
status_code = 'xxx' | |
if status_code == 200: | |
service = colored(service, 'green') | |
else: | |
service = colored(service, 'red') | |
print("{:<12} - {} - {}".format(baseUrl, status_code, service)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment