Sha256: 39d9910c20f67d60122fb5b6b9fe7e28bd77d74799f3c25ac1fe989b73c270ab

Contents?: true

Size: 951 Bytes

Versions: 4

Compression:

Stored size: 951 Bytes

Contents

e #! /usr/bin/env ruby
#  encoding: UTF-8
#
#   conntrack-metrics
#
# DESCRIPTION:
#
# OUTPUT:
#   plain text
#
# PLATFORMS:
#   Linux
#
# DEPENDENCIES:
#   gem: sensu-plugin
#
# USAGE:
#
# NOTES:
#
# LICENSE:
#   Copyright 2012 Sonian, Inc <chefs@sonian.net>
#   Released under the same terms as Sensu (the MIT license); see LICENSE
#   for details.
#

require 'sensu-plugin/metric/cli'
require 'socket'

#
# Conntrack
#
class Conntrack < Sensu::Plugin::Metric::CLI::Graphite
  option :scheme,
         description: 'Metric naming scheme, text to prepend to .$parent.$child',
         long: '--scheme SCHEME',
         default: "#{Socket.gethostname}.conntrack.connections"

  option :table,
         description: 'Table to count',
         long: '--table TABLE',
         default: 'conntrack'

  def run
    value = `conntrack -C #{config[:table]}`.strip
    timestamp = Time.now.to_i

    output config[:scheme], value, timestamp

    ok
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sensu-plugins-conntrack-0.0.3 bin/metrics-conntrack.rb
sensu-plugins-conntrack-0.0.2 bin/metrics-conntrack.rb
sensu-plugins-conntrack-0.0.1 bin/metrics-conntrack.rb
sensu-plugins-conntrack-0.0.1.alpha.1 bin/metrics-conntrack.rb