Sha256: eedadde2d55db98a9e593efc7e155544b599662e2ea74ac976521ee0cf59a693
Contents?: true
Size: 986 Bytes
Versions: 3
Compression:
Stored size: 986 Bytes
Contents
#! /usr/bin/env ruby # # check-entrophy # # DESCRIPTION: # # OUTPUT: # plain text # # PLATFORMS: # Linux # # DEPENDENCIES: # gem: sensu-plugin # # USAGE: # # NOTES: # # LICENSE: # Copyright 2011 Sonian, Inc <chefs@sonian.net> # Released under the same terms as Sensu (the MIT license); see LICENSE # for details. # require 'sensu-plugin/check/cli' # # Check Entropy # class CheckEntropy < Sensu::Plugin::Check::CLI option :warn, short: '-w WARN', proc: proc(&:to_i), default: 60 option :crit, short: '-c CRIT', proc: proc(&:to_i), default: 30 def run # rubocop:disable all unknown 'invalid entropy treshold' if config[:crit] < 0 || config[:warn] < 0 entropy = 0 File.open('/proc/sys/kernel/random/entropy_avail', 'r').each_line do |line| entropy = line.strip.split(/\s+/).shift.to_i end critical if entropy < config[:crit] warning if entropy < config[:warn] ok end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sensu-plugins-entropy-checks-0.0.3 | bin/check-entropy.rb |
sensu-plugins-entropy-checks-0.0.2 | bin/check-entropy.rb |
sensu-plugins-entropy-checks-0.0.1 | bin/check-entropy.rb |