diff --git a/api-daemon/pvcapid/flaskapi.py b/api-daemon/pvcapid/flaskapi.py index 4cd6c82c..c67956e0 100755 --- a/api-daemon/pvcapid/flaskapi.py +++ b/api-daemon/pvcapid/flaskapi.py @@ -2489,7 +2489,7 @@ class API_Storage_Ceph_Utilization(Resource): type: string description: The raw output data """ - return api_helper.ceph_radosdf() + return api_helper.ceph_util() api.add_resource(API_Storage_Ceph_Utilization, '/storage/ceph/utilization') # /storage/ceph/option diff --git a/api-daemon/pvcapid/helper.py b/api-daemon/pvcapid/helper.py index 8f250409..4659b8d2 100755 --- a/api-daemon/pvcapid/helper.py +++ b/api-daemon/pvcapid/helper.py @@ -984,12 +984,12 @@ def ceph_status(): return retdata, retcode -def ceph_radosdf(): +def ceph_util(): """ Get the current Ceph cluster utilization. """ zk_conn = pvc_common.startZKConnection(config['coordinators']) - retflag, retdata = pvc_ceph.get_radosdf(zk_conn) + retflag, retdata = pvc_ceph.get_util(zk_conn) pvc_common.stopZKConnection(zk_conn) if retflag: diff --git a/daemon-common/ceph.py b/daemon-common/ceph.py index 426bf7ea..1c22bdcd 100644 --- a/daemon-common/ceph.py +++ b/daemon-common/ceph.py @@ -154,9 +154,9 @@ def get_status(zk_conn): } return True, status_data -def get_radosdf(zk_conn): +def get_util(zk_conn): primary_node = zkhandler.readdata(zk_conn, '/primary_node') - ceph_df = zkhandler.readdata(zk_conn, '/ceph/radosdf').rstrip() + ceph_df = zkhandler.readdata(zk_conn, '/ceph/util').rstrip() # Create a data structure for the information status_data = { diff --git a/node-daemon/pvcnoded/Daemon.py b/node-daemon/pvcnoded/Daemon.py index 6c1e304e..6fe9a2e4 100644 --- a/node-daemon/pvcnoded/Daemon.py +++ b/node-daemon/pvcnoded/Daemon.py @@ -1049,7 +1049,7 @@ def collect_ceph_stats(queue): print("Set ceph health information in zookeeper (primary only)") command = { "prefix": "status", "format": "pretty" } - ceph_status = ceph_conn.mon_command(json.dumps(command), b'', timeout=1)[1] + ceph_status = ceph_conn.mon_command(json.dumps(command), b'', timeout=1)[1].decode('ascii') try: zkhandler.writedata(zk_conn, { '/ceph': str(ceph_status) @@ -1062,14 +1062,14 @@ def collect_ceph_stats(queue): print("Set ceph rados df information in zookeeper (primary only)") # Get rados df info - retcode, stdout, stderr = common.run_os_command('rados df', timeout=1) - rados_df = stdout + command = { "prefix": "df", "format": "pretty" } + ceph_df = ceph_conn.mon_command(json.dumps(command), b'', timeout=1)[1].decode('ascii') try: zkhandler.writedata(zk_conn, { - '/ceph/radosdf': str(rados_df) + '/ceph/util': str(ceph_df) }) except Exception as e: - logger.out('Failed to set Rados space data: {}'.format(e), state='e') + logger.out('Failed to set Ceph utilization data: {}'.format(e), state='e') return if debug: @@ -1337,10 +1337,13 @@ def collect_vm_stats(queue): # Get all the raw information about the VM if debug: - print("Getting statistics for VM {}".format(domain_name)) + print("Getting general statistics for VM {}".format(domain_name)) domain_state, domain_maxmem, domain_mem, domain_vcpus, domain_cputime = domain.info() domain_memory_stats = domain.memoryStats() domain_cpu_stats = domain.getCPUStats(True)[0] + + if debug: + print("Getting disk statistics for VM {}".format(domain_name)) domain_disk_stats = [] for disk in tree.findall('devices/disk'): disk_name = disk.find('source').get('name') @@ -1356,6 +1359,8 @@ def collect_vm_stats(queue): "err": disk_stats[4] }) + if debug: + print("Getting network statistics for VM {}".format(domain_name)) domain_network_stats = [] for interface in tree.findall('devices/interface'): interface_name = interface.find('target').get('dev')