cassandra-utils 0.4.0 → 0.4.1
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/Gemfile.lock +3 -0
- data/lib/cassandra/utils/stats/health.rb +42 -20
- 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: 7669e6c8e65ba8d0f99b6f6e0a3d851b2d331206
|
4
|
+
data.tar.gz: e4e42e9f78743fe47a245407a28cbaee51e5a725
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae0b349f3ad4ecbe8eadf7cb93c9194f5870a1bc98531b4e05bd7c98008794e1ac4aead9159805d380256d800fb5c3e79a499908ba1b2c36ae1f7e0179f61bfc
|
7
|
+
data.tar.gz: 99a46df29e78d2df53daaeb8ab14a653e2cba623746f829cca96e51685f11c3d74740cc308722e7151442c858954405f99fa7fd3c379cbd64ac719ec3c0af50f
|
data/Gemfile.lock
CHANGED
@@ -5,8 +5,8 @@ module Cassandra
|
|
5
5
|
def run!
|
6
6
|
running = true
|
7
7
|
if state == :normal
|
8
|
-
running &&=
|
9
|
-
running &&=
|
8
|
+
running &&= gossipstate == 'true'
|
9
|
+
running &&= thriftstate == 'true'
|
10
10
|
end
|
11
11
|
Utils::Statsd.new(metric_name).to_dd(running).push!
|
12
12
|
running
|
@@ -16,11 +16,42 @@ module Cassandra
|
|
16
16
|
'cassandra.service.running'
|
17
17
|
end
|
18
18
|
|
19
|
+
# Return the state of nodetool info gossip
|
20
|
+
#
|
21
|
+
# The returned state is reported by "nodetool info".
|
22
|
+
#
|
23
|
+
# @return [String, nil]
|
24
|
+
def gossipstate
|
25
|
+
results = (nodetool_info || '').split("\n")
|
26
|
+
results.map! { |line| line.strip }
|
27
|
+
results.select! { |line| line.include? 'Gossip active' }
|
28
|
+
results.map! { |line| line.split(':')[1] }
|
29
|
+
results.compact!
|
30
|
+
return nil if results.size != 1
|
31
|
+
results.first.strip.downcase
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
# Return the state of nodetool info thrift
|
36
|
+
#
|
37
|
+
# The returned state is reported by "nodetool info".
|
38
|
+
#
|
39
|
+
# @return [String, nil]
|
40
|
+
def thriftstate
|
41
|
+
results = (nodetool_info || '').split("\n")
|
42
|
+
results.map! { |line| line.strip }
|
43
|
+
results.select! { |line| line.include? 'Thrift active' }
|
44
|
+
results.map! { |line| line.split(':')[1] }
|
45
|
+
results.compact!
|
46
|
+
return nil if results.size != 1
|
47
|
+
results.first.strip.downcase
|
48
|
+
end
|
49
|
+
|
19
50
|
# Return the state of the Cassandra node
|
20
51
|
#
|
21
52
|
# The returned state is reported by "nodetool netstats".
|
22
53
|
#
|
23
|
-
# @return [
|
54
|
+
# @return [Symbol, nil]
|
24
55
|
#
|
25
56
|
def state
|
26
57
|
results = (nodetool_netstats || '').split("\n")
|
@@ -38,25 +69,16 @@ module Cassandra
|
|
38
69
|
|
39
70
|
private
|
40
71
|
|
41
|
-
#
|
72
|
+
# Shell out via DaemonRunner to run 'nodetool info'
|
42
73
|
#
|
43
|
-
#
|
74
|
+
# The returned state is either true or false
|
44
75
|
#
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
# Run the "nodetool statusthrift' command and return the output
|
52
|
-
#
|
53
|
-
# @return [String, nil] Output from the "nodetool statusthrift" command
|
54
|
-
#
|
55
|
-
def nodetool_statusthrift
|
56
|
-
@nodetool_statusthrift||= DaemonRunner::ShellOut.new(command: 'nodetool statusthrift')
|
57
|
-
@nodetool_statusthrift.run!
|
58
|
-
@nodetool_statusthrift.stdout
|
59
|
-
end
|
76
|
+
# @return [String, nil] Output from the "nodetool info" command
|
77
|
+
def nodetool_info
|
78
|
+
@nodetool_info ||= DaemonRunner::ShellOut.new(command: 'nodetool info')
|
79
|
+
@nodetool_info.run!
|
80
|
+
@nodetool_info.stdout
|
81
|
+
end
|
60
82
|
|
61
83
|
# Run the "nodetool netstats' command and return the output
|
62
84
|
#
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cassandra-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Thompson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|