class IOReadContainerMetric(ContainerMetric):
    def api_metrics(self, client, params):
        return client.container_metric(self.container, 'io.read', params).json()

    @property
    def verbose_name(self):
        return 'IO Read' class IOWriteContainerMetric(ContainerMetric):
    def api_metrics(self, client, params):
        return client.container_metric(self.container, 'io.write', params).json()

    @property
    def verbose_name(self):
        return 'IO Write' class NetworkRXContainerMetric(ContainerMetric):
    def api_metrics(self, client, params):
        return client.container_metric(self.container, 'net.rx', params).json()

    @property
    def verbose_name(self):
        return 'Network RX' class NetworkTXContainerMetric(ContainerMetric):
    def api_metrics(self, client, params):
        return client.container_metric(self.container, 'net.tx', params).json()

    @property
    def verbose_name(self):
        return 'Network TX' class CPUContainerMetric(ContainerMetric):
    def api_metrics(self, client, params):
        return client.container_metric(self.container, 'cpu', params).json()

    @property
    def unit_of_measure(self):
        return 'ticks'

    @property
    def verbose_name(self):
        return 'CPU Ticks' class MemoryContainerMetric(ContainerMetric):
    def api_metrics(self, client, params):
        return client.container_metric(self.container, 'mem', params).json()

    @property
    def verbose_name(self):
        return 'Memory' class QuotaContainerMetric(ContainerMetric):
    def api_metrics(self, client, params):
        return client.container_metric(self.container, 'quota', params).json()

    @property
    def verbose_name(self):
        return 'Used Disk Space' class NetworkRXDomainMetric(DomainMetric):
    def api_metrics(self, client, params):
        return client.domain_metric(self.domain, 'net.rx', params).json()

    @property
    def verbose_name(self):
        return 'Network RX' class NetworkTXDomainMetric(DomainMetric):
    def api_metrics(self, client, params):
        return client.domain_metric(self.domain, 'net.tx', params).json()

    @property
    def verbose_name(self):
        return 'Network TX' class HitsDomainMetric(DomainMetric):
    def api_metrics(self, client, params):
        return client.domain_metric(self.domain, 'hits', params).json()

    @property
    def unit_of_measure(self):
        return 'hits'

    @property
    def verbose_name(self):
        return 'Hits' class RSSMemoryContainerMetric(ContainerMetric):
    def api_metrics(self, client, params):
        return client.container_metric(self.container, 'mem.rss', params).json()

    @property
    def verbose_name(self):
        return 'RSS Memory' class CacheMemoryContainerMetric(ContainerMetric):
    def api_metrics(self, client, params):
        return client.container_metric(self.container, 'mem.cache', params).json()

    @property
    def verbose_name(self):
        return 'Cache Memory'
    from django.conf.urls import patterns, url
    from django.conf.urls.defaults import patterns, url
from .models import IOReadContainerMetric, IOWriteContainerMetric,\
    NetworkRXContainerMetric, NetworkTXContainerMetric, CPUContainerMetric,\
    MemoryContainerMetric, QuotaContainerMetric, NetworkRXDomainMetric,\
    NetworkTXDomainMetric, HitsDomainMetric, RSSMemoryContainerMetric,\
    CacheMemoryContainerMetric
from __future__ import unicode_literals, absolute_import

try:
except ImportError:



urlpatterns = patterns(
    'console.views',
    url(r'^$', 'home', name='console_home'),
    url(r'^me/$', 'me_page', name='console_me'),
    url(r'^logout/$', 'logout', name='console_logout'),
    url(r'^containers/(?P<id>\d+)$', 'containers', name='console_containers'),
    url(r'^domains/(?P<id>\d+)$', 'domain', name='console_domain'),
    url(r'^domains/$', 'domains', name='console_domains'),
    url(r'^tags/(?P<tag>.+)$', 'tag', name='console_tag'),
    url(r'^tags/$', 'tags', name='console_tags'),
    url(r'^alarms/$', 'alarms', name='console_alarms'),
    url(r'^latest_alarms/$', 'latest_alarms', name='console_latest_alarms'),
    url(r'^alarm_key/(?P<id>\d+)$', 'alarm_key', name='console_alarm_key'),
    url(r'^add_domain_tag/(?P<id>\d+)$', 'add_domain_tag', name='console_add_domain_tag'),
    url(r'^reboot_container/(?P<id>\d+)$', 'reboot_container', name='console_reboot_container'),
)

