Sha256: e9842f062cecfc24ebc9bb47239cc4f315a07eb6c8f3ba12d51347490d9530c0

Contents?: true

Size: 909 Bytes

Versions: 3

Compression:

Stored size: 909 Bytes

Contents

#! /usr/bin/env ruby
#  encoding: UTF-8
#
#   entropy-metrics
#
# DESCRIPTION:
#
# OUTPUT:
#   metric data
#
# PLATFORMS:
#   Linux
#
# DEPENDENCIES:
#   gem: sensu-plugin
#   gem: <?>
#
# 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'

#
# Entropy Graphite
#
class EntropyGraphite < 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}.entropy"

  def run
    File.open('/proc/sys/kernel/random/entropy_avail', 'r').each_line do |line|
      entropy = line.strip.split(/\s+/).shift
      output "#{config[:scheme]}", entropy
    end
    ok
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sensu-plugins-entropy-checks-0.0.3 bin/metrics-entropy.rb
sensu-plugins-entropy-checks-0.0.2 bin/metrics-entropy.rb
sensu-plugins-entropy-checks-0.0.1 bin/metrics-entropy.rb