malsh 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f57d61ecea6999ff0d35382a91d7e75bfddb89fd
4
- data.tar.gz: 54e68023c18a8986a7ed2ed622b2a269e846fd40
3
+ metadata.gz: 7bc1c3a356c2adcf0d6fe93e26215d5ec733b762
4
+ data.tar.gz: 3f647317f7a914ce6c0409972c22effa21ff8a69
5
5
  SHA512:
6
- metadata.gz: b180f61a9316c5743588af5266b7c9af0ef5a5ec62b67f209c8a25036da224833d182b67b4eac5dc3148dea82a5e44a3ff5d2a10c8b31a07dbd02a5d5811370b
7
- data.tar.gz: 698feecf25f60f438b40da1d41dc5a4497d214330fc8a33230a6eff0a95b6ce6a6139df6931cf91fc9dfc1e55c498c2047c6d1bb763b3029880cd1611c99f540
6
+ metadata.gz: 5d09534b84899e65215a60a6a3fbf977c5e21988b1187157c3812b7435b6c6da62cdf37e0be6c5b5240551139a289d9b5fdb96a60f2306e75e28488bbf606198
7
+ data.tar.gz: 486cb75698d3d3a2e17321275c03977cdd014b3c33bec5b11ad16d792401cb0aa49a2e5c2f48b1dff161fea30f0a776b2d0e5fcebc93df7ce5c9ef17eef3f011
data/README.md CHANGED
@@ -36,7 +36,7 @@ $ malsh maverick --subject 無所属ホスト
36
36
  $ malsh search --regex dev local$ --subject developmentホスト
37
37
 
38
38
  # CPUとメモリの過去7日間の最高使用率が40%以下のホストをを検知
39
- $ malsh search --cpu 40 --memory 40 --subject 過去7日間のCPU、メモリがの最高使用率が40%以下
39
+ $ malsh search --past_date 7 --cpu 40 --memory 40 --subject 過去7日間のCPU、メモリがの最高使用率が40%以下
40
40
  ```
41
41
 
42
42
  ## options
data/lib/malsh/cli.rb CHANGED
@@ -38,11 +38,12 @@ module Malsh
38
38
  option :past_date , :type => :numeric, :aliases => :p
39
39
  option :cpu_threshold, :type => :numeric, :aliases => :c
40
40
  option :memory_threshold, :type => :numeric, :aliases => :m
41
+ option :status, :type => :string, :aliases => :st
41
42
  def search
42
43
  _host_names = {}
43
44
  Malsh.init options
44
-
45
- hosts = Malsh.hosts
45
+ o = options[:status] ? { status: options[:status] } : {}
46
+ hosts = Malsh.hosts(o)
46
47
  Object.const_get("Malsh::HostMetrics").constants.each do |c|
47
48
  hosts = Object.const_get("Malsh::HostMetrics::#{c}").check(hosts)
48
49
  end
data/lib/malsh/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Malsh
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
data/lib/malsh.rb CHANGED
@@ -30,8 +30,8 @@ module Malsh
30
30
  end
31
31
  end
32
32
 
33
- def hosts
34
- @_hosts ||= Mackerel.hosts.reject do |h|
33
+ def hosts(options = {})
34
+ @_hosts ||= Mackerel.hosts(options).reject do |h|
35
35
  Malsh.options[:invert_match] && Malsh.options[:invert_match].find {|v| h.name.match(/#{v}/) }
36
36
  end.reject do |h|
37
37
  Malsh.options[:regexp] && Malsh.options[:regexp].all? {|r| !h.name.match(/#{r}/)}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: malsh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - kazuhiko yamahsita
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-11 00:00:00.000000000 Z
11
+ date: 2016-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor