Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lordcirth
Last active September 20, 2019 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lordcirth/d9a1e21465c8f9f5a4cd6e07e6b7725b to your computer and use it in GitHub Desktop.
Save lordcirth/d9a1e21465c8f9f5a4cd6e07e6b7725b to your computer and use it in GitHub Desktop.
gnuplot script for OSD utilization
ceph osd df class hdd -f json | jq '.nodes[].utilization' > ~/util
gnuplot util.plot < util
feh histogram.png
reset
n=100 #number of intervals
max=100. #max value
min=0. #min value
width=(max-min)/n #interval width
#function used to map a value to the intervals
hist(x,width)=width*floor(x/width)+width/2.0
set term png #output terminal and file
set output "histogram.png"
set xrange [min:max]
set yrange [0:]
#to put an empty boundary around the
#data inside an autoscaled graph.
set offset graph 0.05,0.05,0.05,0.0
set xtics min,(max-min)/5,max
set boxwidth width*0.9
set style fill solid 0.5 #fillstyle
set tics out nomirror
set xlabel "x"
set ylabel "Frequency"
#count and plot
plot "< cat -" u (hist($1,width)):(1.0) smooth freq w boxes lc rgb"green" notitle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment