def get_stats(self) :
        mds_stats = lustre_mds_stats()
        raw_stats = lustre.read_stats(self.stats_dir+"/stats")
        mds_stats.timestamp    = raw_stats["timestamp"]
        (mds_stats.req, mds_stats.req_waittime) = \
            lustre.get_stats_field(raw_stats, "req_waittime", "SUM")

        # Get the number of running threads
        with open(self.stats_dir+"/threads_started", "r") as fd:
            mds_stats.nb_threads = int(fd.readline())
        return mds_stats
Пример #2
0
    def get_OSS_stats() :
        oss_stats = lustre_oss_stats()
        raw_stats = lustre.read_stats(lustre.proc_path+"/ost/OSS/ost_io/stats")
        oss_stats.timestamp    = raw_stats["timestamp"]
        (oss_stats.req, oss_stats.req_waittime) = \
            lustre.get_stats_field(raw_stats, "req_waittime", "SUM")

        # Get the number of running threads
        with open(lustre.proc_path+"/ost/OSS/ost_io/threads_started", "r") as fd:
            oss_stats.nb_threads = int(fd.readline())
        return oss_stats
    def get_stats(self) :
        mdt_stats = lustre_mdt_stats()
        raw_stats = lustre.read_stats(lustre.proc_path+"/mdt/"+self.name+"/md_stats")
        #We care about :  open, close, mknod, unlink, mkdir, rmdir, 
        #                 rename, getattr, setattr, getxattr, link, statfs
        mdt_stats.timestamp   = raw_stats["timestamp"]

        mdt_stats.nb_open     = lustre.get_stats_field(raw_stats, "open")
        mdt_stats.nb_close    = lustre.get_stats_field(raw_stats, "close")
        mdt_stats.nb_mknod    = lustre.get_stats_field(raw_stats, "mknod")
        mdt_stats.nb_unlink   = lustre.get_stats_field(raw_stats, "unlink")
        mdt_stats.nb_mkdir    = lustre.get_stats_field(raw_stats, "mkdir")
        mdt_stats.nb_rmdir    = lustre.get_stats_field(raw_stats, "rmdir")
        mdt_stats.nb_rename   = lustre.get_stats_field(raw_stats, "rename")
        mdt_stats.nb_getattr  = lustre.get_stats_field(raw_stats, "getattr")
        mdt_stats.nb_setattr  = lustre.get_stats_field(raw_stats, "setattr")
        mdt_stats.nb_getxattr = lustre.get_stats_field(raw_stats, "getxattr")
        mdt_stats.nb_link     = lustre.get_stats_field(raw_stats, "link")
        mdt_stats.nb_statfs   = lustre.get_stats_field(raw_stats, "statfs")

        return mdt_stats
    def get_stats(self):
        mdt_stats = lustre_mdt_stats()
        raw_stats = lustre.read_stats(lustre.proc_path + "/mdt/" + self.name +
                                      "/md_stats")
        #We care about :  open, close, mknod, unlink, mkdir, rmdir,
        #                 rename, getattr, setattr, getxattr, link, statfs
        mdt_stats.timestamp = raw_stats["timestamp"]

        mdt_stats.nb_open = lustre.get_stats_field(raw_stats, "open")
        mdt_stats.nb_close = lustre.get_stats_field(raw_stats, "close")
        mdt_stats.nb_mknod = lustre.get_stats_field(raw_stats, "mknod")
        mdt_stats.nb_unlink = lustre.get_stats_field(raw_stats, "unlink")
        mdt_stats.nb_mkdir = lustre.get_stats_field(raw_stats, "mkdir")
        mdt_stats.nb_rmdir = lustre.get_stats_field(raw_stats, "rmdir")
        mdt_stats.nb_rename = lustre.get_stats_field(raw_stats, "rename")
        mdt_stats.nb_getattr = lustre.get_stats_field(raw_stats, "getattr")
        mdt_stats.nb_setattr = lustre.get_stats_field(raw_stats, "setattr")
        mdt_stats.nb_getxattr = lustre.get_stats_field(raw_stats, "getxattr")
        mdt_stats.nb_link = lustre.get_stats_field(raw_stats, "link")
        mdt_stats.nb_statfs = lustre.get_stats_field(raw_stats, "statfs")

        return mdt_stats
