malsh 0.3.0 → 0.3.1

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
  SHA256:
3
- metadata.gz: 7618152e48a3184a6f9f031a40fc3d1ff48bc16541a545fb27aaf18664d17a8a
4
- data.tar.gz: 061b00940628b739d6b59dc38efd20fad83ab1f061774436450d09dad2a6c198
3
+ metadata.gz: '04893527ed6c71386b40145b68b31ae4bacce444e5d3edce147327789b18349b'
4
+ data.tar.gz: 1ef47a2b0df230ca310900b2036c3ea63ca8ce4f4058e572f9c3154069142563
5
5
  SHA512:
6
- metadata.gz: 7dc99e3b6b1afc7f72ad041d873803a4aa77b23d0443b6684bdcef79702163ba306f02987d1afa2e161a65a7e5413f76b8d0de57ec24b164e66ee44b55adf5ea
7
- data.tar.gz: be5c086daa10999317afd36754b576d4812e301624291c5bbf041a92055003843822cf932caa774faec1fcbe04f41cfff8b5efa460ed91c8181017239212174e
6
+ metadata.gz: ea062a8de9ff0d9b425b042b7aff1bb1bbaf43bc4aad3c9f020a936496f07cece395ccb1d0fd4c15fb90789437c95933d0d5287a34f897e43c4339978d394d1c
7
+ data.tar.gz: 7fbc8dc08cee0e942531086f53640653ca4cf27b7a66b0e836fa19396ae6a53cb20d1466f50ca5c6cb2725031b7541f430b2b2c00d5efd1b08d7acb4e551d021
@@ -83,5 +83,13 @@ module Malsh
83
83
  puts e
84
84
  end
85
85
  end
86
+
87
+ def host_metric_names(id)
88
+ begin
89
+ Mackerel.host_metric_names(id)
90
+ rescue => e
91
+ puts e
92
+ end
93
+ end
86
94
  end
87
95
  end
@@ -17,11 +17,15 @@ module Malsh
17
17
  def retire
18
18
  Malsh.init options
19
19
 
20
- hosts = Parallel.map(Malsh.metrics('memory.used')) do|memory|
21
- host = Malsh.host_by_id memory.first
22
- host if (!memory.last["memory.used"].respond_to?(:value) || !memory.last["memory.used"].value)
20
+ hosts = Parallel.map(Malsh.hosts) do |h|
21
+ m = Malsh.host_metrics(
22
+ h.id,
23
+ Malsh.host_metric_names(h.id).first,
24
+ Time.now.to_i - 86400,
25
+ Time.now.to_i
26
+ )
27
+ h if !m || m["metrics"].size == 0
23
28
  end.flatten.compact
24
-
25
29
  Malsh.notify_host("退役未了ホスト一覧", hosts)
26
30
  end
27
31
 
@@ -1,3 +1,3 @@
1
1
  module Malsh
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.add_dependency 'mackerel-rb'
27
27
  spec.add_dependency 'slack-notifier'
28
28
  spec.add_dependency 'parallel'
29
- spec.add_development_dependency "bundler", "~> 1.9"
30
- spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "bundler"
30
+ spec.add_development_dependency "rake"
31
31
  spec.add_development_dependency "rspec"
32
32
  end
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.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - kazuhiko yamahsita
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-30 00:00:00.000000000 Z
11
+ date: 2020-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -70,30 +70,30 @@ dependencies:
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '1.9'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '1.9'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '10.0'
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '10.0'
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -141,7 +141,7 @@ homepage: http://ten-snapon.com.
141
141
  licenses:
142
142
  - MIT
143
143
  metadata: {}
144
- post_install_message:
144
+ post_install_message:
145
145
  rdoc_options: []
146
146
  require_paths:
147
147
  - lib
@@ -156,9 +156,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
158
  requirements: []
159
- rubyforge_project:
160
- rubygems_version: 2.7.5
161
- signing_key:
159
+ rubygems_version: 3.0.6
160
+ signing_key:
162
161
  specification_version: 4
163
162
  summary: mackerel tools.
164
163
  test_files: []