Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jewel: change benchmark test and add iops fields #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/ceph_latency_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def get_stats(self):
output = None
try:
output = subprocess.check_output(
"timeout 30s rados --cluster "+ self.cluster +" -p data bench 10 write -t 1 -b 65536 2>/dev/null | grep -i latency | awk '{print 1000*$3}'", shell=True)
"timeout 30s rados --cluster "+ self.cluster +" -p " + self.testpool + " bench 10 write -t 1 -b 65536 2>/dev/null | grep -i latency | awk '{print 1000*$3}'", shell=True)
except Exception as exc:
collectd.error("ceph-latency: failed to run rados bench :: %s :: %s"
% (exc, traceback.format_exc()))
Expand Down
35 changes: 32 additions & 3 deletions plugins/ceph_pool_plugin.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ def get_stats(self):
try:
osd_pool_cmdline='ceph osd pool stats -f json --cluster ' + self.cluster
stats_output = subprocess.check_output(osd_pool_cmdline, shell=True)
cephdf_cmdline='ceph df -f json --cluster ' + self.cluster
df_output = subprocess.check_output(ceph_dfcmdline, shell=True)
ceph_df_cmdline='ceph df -f json --cluster ' + self.cluster
df_output = subprocess.check_output(ceph_df_cmdline, shell=True)
pool_ls_cmdline='ceph osd pool ls -f json --cluster ' + self.cluster
pool_ls_output = subprocess.check_output(pool_ls_cmdline, shell=True)
except Exception as exc:
collectd.error("ceph-pool: failed to ceph pool stats :: %s :: %s"
% (exc, traceback.format_exc()))
Expand All @@ -66,15 +68,37 @@ def get_stats(self):
if df_output is None:
collectd.error('ceph-pool: failed to ceph df :: output was None')

if pool_ls_output is None:
collectd.error('ceph-pool: failed to ceph osd pool ls :: output was None')

json_stats_data = json.loads(stats_output)
json_df_data = json.loads(df_output)

json_rbd_data = {}
try:
json_pool_ls = json.loads(pool_ls_output)
for pool in json_pool_ls:
rbd_cmdline='rbd ls -l ' + pool + ' --format json --cluster ' + self.cluster
rbd_output = subprocess.check_output(rbd_cmdline, shell=True)
json_rbd_data[pool] = json.loads(rbd_output)
except Exception as exc:
collectd.error("ceph-pool: failed to rbd ls :: %s :: %s"
% (exc, traceback.format_exc()))
return

# provisioned per pool (kB)
provision = {}
for pool_name, rbd_list in json_rbd_data.items():
provision[pool_name] = 0
for rbd in rbd_list:
provision[pool_name] = provision[pool_name] + rbd['size']

# push osd pool stats results
for pool in json_stats_data:
pool_key = "pool-%s" % pool['pool_name']
data[ceph_cluster][pool_key] = {}
pool_data = data[ceph_cluster][pool_key]
for stat in ('read_bytes_sec', 'write_bytes_sec', 'op_per_sec'):
for stat in ('read_bytes_sec', 'write_bytes_sec', 'read_op_per_sec', 'write_op_per_sec'):
pool_data[stat] = pool['client_io_rate'][stat] if pool['client_io_rate'].has_key(stat) else 0

# push df results
Expand All @@ -96,6 +120,11 @@ def get_stats(self):
data[ceph_cluster]['cluster']['total_used'] = int(json_df_data['stats']['total_used']) * 1024.0
data[ceph_cluster]['cluster']['total_avail'] = int(json_df_data['stats']['total_avail']) * 1024.0

# push provisioned per pools
for pool_name, pool_provision in provision.items():
if pool_provision:
data[ceph_cluster]["pool-%s" % pool_name]['kb_provisioned'] = pool_provision

return data

try:
Expand Down