Пример #5
0
    def get_stats(self, fs) :
        stats = lustre_client_stats()
        raw_stats = lustre.read_stats(self.proc_llite_path+"/"+fs+"/stats")
        stats.timestamp    = raw_stats["timestamp"]

        (stats.read_count, stats.read_bytes)   = \
            lustre.get_stats_field(raw_stats, "read_bytes", "SUM")
        (stats.write_count, stats.write_bytes) = \
            lustre.get_stats_field(raw_stats, "write_bytes", "SUM")

        #https://jira.hpdd.intel.com/browse/LUDOC-220
        (stats.osc_read_count, stats.osc_read_bytes)   = \
            lustre.get_stats_field(raw_stats, "osc_read", "SUM")
        (stats.osc_write_count, stats.osc_write_bytes) = \
            lustre.get_stats_field(raw_stats, "osc_write", "SUM")

        #Don't assume a stat is present
        for field in stats.counter_list:
            stats.set_counter(
                field, 
                lustre.get_stats_field(raw_stats, field, "COUNT")
            )

        return stats
Пример #6
0
    def get_stats(self) :
        stats = lustre_ost_stats()

        # Num exports
        with open(self.proc_path+"/num_exports", "r") as fd:
            stats.nb_exports = int(fd.readline())

        # Basic OST stats
        raw_stats = lustre.read_stats(self.proc_path+"/stats")
        stats.timestamp_rw = raw_stats['timestamp']
        (stats.read_count, stats.read_bytes)   = \
            lustre.get_stats_field(raw_stats, "read_bytes", "SUM")
        (stats.write_count, stats.write_bytes) = \
            lustre.get_stats_field(raw_stats, "write_bytes", "SUM")
            
        # Block IO OST stats
        try:
            with open(self.proc_path+"/brw_stats", "r") as fd:
                #This file has 7 sections
                # 1: "pages per bulk r/w"
                # 2: "discontiguous pages"
                # 3: "discontiguous blocks"
                # 4: "disk fragmented I/Os"
                # 5: "disk I/Os in flight"
                # 6: "I/O time (1/1000s)"
                # 7: "disk I/O size"
                sectionNo = 0
                data = {}
                for line in fd.readlines() :
                    #if len(line) == 0 or line.startswith('') : continue
                    if not line.strip() : continue
                    line_parts = line.split()

                    #If a line begins with a number, we assume we are in a section
                    #and we store in the appropriate array
                    if line[0].isdigit() :
                        #print "Ligne({0}): {1}".format(len(line),line)
                        #Build an array with the data from this section
                        if sectionNo not in data: data[sectionNo] = []
                        data[sectionNo].append(line_parts)
                    #Otherwise, First grab the timestamp
                    elif line_parts[0] == "snapshot_time:" :
                        stats.timestamp_brw = float(line_parts[1])
                    #Next, Identify if we are beginning a new section
                    elif line_parts[0] == "pages" :
                        sectionNo = 1
                        continue
                    elif line_parts[0] == "discontiguous" :
                        if line_parts[1] == "pages" :
                            sectionNo = 2
                        elif line_parts[1] == "blocks" :
                            sectionNo = 3
                        continue
                    elif line_parts[0] == "disk" :
                        if line_parts[1] == "fragmented" :
                            sectionNo = 4
                        elif line_parts[1] == "I/Os" :
                            sectionNo = 5
                        elif line_parts[1] == "I/O" :
                            sectionNo = 7
                        continue
                    elif line_parts[0] == "I/O" :
                        sectionNo = 6
                        continue

                #Parse actual data
                for line_parts in data[7] :
                    #Disk I/O size
                    size = int(line_parts[0][:-2])
                    if line_parts[0][-2:][:1] == 'M' :
                        size = size * 1024
                    stats.IO_size_KB[size] = {}
                    stats.IO_size_KB[size]["read"]  = long(line_parts[1])
                    stats.IO_size_KB[size]["write"] = long(line_parts[5])   
        except IOError :
            #brw_stats not found. 
            #Assume ZFS
            stats.has_brw_stats = 0
            pass

        return stats