Skip to content

Instantly share code, notes, and snippets.

@kisoku
Created August 12, 2009 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kisoku/166529 to your computer and use it in GitHub Desktop.
Save kisoku/166529 to your computer and use it in GitHub Desktop.
$ ack net_counters
darwin/network.rb
171:net_counters = Mash.new
179: net_counters[ifname] = Mash.new unless net_counters[ifname]
180: net_counters[ifname] = { :rx => { :bytes => $5, :packets => $3, :errors => $4, :drop => 0, :overrun => 0, :frame => 0, :compressed => 0, :multicast => 0 },
187:counters[:network][:interfaces] = net_counters
freebsd/network.rb
85:net_counters = Mash.new
97: net_counters[$1] = Mash.new unless net_counters[$1]
98: net_counters[$1]["rx"] = Mash.new unless net_counters[$1]["rx"]
99: net_counters[$1]["tx"] = Mash.new unless net_counters[$1]["tx"]
100: net_counters[$1]["rx"]["packets"] = $3
101: net_counters[$1]["rx"]["errors"] = $4
102: net_counters[$1]["rx"]["bytes"] = $5
103: net_counters[$1]["tx"]["packets"] = $6
104: net_counters[$1]["tx"]["errors"] = $7
105: net_counters[$1]["tx"]["bytes"] = $8
106: net_counters[$1]["tx"]["collisions"] = $9
107: net_counters[$1]["tx"]["dropped"] = $10
112:counters[:network][:interfaces] = net_counters
linux/network.rb
34:net_counters = Mash.new
78: net_counters[cint] = Mash.new unless net_counters[cint]
79: net_counters[cint][:rx] = { "packets" => $1, "errors" => $2, "drop" => $3, "overrun" => $4, "frame" => $5 }
82: net_counters[cint][:tx] = { "packets" => $1, "errors" => $2, "drop" => $3, "overrun" => $4, "carrier" => $5 }
85: net_counters[cint][:tx]["collisions"] = $1
88: net_counters[cint][:tx]["queuelen"] = $1
91: net_counters[cint][:rx]["bytes"] = $1
94: net_counters[cint][:tx]["bytes"] = $1
110:counters[:network][:interfaces] = net_counters
openbsd/network.rb
87:net_counters = Mash.new
99: net_counters[$1] = Mash.new unless net_counters[$1]["counters"]
100: net_counters[$1] = Mash.new unless net_counters[$1]["counters"]["rx"]
101: net_counters[$1] = Mash.new unless net_counters[$1]["counters"]["tx"]
102: net_counters[$1] = $3
103: net_counters[$1] = $4
104: net_counters[$1] = $5
105: net_counters[$1] = $6
106: net_counters[$1] = $7
107: net_counters[$1] = $8
112:pp net_counters
113:counters[:network][:interfaces] = net_counters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment