malsh 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/malsh/cli.rb +3 -2
- data/lib/malsh/version.rb +1 -1
- data/lib/malsh.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7bc1c3a356c2adcf0d6fe93e26215d5ec733b762
|
|
4
|
+
data.tar.gz: 3f647317f7a914ce6c0409972c22effa21ff8a69
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
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.
|
|
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:
|
|
11
|
+
date: 2016-01-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: thor
|