Created
May 15, 2014 21:43
-
-
Save lchi/0504d8daba72c245754b to your computer and use it in GitHub Desktop.
memcache stats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
stats_prev = {} | |
loop do | |
stats = {} | |
stats_output = `echo 'stats' | nc localhost 11211 | sed 's/STAT //g' | grep -v END` | |
stats_output.split("\n").each do |line| | |
k, v = line.split(" ") | |
stats[k] = v.to_i | |
end | |
stats_prev.each_pair do |k,v| | |
puts "#{k}: #{stats[k] - v}/s" | |
end | |
stats_prev = stats | |
puts "" | |
sleep(1) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment