watchmonkey_cli 1.8.6 → 1.9.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 623f20ce059d5f6b5b7a9681f22cf5ce6f165e13481b6707289be5d1a8fa2859
|
4
|
+
data.tar.gz: b4b3ab70d5aa2fb649cdbbaa0e2c99d2da446bfae49ef332bf2d65b3d551b391
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b82d300ad1617ded3156dc8fa1e82f27a435f9965134236d2b21fef7d8a2df2019e7e7786650ae3bc4c925d9cc9e27e9054b015ed3f514b0d88185c5f47d93b
|
7
|
+
data.tar.gz: 65a2ec5bad871ca993cebdee262461f11f175117377ecdad0261bda5fb780f6c5a6962d7447fb0c108541880377d8b8c4880d444b540886ad567051dcc703781
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.9.0
|
@@ -171,17 +171,30 @@ unix_mdadm :my_server
|
|
171
171
|
unix_mdadm :my_server, log_checking: false
|
172
172
|
|
173
173
|
|
174
|
+
# -----
|
175
|
+
# *nix CPUfreq scaling governor
|
176
|
+
# -----
|
177
|
+
# Checks if cpu scaling governor is set to correct value
|
178
|
+
# Host might be :local/false/nil which will test locally (without SSH)
|
179
|
+
# You can change the default message (The file ... does not exist) with the message option.
|
180
|
+
# To see which modes your CPU supports: cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
|
181
|
+
# Available options: expect(performance), query_file(/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
|
182
|
+
unix_cpu_governor :my_server
|
183
|
+
unix_cpu_governor :my_server, expect: "powersave"
|
184
|
+
|
185
|
+
|
174
186
|
# -----
|
175
187
|
# *nix defaults
|
176
188
|
# -----
|
177
|
-
# Combines unix_load, unix_memory, unix_df and
|
189
|
+
# Combines unix_load, unix_memory, unix_df, unix_mdadm and unix_cpu_governor.
|
178
190
|
# You can pass options or disable individual checkers by passing
|
179
191
|
# a hash whose keys are named after checkers.
|
180
192
|
unix_defaults :my_server
|
181
193
|
unix_defaults :my_server, unix_mdadm: false, unix_df: { min_percent: 10 }
|
182
194
|
|
183
195
|
# There are also the following shortcuts:
|
184
|
-
unix_defaults :my_server, load: [1, 2, 3]
|
185
|
-
unix_defaults :my_server, memory_min: 10
|
186
|
-
unix_defaults :my_server, df_min: 10
|
187
|
-
unix_defaults :my_server, mdadm: false
|
196
|
+
unix_defaults :my_server, load: [1, 2, 3] # Array(3) or false
|
197
|
+
unix_defaults :my_server, memory_min: 10 # Integer or false
|
198
|
+
unix_defaults :my_server, df_min: 10 # Integer or false
|
199
|
+
unix_defaults :my_server, mdadm: false # true or false
|
200
|
+
unix_defaults :my_server, cpu_governor: false # String or false
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module WatchmonkeyCli
|
2
|
+
module Checkers
|
3
|
+
class UnixCpuGovernor < Checker
|
4
|
+
self.checker_name = "unix_cpu_governor"
|
5
|
+
|
6
|
+
def enqueue host, opts = {}
|
7
|
+
opts = { expect: "performance" }.merge(opts)
|
8
|
+
host = app.fetch_connection(:loopback, :local) if !host || host == :local
|
9
|
+
host = app.fetch_connection(:ssh, host) if host.is_a?(Symbol)
|
10
|
+
app.enqueue(self, host, opts)
|
11
|
+
end
|
12
|
+
|
13
|
+
def check! result, host, opts = {}
|
14
|
+
qfile = opts[:query_file] || "/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
|
15
|
+
message = opts[:message] || "CPUfreq scaling governor mismatches (expected `#{opts[:expect]}' got `%s')"
|
16
|
+
result.command = "cat #{qfile}"
|
17
|
+
result.result = host.exec(result.command)
|
18
|
+
result.error! message.gsub("%s", result.result) if result.result != opts[:expect]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -5,7 +5,7 @@ module WatchmonkeyCli
|
|
5
5
|
|
6
6
|
def enqueue host, opts = {}
|
7
7
|
return if app.running? # we only ever want to run this once to spawn sub checkers
|
8
|
-
opts = { unix_load: {}, unix_memory: {}, unix_df: {}, unix_mdadm: {} }.merge(opts)
|
8
|
+
opts = { unix_load: {}, unix_memory: {}, unix_df: {}, unix_mdadm: {}, unix_cpu_governor: {} }.merge(opts)
|
9
9
|
|
10
10
|
host = app.fetch_connection(:loopback, :local) if !host || host == :local
|
11
11
|
host = app.fetch_connection(:ssh, host) if host.is_a?(Symbol)
|
@@ -18,21 +18,24 @@ module WatchmonkeyCli
|
|
18
18
|
opts[:unix_df][:min_percent] = opts[:df_min] if opts[:df_min]
|
19
19
|
opts[:unix_df] = false if opts[:df_min] == false
|
20
20
|
opts[:unix_mdadm] = false if opts[:mdadm] == false
|
21
|
+
opts[:unix_cpu_governor][:expect] = opts[:cpu_governor] if opts[:cpu_governor]
|
22
|
+
opts[:unix_cpu_governor] = false if opts[:cpu_governor] == false
|
21
23
|
opts.delete(:load)
|
22
24
|
opts.delete(:memory_min)
|
23
25
|
opts.delete(:df_min)
|
24
26
|
opts.delete(:mdadm)
|
27
|
+
opts.delete(:cpu_governor)
|
25
28
|
|
26
29
|
app.enqueue(self, host, opts)
|
27
30
|
end
|
28
31
|
|
29
32
|
def check! result, host, opts = {}
|
30
|
-
[:unix_load, :unix_memory, :unix_df, :unix_mdadm].each do |which|
|
33
|
+
[:unix_load, :unix_memory, :unix_df, :unix_mdadm, :unix_cpu_governor].each do |which|
|
31
34
|
# if opts[which] && sec = app.checkers[which.to_s]
|
32
35
|
# sec.check!(result, host, opts[which])
|
33
36
|
# end
|
34
37
|
# app.enqueue_sub(self, which, host, opts[which]) if opts[which]
|
35
|
-
spawn_sub(which, host, opts[which].is_a?(Hash) ? opts[which] : {})
|
38
|
+
spawn_sub(which, host, opts[which].is_a?(Hash) ? opts[which] : {}) unless opts[which] == false
|
36
39
|
end
|
37
40
|
end
|
38
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watchmonkey_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sven Pachnit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -129,6 +129,7 @@ files:
|
|
129
129
|
- lib/watchmonkey_cli/checkers/tcp_port.rb
|
130
130
|
- lib/watchmonkey_cli/checkers/ts3_license.rb
|
131
131
|
- lib/watchmonkey_cli/checkers/udp_port.rb
|
132
|
+
- lib/watchmonkey_cli/checkers/unix_cpu_governor.rb
|
132
133
|
- lib/watchmonkey_cli/checkers/unix_defaults.rb
|
133
134
|
- lib/watchmonkey_cli/checkers/unix_df.rb
|
134
135
|
- lib/watchmonkey_cli/checkers/unix_file_exists.rb
|