display, i3
This commit is contained in:
		
							
								
								
									
										22
									
								
								bin/services
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										22
									
								
								bin/services
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| #!/usr/bin/env python3 | ||||
|  | ||||
| import re | ||||
| import consul | ||||
| import docker | ||||
|  | ||||
| running = {} | ||||
|  | ||||
| c = consul.Consul() | ||||
| client = docker.from_env() | ||||
|  | ||||
| for services in c.catalog.services(): | ||||
|     for service in services: | ||||
|  | ||||
|         idx, details = c.catalog.service(service) | ||||
|         if len(details) == 0: | ||||
|             continue | ||||
|  | ||||
|   | ||||
|         for item in details: | ||||
|             link = item['ServiceName']+".service."+item['Datacenter']+".consul:"+str(item['ServicePort']) | ||||
|             print("http://"+link) | ||||
		Reference in New Issue
	
	Block a user