Sha256: ec09e6e49cfc552c64df5774235a5e0e80118ea80a224a5fa546c8a6953fcd31

Contents?: true

Size: 557 Bytes

Versions: 14

Compression:

Stored size: 557 Bytes

Contents

interval 5
default[:ports] = [80, 3994]

collect do

  filter = nil
  plugin.ports.each do |port|
    if filter == nil
      filter = "\\( src *:#{port}"
    else
      filter += " or src *:#{port}"
    end
  end
  filter += " \\) and not dst 127.0.0.1:*"
  cmd    = 'ss -t -4 -n state established ' + filter + ' | wc -l'

  count = shell!(cmd).to_i - 1

  event(
    :service     => "netstat tcp #{plugin.ports.join(', ')}",
    :metric      => count,
    :description => "count established connects: #{count} to ports #{plugin.ports.join(', ')}"
  )

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
kurchatov-0.0.5.pre5 examples/net_stat.rb
kurchatov-0.0.5.pre4 examples/net_stat.rb
kurchatov-0.0.5.pre2 examples/net_stat.rb
kurchatov-0.0.5.pre1 examples/net_stat.rb
kurchatov-0.0.4 examples/net_stat.rb
kurchatov-0.0.4d examples/net_stat.rb
kurchatov-0.0.4c examples/net_stat.rb
kurchatov-0.0.4b examples/net_stat.rb
kurchatov-0.0.3 examples/net_stat.rb
kurchatov-0.0.3b examples/net_stat.rb
kurchatov-0.0.3a examples/net_stat.rb
kurchatov-0.0.2 examples/net_stat.rb
kurchatov-0.0.2b examples/net_stat.rb
kurchatov-0.0.1 examples/net_stat.rb