Skip to content

Instantly share code, notes, and snippets.

Created December 16, 2014 15:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/fd5ed9075cc026acc607 to your computer and use it in GitHub Desktop.
Save anonymous/fd5ed9075cc026acc607 to your computer and use it in GitHub Desktop.
Quick Container Check
#!/usr/bin/env python
from docker import Client
import json
d = Client(base_url='unix://var/run/docker.sock')
containers = d.containers()
metrics = {
'/redis': '1',
'/rsyslog': '1',
'/usagetracking_http_additional_logging': '1',
'/prctrdx001': '1',
'/prctrrb001': '1'
}
for container in containers:
metrics[container["Names"][0]] = '0'
perf_data = "OK | "
for k, v in metrics.iteritems():
perf_data += "%s=%s;;;; " % (k, v)
print perf_data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment