示例#1
0
    def check(self):
        all_status = ok, warning, critical, unknown = utils.get_all_status(
            self.power_supplies)
        code = utils.max_if_not_empty(ok + warning + critical + unknown,
                                      key=lambda i: i[0])
        code = code[0]
        status_mark = utils.get_status_mark("POWER SUPPLY", code)
        first_line = "Total power supplies #{}, Failed supplies: {}".format(
            len(ok + warning + critical + unknown), [c[1] for c in critical])
        # Status line
        print(status_mark + first_line + " | ")

        # Failed details
        utils.print_if_failure(all_status[code], self.power_supplies)
        return code
示例#2
0
    def check(self):
        all_status = ok, warning, critical, unknown = utils.get_all_status(
            self.memory_modules)
        code = utils.max_if_not_empty(ok + warning + critical + unknown,
                                      key=lambda i: i[0])
        code = code[0]
        status_mark = utils.get_status_mark("MEMORY MODULE", code)
        first_line = "Total memory modules #{}, Failed modules: {}".format(
            len(ok + warning + critical + unknown), [c[1] for c in critical])
        # Status line
        print(status_mark + first_line + " | ")

        # Failed details
        utils.print_if_failure(all_status[code], self.memory_modules)
        return code
示例#3
0
    def check(self):
        all_status = ok, warning, critical, unknown = utils.get_all_status(
            self.luns)
        code = utils.max_if_not_empty(ok + warning + critical + unknown,
                                      key=lambda i: i[0])
        code = code[0]
        status_mark = utils.get_status_mark("LUN", code)
        first_line = "Total LUNs #{}, Failed LUNs: {}".format(
            len(ok + warning + critical + unknown), ', '.join(
                [utils.get_by_id(c[1], self.luns).name for c in critical]))
        # Status line
        print(status_mark + first_line + " | ")

        # Failed details
        utils.print_if_failure(all_status[code], self.luns)
        return code
示例#4
0
    def check(self):
        code = 0
        all_status = ok, warning, critical, unknown = utils.get_all_status(
            self.ssds)
        if len(self.ssds):
            code = utils.max_if_not_empty(ok + warning + critical + unknown,
                                          key=lambda i: i[0])
            code = code[0]
        status_mark = utils.get_status_mark("SSD", code)
        first_line = "Total SSDs #{}, Failed SSDs: {}".format(
            len(ok + warning + critical + unknown), [c[1] for c in critical])
        # Status line
        print(status_mark + first_line + " | ")

        # Failed details
        utils.print_if_failure(all_status[code], self.ssds)
        return code
示例#5
0
    def check(self):
        all_status = ok, warning, critical, unknown = utils.get_all_status(
            self.disks)
        code = utils.max_if_not_empty(ok + warning + critical + unknown,
                                      key=lambda i: i[0])
        code = code[0]
        status_mark = utils.get_status_mark("DISK", code)
        first_line = "Total Disks #{}, Failed Disks: {}, Hot spares: {}, " \
                     "Unbounded: {}".format(
                      len(ok + warning + critical + unknown),
                      [c[1] for c in critical], self.get_hot_spares(),
                      self.get_unbounded_disks())
        # Status line
        print(status_mark + first_line + " | ")

        # Failed details
        utils.print_if_failure(all_status[code], self.disks)
        return code
示例#6
0
    def check(self):
        all_status = ok, warning, critical, unknown = utils.get_all_status(
            self.sas_ports)
        code = utils.max_if_not_empty(ok + warning + critical + unknown,
                                      key=lambda i: i[0])
        code = code[0]
        status_mark = utils.get_status_mark("SAS_PORT", code)
        first_line = "Total SAS ports #{}, Failed ports(ID): {}".format(
            len(ok + warning + critical + unknown), [c[1] for c in critical])
        # Status line
        print(status_mark + first_line + " | ")

        # Failed details
        utils.print_if_failure(all_status[code], self.sas_ports)
        # Performance detail
        for port in self.sas_ports:
            print("{}: Link status={}, Current Speed={}".format(
                port.name, self.get_link_status(port),
                utils.format_enum(port.current_speed)))
        return code
示例#7
0
    def check(self):
        all_status = ok, warning, critical, unknown = utils.get_all_status(
            self.pools)
        code = utils.max_if_not_empty(ok + warning + critical + unknown,
                                      key=lambda i: i[0])
        code = code[0]
        status_mark = utils.get_status_mark("POOL", code)
        first_line = "Total POOLs #{}, Failed POOLs: {}".format(
            len(ok + warning + critical + unknown), ', '.join(
                [utils.get_by_id(c[1], self.pools).name for c in critical]))
        # Status line
        print(status_mark + first_line + " | ")

        # Failed details
        utils.print_if_failure(all_status[code], self.pools)
        # Performance detail
        for p in self.pools:
            print("{}: Total Cap={} GiB, "
                  "Available Cap={} GiB({:.2f}%) ".format(
                      p.name, utils.byte_to_GiB(p.size_total),
                      utils.byte_to_GiB(p.size_free),
                      (p.size_free / p.size_total) * 100))
        return code
示例#8
0
    def check(self):
        all_status = ok, warning, critical, unknown = utils.get_all_status(
            self.dae)
        code = utils.max_if_not_empty(ok + warning + critical + unknown,
                                      key=lambda i: i[0])
        code = code[0]
        status_mark = utils.get_status_mark("DAE", code)
        first_line = "Total DAEs #{}, Failed DAE(ID): {}".format(
            len(ok + warning + critical + unknown), [c[1] for c in critical])
        # Status line
        print(status_mark + first_line + " | ")

        # Failed details
        utils.print_if_failure(all_status[code], self.dae)
        # Performance detail
        for d in self.dae:
            print("{}: Power(curr/avg/max_if_not_empty)={}/{}/{} watts, "
                  "Temperature(curr/avg/max_if_not_empty)={}/{}/{} degrees , "
                  "Speed(curr/max)={}/{} GB".format(
                      d.name, d.current_power, d.avg_power, d.max_power,
                      d.current_temperature, d.avg_temperature,
                      d.max_temperature, utils.byte_to_GB(d.current_speed),
                      utils.byte_to_GB(d.max_speed)))
        return code
示例#9
0
 def check(self):
     all_status = ok, warning, critical, unknown = utils.get_all_status(
         self.ethernet_ports)
     code = utils.max_if_not_empty(ok + warning + critical + unknown,
                                   key=lambda i: i[0])
     code = code[0]
     status_mark = utils.get_status_mark("ETHERNET_PORT", code)
     first_line = "Total ethernet ports #{}, Failed ports(ID): {}".format(
         len(ok + warning + critical + unknown), ', '.join([
             utils.get_by_id(c[1], self.ethernet_ports).name
             for c in critical
         ]))
     # Status line
     print(status_mark + first_line + " | ")
     # Failed details
     utils.print_if_failure(all_status[code], self.ethernet_ports)
     # Performance detail
     for port in self.ethernet_ports:
         print("{}: Link status={}, Requested Speed={}, "
               "Current Speed={}".format(
                   port.name, "UP" if port.is_link_up else "DOWN",
                   utils.format_enum(port.requested_speed),
                   utils.format_enum(port.speed)))
     return code