Sha256: 92609dca52842d92dea8f229e55f4756f0fd3875ceb4d19191e92ca2609bb680
Contents?: true
Size: 871 Bytes
Versions: 1
Compression:
Stored size: 871 Bytes
Contents
#!/usr/bin/ruby require 'rubygems' require 'keystone' require 'pit' require 'pp' include Keystone::Batch::Base config = Pit.get("disk_size_check") SMTP_SERVER = config["smtp"] MAIL_TO = [config["mailto"]] ERROR_MAIL_TO = MAIL_TO MAIL_FROM = config["mailfrom"] @os = Keystone::Os.get() pp @os def send_alert_mail(additional_body = "") title = 'disk size alert' body = <<-BODY disk size alert at #{@os.hostname}(#{@os.ip_address.join(" , ")}) #{@df_result} #{additional_body} BODY Keystone::Mail::Send.send( MAIL_FROM, MAIL_TO, title, body, {:retry_cnt=>3} ) end execute() do info "start batch" limit = 80 limit = Integer(ARGV[0]) if ARGV.size > 0 @df_result = @os.disk @df_result.gsub(/(\d+)%/){|s| if $1.to_i >= limit warn 'log size alert' send_alert_mail break end } info "finish batch" end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kanamei-keystone-0.0.20 | bin/disk_size_check.rb |