Beispiel #1
0
 def get(self):
     cmd = ceph.ceph()
     isSuccess, execresult = cmd.execute('mdstat')
     if not isSuccess:
         abort(500, execresult)
     mdstat = json.loads(execresult)              
     return render_template('mds.html', 
                            mdstat=mdstat, config=self.config)
Beispiel #2
0
    def get(self, poolname):
        if poolname is None:
            cmd = ceph.ceph()
            isSuccess, execresult = cmd.execute('df')
            if not isSuccess:
                abort(500, execresult)
            pool_status = json.loads(execresult)
            stats = {}
            stats['total_used_bytes'] = pool_status['stats']['total_used_bytes']
            stats['total_bytes'] = pool_status['stats']['total_bytes']
            stats['total_avail_bytes'] = pool_status['stats']['total_avail_bytes']

            pools = []
            for pool in pool_status['pools']:
                tmp = {'id': pool['id'], 'name': pool['name'],
                       'objects': pool['stats']['objects'], 
                       'bytes_used': pool['stats']['bytes_used'],
                       'kb_used': pool['stats']['kb_used'], 
                       'max_avail': pool['stats']['max_avail'],}
                pools.append(tmp)
            return render_template('pools.html', stats=stats, pools=pools, config=self.config)
        else:
            with Rados(**self.clusterprop) as cluster:
                cmd = ceph.ceph()
                isSuccess, execresult = cmd.execute('osddump')
                if not isSuccess:
                    abort(500, execresult)
                osddump = json.loads(execresult)
                parameters = {}
                if 'pools' in osddump:
                    for pool in osddump['pools']:
                        if pool['pool_name'] == poolname:
                            parameters = pool
                poolstatus = getpoolstatus(cluster, str(poolname))
                return render_template('pool.html', poolname=poolname, poolstatus=poolstatus,
                                       parameters=parameters, config=self.config)
Beispiel #3
0
    def get(self):
            cmd = ceph.ceph()
            isSuccess, execresult = cmd.execute('osddf')
            if not isSuccess:
                abort(500, execresult)
            disk_status = json.loads(execresult)
            summary = disk_status['summary']

            isSuccess, execresult = cmd.execute('osdperf')
            if not isSuccess:
                abort(500, execresult)
            disk_perf = json.loads(execresult)

            isSuccess, execresult = cmd.execute('osdgetmaxosd')
            if not isSuccess:
                abort(500, execresult)
            disk_maxosd = json.loads(execresult)
            summary['max_osd'] = disk_maxosd['max_osd']
            summary['epoch'] = disk_maxosd['epoch']

            nodes = {}
            title = ['name','var','crush_weight','utilization','kb_used','kb_avail','kb',]
            for node in disk_status['nodes']:
                tmp = {}
                for t in title:
                    tmp[t] = node[t]
                nodes[node['id']] = tmp
            
            title.append('apply_latency_ms')
            title.append('commit_latency_ms')
            for perf in disk_perf['osd_perf_infos']:
                if perf['id'] in nodes:
                    nodes[perf['id']]['apply_latency_ms'] = perf['perf_stats']['apply_latency_ms']
                    nodes[perf['id']]['commit_latency_ms'] = perf['perf_stats']['commit_latency_ms']

            return render_template('disks.html', summary=summary, nodes=nodes, title=title, config=self.config)