Пример #1
0
    def setUp(self):
        super(DashboardTestCase, self).setUp()

        TestPanelA._i = 0

        registry.register(TestPanelA)
        registry.register(TestPanelB)

        self.panel_a = Panel.objects.create(title='a', slug='a')
        self.panel_b = Panel.objects.create(title='b', slug='b')

        self.seed = datetime.datetime(2011, 1, 1)
    def setUp(self):
        super(DashboardTestCase, self).setUp()

        TestPanelA._i = 0

        registry.register(TestPanelA)
        registry.register(TestPanelB)

        self.panel_a = Panel.objects.create(title="a", slug="a")
        self.panel_b = Panel.objects.create(title="b", slug="b")

        self.seed = datetime.datetime(2011, 1, 1)
Пример #3
0
    def get_data(self):
        memcached_stats = self.get_stats()

        return {'bytes': memcached_stats.get('bytes', 0)}


class MemcachedItemsInCache(MemcachedPanelProvider):
    def get_title(self):
        return 'Memcached items in cache'

    def get_data(self):
        memcached_stats = self.get_stats()
        return {'items': memcached_stats.get('curr_items', 0)}


registry.register(CPUInfo)

if REDIS_SERVER:
    registry.register(RedisConnectedClients)
    registry.register(RedisMemoryUsage)

if MEMCACHED_SERVER:
    registry.register(MemcachedHitMiss)
    registry.register(MemcachedMemoryUsage)
    registry.register(MemcachedItemsInCache)

if 'psycopg2' in get_db_setting('ENGINE'):
    registry.register(PostgresQueryPanel)
    registry.register(PostgresUserPanel)
    registry.register(PostgresConnectionsPanel)
    registry.register(PostgresConnectionsForDatabase)
Пример #4
0
class MemcachedItemsInCache(MemcachedPanelProvider):
    def get_title(self):
        return 'Memcached items in cache'
    
    def get_data(self):
        data_dict = {}

        for server in MEMCACHED_SERVERS:
            memcached_stats = self.get_stats(server)
            data_dict[server] = memcached_stats.get('curr_items', 0)

        return data_dict


registry.register(CPUInfo)


if REDIS_SERVERS:
    registry.register(RedisConnectedClients)
    registry.register(RedisMemoryUsage)


if MEMCACHED_SERVERS:
    registry.register(MemcachedHitMiss)
    registry.register(MemcachedMemoryUsage)
    registry.register(MemcachedItemsInCache)


if 'psycopg2' in get_db_setting('ENGINE'):
    registry.register(PostgresQueryPanel)