urlpatterns += patterns(
    'console.views_metrics',
    url(r'^metric/$', 'metric_detail', name='console_metric_detail'),
    url(r'^metrics/container/io.read/id/(\d+)/$', 'container_metrics', name='console_container_io_read',
        kwargs={'model': IOReadContainerMetric, 'absolute_values': False, 'average': False}),
    url(r'^metrics/container/io.write/id/(\d+)/$', 'container_metrics', name='console_container_io_write',
        kwargs={'model': IOWriteContainerMetric, 'absolute_values': False, 'average': False}),
    url(r'^metrics/container/net.rx/id/(\d+)/$', 'container_metrics', name='console_container_net_rx',
        kwargs={'model': NetworkRXContainerMetric, 'absolute_values': False, 'average': False}),
    url(r'^metrics/container/net.tx/id/(\d+)/$', 'container_metrics', name='console_container_net_tx',
        kwargs={'model': NetworkTXContainerMetric, 'absolute_values': False, 'average': False}),
    url(r'^metrics/container/cpu/id/(\d+)/$', 'container_metrics', name='console_container_cpu',
        kwargs={'model': CPUContainerMetric, 'absolute_values': False, 'average': False}),
    url(r'^metrics/container/mem/id/(\d+)/$', 'container_metrics', name='console_container_mem',
        kwargs={'model': MemoryContainerMetric, 'absolute_values': True, 'average': True}),
    url(r'^metrics/container/mem.rss/id/(\d+)/$', 'container_metrics', name='console_container_mem_rss',
        kwargs={'model': RSSMemoryContainerMetric, 'absolute_values': True, 'average': True}),
    url(r'^metrics/container/mem.cache/id/(\d+)/$', 'container_metrics', name='console_container_mem_cache',
        kwargs={'model': CacheMemoryContainerMetric, 'absolute_values': True, 'average': True}),
    url(r'^metrics/container/quota/id/(\d+)/$', 'container_metrics', name='console_container_quota',
        kwargs={'model': QuotaContainerMetric, 'absolute_values': True, 'average': False}),

    url(r'^metrics/container/io.read/tag/(.+)/$', 'container_metrics_per_tag', name='console_container_io_read_per_tag',
        kwargs={'model': IOReadContainerMetric, 'absolute_values': False, 'average': False}),
    url(r'^metrics/container/io.write/tag/(.+)/$', 'container_metrics_per_tag', name='console_container_io_write_per_tag',
        kwargs={'model': IOWriteContainerMetric, 'absolute_values': False, 'average': False}),
    url(r'^metrics/container/net.rx/tag/(.+)/$', 'container_metrics_per_tag', name='console_container_net_rx_per_tag',
        kwargs={'model': NetworkRXContainerMetric, 'absolute_values': False, 'average': False}),
    url(r'^metrics/container/net.tx/tag/(.+)/$', 'container_metrics_per_tag', name='console_container_net_tx_per_tag',
        kwargs={'model': NetworkTXContainerMetric, 'absolute_values': False, 'average': False}),
    url(r'^metrics/container/cpu/tag/(.+)/$', 'container_metrics_per_tag', name='console_container_cpu_per_tag',
        kwargs={'model': CPUContainerMetric, 'absolute_values': False, 'average': True}),
    url(r'^metrics/container/mem/tag/(.+)/$', 'container_metrics_per_tag', name='console_container_mem_per_tag',
        kwargs={'model': MemoryContainerMetric, 'absolute_values': True, 'average': True}),
    url(r'^metrics/container/mem.rss/tag/(.+)/$', 'container_metrics_per_tag', name='console_container_mem_rss_per_tag',
        kwargs={'model': RSSMemoryContainerMetric, 'absolute_values': True, 'average': True}),
    url(r'^metrics/container/mem.cache/tag/(.+)/$', 'container_metrics_per_tag', name='console_container_mem_cache_per_tag',
        kwargs={'model': CacheMemoryContainerMetric, 'absolute_values': True, 'average': True}),
    url(r'^metrics/container/quota/tag/(.+)/$', 'container_metrics_per_tag', name='console_container_quota_per_tag',
        kwargs={'model': QuotaContainerMetric, 'absolute_values': True, 'average': False}),

    url(r'^metrics/domain/net.rx/id/(\d+)/$', 'domain_metrics', name='console_domain_net_rx',
        kwargs={'model': NetworkRXDomainMetric, 'absolute_values': False, 'average': False}),
    url(r'^metrics/domain/net.tx/id/(\d+)/$', 'domain_metrics', name='console_domain_net_tx',
        kwargs={'model': NetworkTXDomainMetric, 'absolute_values': False, 'average': False}),
    url(r'^metrics/domain/hits/id/(\d+)/$', 'domain_metrics', name='console_domain_hits',

        kwargs={'model': HitsDomainMetric, 'absolute_values': False, 'average': False}),