1
0
mirror of https://github.com/tmate-io/tmate-ssh-server.git synced 2020-11-18 19:53:51 -08:00

Stats on the number unique IPs

This commit is contained in:
Nicolas Viennot 2013-06-14 19:36:46 -04:00
parent 7f2759484a
commit f1160be564

View File

@ -16,6 +16,7 @@ StatsD.mode = 'production'
loop do
server_count = 0
client_count = 0
ips = []
Dir['/proc/*/cmdline'].map do |f|
if File.open(f).read =~ /^tmate-slave \[(.+)\] \((.+)\) (.+)$/
@ -25,11 +26,13 @@ loop do
server_count += 1 if role == 'server'
client_count += 1 if role == 'client'
ips << ip
end
end
StatsD.gauge('tmate.server_count', server_count)
StatsD.gauge('tmate.client_count', client_count)
StatsD.gauge('tmate.servers', server_count)
StatsD.gauge('tmate.clients', client_count)
StatsD.gauge('tmate.unique_ips', ips.uniq.count)
sleep 10
end