Sha256: 96f2596ed0e8acbac073a5d98ab91f73113d3dca572a794551be455c1833ff00

Contents?: true

Size: 551 Bytes

Versions: 51

Compression:

Stored size: 551 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

51 entries across 51 versions & 1 rubygems

Version Path
kurchatov-0.4.7 examples/net_stat.rb
kurchatov-0.4.6 examples/net_stat.rb
kurchatov-0.4.5 examples/net_stat.rb
kurchatov-0.4.4 examples/net_stat.rb
kurchatov-0.4.3 examples/net_stat.rb
kurchatov-0.4.2 examples/net_stat.rb
kurchatov-0.4.1 examples/net_stat.rb
kurchatov-0.3.8 examples/net_stat.rb
kurchatov-0.3.7 examples/net_stat.rb
kurchatov-0.3.6 examples/net_stat.rb
kurchatov-0.3.5 examples/net_stat.rb
kurchatov-0.3.4 examples/net_stat.rb
kurchatov-0.3.3 examples/net_stat.rb
kurchatov-0.3.2 examples/net_stat.rb
kurchatov-0.3.1 examples/net_stat.rb
kurchatov-0.3.0 examples/net_stat.rb
kurchatov-0.2.9 examples/net_stat.rb
kurchatov-0.2.8 examples/net_stat.rb
kurchatov-0.2.7 examples/net_stat.rb
kurchatov-0.2.6 examples/net_stat.rb