class GeoServerService(BaseServiceHandler):

    def setup(self):
        if not self.service.url:
            raise ValueError("Monitoring is not configured to fetch from %s" % self.service.name)
        self.gs_monitor = GeoServerMonitorClient(self.service.url)

    def _collect(self, since, until, format=None, **kwargs):
        format = format or 'json'
        requests = list(self.gs_monitor.get_requests(format=format, since=since, until=until))
        return requests

    def handle_collected(self, requests):
        now = datetime.now()
        for r in requests:
            RequestEvent.from_geoserver(self.service, r, received=now)
        return RequestEvent.objects.filter(service=self.service, received=now)
示例#2
0
class GeoServerService(BaseServiceHandler):

    def setup(self):
        if not self.service.url:
            raise ValueError("Monitoring is not configured to fetch from %s" % self.service.name)
        self.gs_monitor = GeoServerMonitorClient(self.service.url)

    def _collect(self, since, until, format=None, **kwargs):
        format = format or 'json'
        requests = list(self.gs_monitor.get_requests(format=format, since=since, until=until))
        return requests

    def handle_collected(self, requests):
        utc = pytz.utc
        now = datetime.utcnow().replace(tzinfo=utc)
        for r in requests:
            RequestEvent.from_geoserver(self.service, r, received=now)
        return RequestEvent.objects.filter(service=self.service, received=now)
示例#3
0
 def setup(self):
     if not self.service.url:
         raise ValueError("Monitoring is not configured to fetch from %s" % self.service.name)
     self.gs_monitor = GeoServerMonitorClient(self.service.url)
 def setup(self):
     if not self.service.url:
         raise ValueError("Monitoring is not configured to fetch from %s" % self.service.name)
     self.gs_monitor = GeoServerMonitorClient(self.service.url)