From 42236350152cccfe86e1ec953042e26c9c6dee23 Mon Sep 17 00:00:00 2001 From: Stephen McElroy Date: Mon, 19 Dec 2016 21:10:45 -0600 Subject: [PATCH 1/4] Update pool.rb #Percentage was not showing the right ratio, changed vaule by replacing pretty with .to_s('TB') + #this really should be done with the Max value as well to make sure no matter the size + # Both values are in the same size value --- jobs/pool.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/jobs/pool.rb b/jobs/pool.rb index c801d96..0080c37 100644 --- a/jobs/pool.rb +++ b/jobs/pool.rb @@ -17,15 +17,21 @@ result = %x( timeout 3 ceph df -f json ) # update total storage widget + # *updated this to work with Jewel release storage = JSON.parse(result) - used = storage['stats']['total_used'].to_i - total = storage['stats']['total_space'].to_i + used = storage['stats']['total_used_bytes'].to_i + total = storage['stats']['total_bytes'].to_i + + #Percentage was not showing the right ratio, changed vaule by replacing pretty with .to_s('TB') + #this really should be done with the Max value as well to make sure no matter the size + # Both values are in the same size value send_event('storage', { - value: Filesize.from("#{used} KB").pretty.split(' ').first.to_f, + value: Filesize.from("#{used} B").to_s('TB'), min: 0, - max: Filesize.from("#{total} KB").pretty.split(' ').first.to_f, - moreinfo: Filesize.from("#{used} KB").pretty + " out of " + Filesize.from("#{total} KB").pretty + max: Filesize.from("#{total} B").pretty.split(' ').first.to_f, + #max:storage['stats']['total_bytes'].pretty.to_i, + moreinfo: Filesize.from("#{used} B").pretty + " out of " + Filesize.from("#{total} B").pretty } ) From dc0d7231246c1613ab53734c978cdfb6846b100c Mon Sep 17 00:00:00 2001 From: Stephen McElroy Date: Mon, 19 Dec 2016 21:23:59 -0600 Subject: [PATCH 2/4] Update traffic.rb --- jobs/traffic.rb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/jobs/traffic.rb b/jobs/traffic.rb index 1f25f07..5e77384 100644 --- a/jobs/traffic.rb +++ b/jobs/traffic.rb @@ -17,10 +17,13 @@ end # detect if ceph osd pool stats is available (>=emperor) +# pool stats are availible but dont contain iops setting pool stats to false (>=jewel) +# probaly best to comment out that whole section + result = %x( ceph osd pool stats -f json 2>&1) begin poolstats = JSON.parse(result) - poolstats_available = true + poolstats_available = false rescue poolstats_available = false end @@ -53,7 +56,7 @@ end end else - result = %x( timeout 2 ceph status -f json ) + result = %x( timeout 2 ceph -s -f json ) status = JSON.parse(result) if status['pgmap'].has_key?('read_bytes_sec') @@ -62,8 +65,11 @@ if status['pgmap'].has_key?('write_bytes_sec') points_wr.last[:y] = points_wr.last[:y] + status['pgmap']['write_bytes_sec'].to_i end - if status['pgmap'].has_key?('op_per_sec') - points_iops.last[:y] = points_iops.last[:y] + status['pgmap']['op_per_sec'].to_i + if status['pgmap'].has_key?('write_op_per_sec') + points_iops.last[:y] = points_iops.last[:y] + status['pgmap']['write_op_per_sec'].to_i + end + if status['pgmap'].has_key?('read_op_per_sec') + points_iops.last[:y] = points_iops.last[:y] + status['pgmap']['read_op_per_sec'].to_i end end From 716ffd5b0a6ff5ed5d32e6e0699adf61011ad59b Mon Sep 17 00:00:00 2001 From: Stephen McElroy Date: Mon, 19 Dec 2016 21:29:53 -0600 Subject: [PATCH 3/4] Update traffic.rb Taking out and updating parts of the code that no longer work with the current release (>=jewel) --- jobs/traffic.rb | 39 ++++++++++----------------------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/jobs/traffic.rb b/jobs/traffic.rb index 5e77384..04d33f9 100644 --- a/jobs/traffic.rb +++ b/jobs/traffic.rb @@ -17,16 +17,14 @@ end # detect if ceph osd pool stats is available (>=emperor) -# pool stats are availible but dont contain iops setting pool stats to false (>=jewel) -# probaly best to comment out that whole section - -result = %x( ceph osd pool stats -f json 2>&1) -begin - poolstats = JSON.parse(result) - poolstats_available = false -rescue - poolstats_available = false -end +# pool stats no longer needed, commenting this out (>=jewel) +#result = %x( ceph osd pool stats -f json 2>&1) +#begin +# poolstats = JSON.parse(result) +# poolstats_available = false +#rescue +# poolstats_available = false +#end SCHEDULER.every '2s' do @@ -38,24 +36,8 @@ points_iops << { x: points_iops.last[:x] + 1, y: 0 } - # if ceph osd pool stats is available, get the rw stats from that. - # otherwise, use ceph status, available in dumpling. - if poolstats_available - result = %x( timeout 2 ceph osd pool stats -f json ) - poolstats = JSON.parse(result) - - poolstats.each do |poolstat| - if poolstat['client_io_rate'].has_key?('read_bytes_sec') - points_rd.last[:y] = points_rd.last[:y] + poolstat['client_io_rate']['read_bytes_sec'].to_i - end - if poolstat['client_io_rate'].has_key?('write_bytes_sec') - points_wr.last[:y] = points_wr.last[:y] + poolstat['client_io_rate']['write_bytes_sec'].to_i - end - if poolstat['client_io_rate'].has_key?('op_per_sec') - points_iops.last[:y] = points_iops.last[:y] + poolstat['client_io_rate']['op_per_sec'].to_i - end - end - else + # if cep) osd pool stats is available, get the rw stats from that. + # otherwise) use ceph status, available in dumpling. result = %x( timeout 2 ceph -s -f json ) status = JSON.parse(result) @@ -71,7 +53,6 @@ if status['pgmap'].has_key?('read_op_per_sec') points_iops.last[:y] = points_iops.last[:y] + status['pgmap']['read_op_per_sec'].to_i end - end send_event('traffic', { From 33bb756c5a192e03e2c94351ea19e86c15f4b0d9 Mon Sep 17 00:00:00 2001 From: Stephen McElroy Date: Mon, 19 Dec 2016 21:46:53 -0600 Subject: [PATCH 4/4] Update pool.rb --- jobs/pool.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jobs/pool.rb b/jobs/pool.rb index 0080c37..bfced4f 100644 --- a/jobs/pool.rb +++ b/jobs/pool.rb @@ -27,7 +27,7 @@ # Both values are in the same size value send_event('storage', { - value: Filesize.from("#{used} B").to_s('TB'), + value: Filesize.from("#{used} B").to_s('TB').split(' ').first.to_f, min: 0, max: Filesize.from("#{total} B").pretty.split(' ').first.to_f, #max:storage['stats']['total_bytes'].pretty.to_i,