Exemple #1
0
    def cache(cls, id):
        """return the number of query cache for the last 24H"""
        sampler = {'unit': 'days', 'value': 1, 'function': 'sum'}
        query = 'webacc.requests.cache.all'
        metrics = Metric.query(id, 60*60*24, query, 'paas', sampler)

        cache = {'hit': 0, 'miss': 0, 'not': 0, 'pass': 0}
        for metric in metrics:
            what = metric['cache'].pop()
            for point in metric['points']:
                value = point.get('value', 0)
                cache[what] += value
        return cache
Exemple #2
0
    def cache(cls, id):
        """return the number of query cache for the last 24H"""
        sampler = {'unit': 'days', 'value': 1, 'function': 'sum'}
        query = 'webacc.requests.cache.all'
        metrics = Metric.query(id, 60 * 60 * 24, query, 'paas', sampler)

        cache = {'hit': 0, 'miss': 0, 'not': 0, 'pass': 0}
        for metric in metrics:
            what = metric['cache'].pop()
            for point in metric['points']:
                value = point.get('value', 0)
                cache[what] += value
        return cache
Exemple #3
0
    def quota(cls, id):
        """return disk quota used/free"""
        sampler = {'unit': 'minutes', 'value': 1, 'function': 'avg'}
        query = 'vfs.df.bytes.all'
        metrics = Metric.query(id, 60, query, 'paas', sampler)

        df = {'free': 0, 'used': 0}
        for metric in metrics:
            what = metric['size'].pop()
            # we need the most recent points
            metric['points'].reverse()
            for point in metric['points']:
                if 'value' in point:
                    df[what] = point['value']
                    break
        return df
Exemple #4
0
    def quota(cls, id):
        """return disk quota used/free"""
        sampler = {'unit': 'minutes', 'value': 1, 'function': 'avg'}
        query = 'vfs.df.bytes.all'
        metrics = Metric.query(id, 60, query, 'paas', sampler)

        df = {'free': 0, 'used': 0}
        for metric in metrics:
            what = metric['size'].pop()
            # we need the most recent points
            metric['points'].reverse()
            for point in metric['points']:
                if 'value' in point:
                    df[what] = point['value']
                    break
        return df