sensu-plugins-eventstore 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/check-gossip.rb +38 -10
- 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: 38994ee87db4e297cdec9d70ef832775a29e1b33
|
4
|
+
data.tar.gz: 59436bc00a7b1e9bc17ad38bad1e398344a5bc75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5112ccfa0d8a846abc8c7d3181b136794d74f463726075c12c6db4c1665891f4aff7b17c6eb22ed894b8451ac2512dd695aba85df3a8d2d33130ee73cc1ce02
|
7
|
+
data.tar.gz: bfa6f88dcdf913849037905f1a4b38a8294877d8e86a3186bbb22e829412cdeb88ff80e8e1bfa7a870487b258566f32a7e899c9b083b8cce9ccfba20b17dd400
|
data/bin/check-gossip.rb
CHANGED
@@ -73,6 +73,7 @@ class CheckGossip < Sensu::Plugin::Check::CLI
|
|
73
73
|
|
74
74
|
current_machine_ips = get_current_machine_ipv4s
|
75
75
|
event_store_ips = get_event_store_ips_from_dns cluster_dns
|
76
|
+
critical_failure_from_no_event_store_ips cluster_dns unless event_store_ips.any?
|
76
77
|
gossip_address = get_matching_ips current_machine_ips, event_store_ips
|
77
78
|
expected_nodes = event_store_ips.count
|
78
79
|
end
|
@@ -84,7 +85,7 @@ class CheckGossip < Sensu::Plugin::Check::CLI
|
|
84
85
|
matched_ips = machine_ips.select do |ip_to_look_for|
|
85
86
|
event_store_ips.find { |ip_to_match| ip_to_look_for == ip_to_match }
|
86
87
|
end
|
87
|
-
|
88
|
+
critical_failure_from_no_matching_ips machine_ips, event_store_ips unless matched_ips.one?
|
88
89
|
matched_ips[0]
|
89
90
|
end
|
90
91
|
|
@@ -111,25 +112,52 @@ class CheckGossip < Sensu::Plugin::Check::CLI
|
|
111
112
|
|
112
113
|
def nodes_all_alive?(document)
|
113
114
|
nodes = get_is_alive_nodes document
|
114
|
-
nodes.all? { |node| node
|
115
|
+
nodes.all? { |node| node_is_alive? node }
|
115
116
|
end
|
116
117
|
|
117
118
|
def check_node(gossip_address, gossip_port, expected_nodes)
|
118
119
|
puts "\nchecking gossip at #{gossip_address}:#{gossip_port}"
|
119
|
-
|
120
|
+
|
121
|
+
begin
|
122
|
+
connection_url = "http://#{gossip_address}:#{gossip_port}/gossip?format=xml";
|
123
|
+
gossip = open(connection_url)
|
124
|
+
|
125
|
+
rescue StandardError
|
126
|
+
critical "Could not connect to #{connection_url} to check gossip, has event store fallen over on this node? "
|
127
|
+
end
|
120
128
|
|
121
129
|
xml_doc = Nokogiri::XML(gossip.readline)
|
122
130
|
|
123
|
-
puts "
|
124
|
-
|
131
|
+
puts "Checking for #{expected_nodes} nodes"
|
132
|
+
critical_failure_from_missing_nodes xml_doc, expected_nodes unless node_count_is_correct? xml_doc, expected_nodes
|
125
133
|
|
126
|
-
puts "
|
127
|
-
|
134
|
+
puts "Checking nodes for IsAlive state"
|
135
|
+
critical_failure_from_dead_nodes xml_doc, expected_nodes unless nodes_all_alive? xml_doc
|
136
|
+
|
137
|
+
puts "Checking for exactly 1 master"
|
138
|
+
critical_failure_from_incorrect_master_count xml_doc unless only_one_master? xml_doc
|
139
|
+
|
140
|
+
ok "#{gossip_address} is gossiping with #{expected_nodes} nodes. All nodes are marked as alive and one master node was found."
|
141
|
+
end
|
128
142
|
|
129
|
-
|
130
|
-
critical "
|
143
|
+
def critical_failure_from_no_matching_ips(machine_ips, event_store_ips)
|
144
|
+
critical "this machine has ips of #{machine_ips}, event store (according to dns lookup) has ips of #{event_store_ips}. There should be exactly one match, but wasn't. "
|
145
|
+
end
|
146
|
+
def critical_failure_from_no_event_store_ips(dns_name)
|
147
|
+
critical "could not find any ips at dns name #{dns_name} so cannot check gossips"
|
148
|
+
end
|
149
|
+
def critical_failure_from_missing_nodes(xml_doc, expected_nodes)
|
150
|
+
critical "Wrong number of nodes, was #{get_members(xml_doc).count} should be exactly #{expected_nodes}"
|
151
|
+
end
|
152
|
+
def critical_failure_from_dead_nodes(xml_doc, expected_nodes)
|
153
|
+
critical "Only #{get_is_alive_nodes(xml_doc).count { |node| node_is_alive? node}} alive nodes, should be #{expected_nodes} alive"
|
154
|
+
end
|
155
|
+
def critical_failure_from_incorrect_master_count(xml_doc)
|
156
|
+
critical "Wrong number of node masters, there should be exactly 1 but there were #{get_masters(xml_doc)} masters"
|
157
|
+
end
|
131
158
|
|
132
|
-
|
159
|
+
def node_is_alive?(node)
|
160
|
+
node.content == 'true'
|
133
161
|
end
|
134
162
|
|
135
163
|
def print_all(collection, type)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-eventstore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Wroe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|