class Malsh::CLI
Public Instance Methods
__print_version()
click to toggle source
# File lib/malsh/cli.rb, line 67 def __print_version puts Malsh::VERSION end
alert()
click to toggle source
# File lib/malsh/cli.rb, line 59 def alert Malsh.init options alerts = Malsh.alerts Malsh.notify_alert('アラート一覧', alerts) end
maverick()
click to toggle source
# File lib/malsh/cli.rb, line 33 def maverick Malsh.init options hosts = Parallel.map(Malsh.hosts) do |h| h if h.roles.keys.size < 1 end.flatten.compact Malsh.notify_host("ロール無所属ホスト一覧", hosts) end
retire()
click to toggle source
# File lib/malsh/cli.rb, line 17 def retire Malsh.init options hosts = Parallel.map(Malsh.hosts) do |h| m = Malsh.host_metrics( h.id, Malsh.host_metric_names(h.id).first, Time.now.to_i - 86400, Time.now.to_i ) h if (!m || (m["metrics"] && m["metrics"].size == 0)) && !(h["meta"].has_key?("cloud") && %w(elb rds cloudfront).include?(h["meta"]["cloud"]["provider"])) end.flatten.compact Malsh.notify_host("退役未了ホスト一覧", hosts) end
search()
click to toggle source
# File lib/malsh/cli.rb, line 48 def search Malsh.init options o = options[:status] ? { status: options[:status] } : {} hosts = Malsh.hosts(o) Object.const_get("Malsh::HostMetrics").constants.each do |c| hosts = Object.const_get("Malsh::HostMetrics::#{c}").check(hosts) end Malsh.notify_host("ホスト一覧", hosts.compact) end