Exemplo n.º 1
0
def form_get_services(request):
    try:
        if request.is_authenticated:
            return Service.filter()
        else:
            return HttpResponseForbidden
    except:
        return HttpResponseBadRequest
Exemplo n.º 2
0
def form_get_services_options(request):
    try:
        if request.is_authenticated:
            return [{'value': service.name, 'label': service.name} for service in Service.filter()]
        else:
            return HttpResponseForbidden
    except:
        return HttpResponseBadRequest
def get_info(service=None, display=False):
    if service is None:
        # get info for all services
        return_data = []
        services = Service.filter()
        for service in services:
            data = {'service': service.get_json(), 'statuses': []}
            if display:
                data['statuses'] = service.get_last_4_days()
            else:
                statuses = ServiceStatus.filter(service=service)
                for s in statuses:
                    data['statuses'].append(s.get_json())
            return_data.append(data)
        return return_data
    else:
        service = Service.get(name=service)
        statuses = ServiceStatus.filter(service=service)
        return_data = {'service': service.get_json(), 'statuses': []}
        for s in statuses:
            return_data['statuses'].append(s.get_json())
        return return_data
 def action(self):
     all_services = Service.filter()
     for service in all_services:
         if service.is_url():
             service.do_monitor = True
             service.save()
Exemplo n.º 5
0
def get_services(request):
    return Service.filter()