feat: add check function
This commit is contained in:
19
alakazam.py
19
alakazam.py
@ -1123,5 +1123,24 @@ def purge_volumes(apps: List[str]) -> None:
|
|||||||
print(f"Volumes for {domain} purged")
|
print(f"Volumes for {domain} purged")
|
||||||
|
|
||||||
|
|
||||||
|
@cli.command()
|
||||||
|
@click.option('-a', '--apps', multiple=True)
|
||||||
|
def check(apps: List[str]) -> None:
|
||||||
|
"""
|
||||||
|
Check the health status of all apps inside the selected group.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
apps (list): List of applications to be checked.
|
||||||
|
"""
|
||||||
|
group_apps = list_apps(apps)
|
||||||
|
domains = list(zip(*sum(group_apps.values(), [])))[1]
|
||||||
|
for domain in domains:
|
||||||
|
logging.info(f'check {domain}')
|
||||||
|
containers = abra("app" ,"ps", "-m", domain, machine_output=True)
|
||||||
|
for container in containers.values():
|
||||||
|
if re.match("health: starting|unknown|unhealthy", container['status']) or container['state'] != 'running':
|
||||||
|
print(f"{domain} - {container['service name']}: {container['status']}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
cli()
|
cli()
|
||||||
|
Reference in New Issue
Block a user