コード例 #1
0
class Lun(resources.LogicalDrive):
    class Meta:
        identifier = ScopedId("lun_id")
        charts = [
            {"title": "Bandwidth", "series": ["read_bytes_sec", "write_bytes_sec"]},
            {"title": "Latency distribution", "series": ["write_latency_hist"]},
        ]

    lun_id = attributes.String()
    couplet = attributes.ResourceReference()

    read_bytes_sec = statistics.Gauge(units="B/s", label="Read bandwidth")
    write_bytes_sec = statistics.Gauge(units="B/s", label="Write bandwidth")
    write_latency_hist = statistics.BytesHistogram(
        label="Write latency",
        bins=[
            (0, 16),
            (17, 32),
            (33, 64),
            (65, 128),
            (129, 256),
            (257, 512),
            (513, 1024),
            (1024, 2048),
            (2049, 4096),
            (4097, 8192),
            (8193, 16384),
            (16385, 32768),
        ],
    )

    def get_label(self):
        return self.lun_id
コード例 #2
0
class TestDefaults2(BaseStorageResource):
    class Meta:
        identifier = GlobalId("name", "name_scope")

    name = attributes.String()
    name_scope = attributes.String()
    read = statistics.Gauge()
    write = statistics.Gauge()
コード例 #3
0
class Disk(resources.PhysicalDisk):
    class Meta:
        identifier = GlobalId('wwid')

    lun = attributes.ResourceReference(optional=True)

    size = attributes.Bytes()
    wwid = attributes.Uuid()
    read_bytes_sec = statistics.Gauge(units="B/s", label="Read bandwidth")
    write_bytes_sec = statistics.Gauge(units="B/s", label="Write bandwidth")
コード例 #4
0
class TestOverrides(BaseStorageResource):
    class Meta:
        identifier = GlobalId("name")
        label = "Alpha"
        charts = [{"title": "IO", "series": ["read", "write"]}]

    def get_label(self):
        return "Bravo"

    name = attributes.String()
    read = statistics.Gauge()
    write = statistics.Gauge()
コード例 #5
0
class TestOverrides(BaseStorageResource):
    class Meta:
        identifier = GlobalId('name')
        label = "Alpha"
        charts = [{'title': 'IO', 'series': ['read', 'write']}]

    def get_label(self):
        return "Bravo"

    name = attributes.String()
    read = statistics.Gauge()
    write = statistics.Gauge()
コード例 #6
0
class Lun(resources.LogicalDrive):
    class Meta:
        identifier = GlobalId('serial')
        relations = [
            relations.Provide(
                provide_to=('linux', 'ScsiDevice'),
                attributes=['serial']),
        ]
        charts = [
            {
                'title': "Bandwidth",
                'series': ['read_bytes_sec', 'write_bytes_sec']
            },
            {
                'title': "Ops",
                'series': ['read_ops_sec', 'write_ops_sec']
            },
            {
                'title': "Latency distribution",
                'series': ['write_latency_hist']
            }
        ]

    couplet = attributes.ResourceReference()
    lun_id = attributes.String()
    serial = attributes.String()

    read_bytes_sec = statistics.Gauge(units="B/s", label="Read bandwidth")
    write_bytes_sec = statistics.Gauge(units="B/s", label="Write bandwidth")
    read_ops_sec = statistics.Gauge(units="op/s", label="Read operations")
    write_ops_sec = statistics.Gauge(units="op/s", label="Write operations")
    write_latency_hist = statistics.BytesHistogram(
        label="Write latency",
        bins=[(0, 16),
              (17, 32),
              (33, 64),
              (65, 128),
              (129, 256),
              (257, 512),
              (513, 1024),
              (1024, 2048),
              (2049, 4096),
              (4097, 8192),
              (8193, 16384),
              (16385, 32768)
              ])

    def get_label(self):
        return self.lun_id
class Resource3(PhysicalDisk):
    serial_number = attributes.String()
    capacity = attributes.Bytes()
    temperature = statistics.Gauge(units="C")

    class Meta:
        identifier = ScopedId("serial_number")
コード例 #8
0
class HardDrive(resources.PhysicalDisk):
    class Meta:
        identifier = identifiers.ScopedId('serial_number')

    serial_number = attributes.String()
    capacity = attributes.Bytes()
    temperature = statistics.Gauge(units='C')
コード例 #9
0
class DiskDrive(resources.Resource):
    class Meta:
        identifier = ScopedId("serial")
        charts = [{
            "title": "Bandwidth",
            "series": ["read_bytes_sec", "write_bytes_sec"]
        }]

    serial = attributes.String()
    read_bytes_sec = statistics.Gauge(units="B/s", label="Read bandwidth")
    write_bytes_sec = statistics.Counter(units="B/s", label="Write bandwidth")
コード例 #10
0
class DiskDrive(resources.Resource):
    class Meta:
        identifier = ScopedId('serial')
        charts = [
                {
                'title': "Bandwidth",
                'series': ['read_bytes_sec', 'write_bytes_sec']
            }
        ]

    serial = attributes.String()
    read_bytes_sec = statistics.Gauge(units = "B/s", label = "Read bandwidth")
    write_bytes_sec = statistics.Counter(units = "B/s", label = "Write bandwidth")