Sha256: c1b3c8ed80a66309c5660ca8b91865b56f635bf38052111dd61e6885d28fdb61
Contents?: true
Size: 1.51 KB
Versions: 1
Compression:
Stored size: 1.51 KB
Contents
module Nagios module ZFS class ZpoolPlugin < NagiosPlugin::Plugin include Mixlib::CLI option :zpool, :short => '-p ZPOOL_NAME', :long => '--pool ZPOOL_NAME', :required => true option :critical, :short => '-c CRITICAL_CAPACITY', :long => '--critical CRITICAL_CAPACITY', :proc => Proc.new { |config| config.to_i } option :warning, :short => '-w WARNING_CAPACITY', :long => '--warning WARNING_CAPACITY', :proc => Proc.new { |config| config.to_i } def initialize super parse_options(argv) end def critical? critical_capacity? || critical_health? end def warning? warning_capacity? || warning_health? end # No explicite ok check. def ok? true end def message "#{zpool.name} #{zpool.health} (#{zpool.capacity}%)" end private def critical_capacity? zpool.capacity >= config[:critical] end def warning_capacity? zpool.capacity >= config[:warning] end def critical_health? zpool.health == 'FAULTED' end def warning_health? zpool.health == 'DEGRADED' end def zpool @zpool ||= Zpool.new(config[:zpool]) end # Array of command-line arguments # # This is only used for stubbing ARGV during tests which isn't so # easy with mixlib-cli. def argv ARGV end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nagios-zfs-0.2.0 | lib/nagios/zfs/zpool_plugin.rb |