Created
February 10, 2014 02:04
-
-
Save yuya-takeyama/8909135 to your computer and use it in GitHub Desktop.
Apache のプロセス数をリアルタイムに関しするヤツ
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 | |
HOSTS = [] # 対象ホスト名を配列で指定 | |
TIME_SIZE = 19 | |
SIZE = 15 | |
num = 0 | |
loop do | |
if num == 0 then | |
print "|" + (" " * TIME_SIZE) | |
print "|" | |
HOSTS.each do |host| | |
print((host).ljust(SIZE - 1) + "|") | |
end | |
puts | |
end | |
print "|" + Time.now.strftime("%Y-%m-%d %H:%M:%S").ljust(TIME_SIZE) | |
print "|" | |
HOSTS.each do |host| | |
print((`ssh #{host} ps aux | grep httpd | grep -v grep | wc -l`.chop + "|").rjust(SIZE)) | |
end | |
puts | |
num +=1 | |
num = 0 if num >= 5 | |
sleep 10 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment