Sha256: 254535e7183aae4483f2400498a300ea07158e9e836818c3539d195026259a4e

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

#! /usr/bin/env ruby
#
#   unicorn-metrics
#
# DESCRIPTION:
#
# OUTPUT:
#   metric data
#
# PLATFORMS:
#   Linux
#
# DEPENDENCIES:
#   gem: sensu-plugin
#   gem: raindrops
#
# USAGE:
#
# NOTES:
#
# LICENSE:
#   Copyright 2014 Sonian, Inc. and contributors. <support@sensuapp.org>
#   Released under the same terms as Sensu (the MIT license); see LICENSE
#   for details.
#

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

class UnicornMetrics < Sensu::Plugin::Metric::CLI::Graphite
  option :scheme,
         description: 'Metric naming scheme, text to prepend to metric',
         short: '-s SCHEME',
         long: '--scheme SCHEME',
         default: "#{Socket.gethostname}.unicorn"

  option :socket,
         description: 'Unicorn socket path',
         short: '-p SOCKET',
         long: '--socket-path SOCKET',
         default: '/tmp/unicorn.sock'

  def run
    stats = Raindrops::Linux.unix_listener_stats([config[:socket]])[config[:socket]]

    output "#{config[:scheme]}.active", stats.active
    output "#{config[:scheme]}.queued", stats.queued
    ok
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sensu-plugins-unicorn-1.0.1 bin/metrics-unicorn.rb
sensu-plugins-unicorn-1.0.0 bin/metrics-unicorn.rb
sensu-plugins-unicorn-0.0.4 bin/metrics-unicorn.rb