Created
May 21, 2009 22:46
-
-
Save mmb/115799 to your computer and use it in GitHub Desktop.
get number of active and allowed connections from a DD-WRT router
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/ruby | |
# get number of active and allowed connections from a DD-WRT router | |
require 'rubygems' | |
require 'net/ssh' | |
Net::SSH.start('192.168.0.1', 'root') do |ssh| | |
max = ssh.exec!('cat /proc/sys/net/ipv4/netfilter/ip_conntrack_max').strip | |
tcp = ssh.exec!('grep -c ^tcp /proc/net/ip_conntrack').strip | |
udp = ssh.exec!('grep -c ^udp /proc/net/ip_conntrack').strip | |
puts "#{udp}u+#{tcp}t/#{max}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment