command checking services status

Closes #6445
This commit is contained in:
Serghei Mihai 2015-02-06 18:52:20 +01:00
parent 2f741c203e
commit b882564635
1 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,20 @@
from optparse import make_option
from django.core.management.base import BaseCommand
from hobo.environment import models
class Command(BaseCommand):
help = '''Checks if all services are operational'''
def handle(self, *args, **kwargs):
for klass in models.AVAILABLE_SERVICES:
for obj in klass.objects.all():
obj.check_operational()
if int(kwargs.get('verbosity')) > 1:
if obj.is_operational():
print("%s is operational" % obj.title)
else:
print self.style.NOTICE('%s is NOT operational' % obj.title)
if obj.last_operational_success_timestamp:
print self.style.NOTICE(' last operational success: %s' % obj.last_operational_success_timestamp)