This commit is contained in:
mwiegand 2022-08-11 19:31:19 +02:00
parent 8f1d04b1cf
commit f84da71819

View file

@ -1,12 +1,12 @@
dir = Path[ENV.fetch("PSI_DIR", "/proc/pressure")]
time = Time.utc.to_s("%s%9N")
Dir.children(dir).each do |ressource|
File.read_lines(dir/ressource).each do |line|
Dir.children(dir).each do |resource|
File.read_lines(dir/resource).each do |line|
parts = line.split
type = parts[0]
metrics = parts[1..-1].map{ |part| part.split('=') }.to_h
puts %(pressure_stall,ressource=#{ressource},type=#{type} avg10=#{metrics["avg10"]},avg60=#{metrics["avg60"]},avg300=#{metrics["avg300"]},total=#{metrics["total"]} #{time})
puts %(pressure_stall,resource=#{resource},type=#{type} avg10=#{metrics["avg10"]},avg60=#{metrics["avg60"]},avg300=#{metrics["avg300"]},total=#{metrics["total"]} #{time})
end
end