continuent-monitors-nagios 0.5.4 → 0.6.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
  SHA1:
3
- metadata.gz: 864077deccf530735d550ba5c5f94ac4805528bb
4
- data.tar.gz: c6a60a3189f9fd365648421df038832099769526
3
+ metadata.gz: e2302ed384f4741778d499ec80bba5c571a55227
4
+ data.tar.gz: 82ddf98af190fbda192cf15b63c38d4c92154920
5
5
  SHA512:
6
- metadata.gz: c5eb1488153973dee30027d9baede38d0e0a6316fff1f37a58ad015e1a0963f46a3f71284923a13107445e78cf782f97a4c47940681e630a53d2c58b4eab69ad
7
- data.tar.gz: 2205c15fd9b613f2164e446bbae9103cc1a86949f2a0296f36e00a891468f21bce0a3f2aa278c9663542f4f69f25f0377866564162385e643ef31fcb967df860
6
+ metadata.gz: c6cf042cf427da93be17409ed7e8c5cf73d1d4634b1e1db8b132b5d8acd0d25df3e44f8b6693e222532c44e5052218c787a289a156301880215439b5a24b91af
7
+ data.tar.gz: d60d5d2bc9d37ab076f0568c6975e8cf92252c16d6a1e23bcda552c5f84e2b4d9069a5ffa27bf7f232128d226c57b6338abc6808edc2a690e6ada1b6f8c4fbf5
data/README.md CHANGED
@@ -15,4 +15,7 @@ check_by_ssh -H $HOSTADDRESS$ -t 30 -o="StrictHostKeyChecking=no" -C "sudo -u tu
15
15
 
16
16
  ## Other useful projects
17
17
 
18
- * https://github.com/Ericbla/check_jstat
18
+ * https://github.com/Ericbla/check_jstat
19
+
20
+ ## Compatibility
21
+ These checks only work on the continuent-tungsten-2.x series they are not compatible with continuent-tungsten-1.x.
@@ -31,6 +31,7 @@ class ContinuentNagiosMonitorProgress
31
31
  private
32
32
 
33
33
  def main
34
+
34
35
  unless TI.is_replicator?()
35
36
  critical("The server is not a Tungsten Replicator")
36
37
  end
@@ -57,9 +58,27 @@ class ContinuentNagiosMonitorProgress
57
58
  unless TI.trepctl_value(opt(:service), "state") == "ONLINE"
58
59
  critical("The #{opt(:service)} replication service is not ONLINE")
59
60
  end
60
-
61
- pre_seqno = TI.trepctl_value(opt(:service), "appliedLastSeqno").to_s().to_f()
62
-
61
+
62
+ unless ["appliedLastSeqno","currentLastSeqno"].include?(opt(:metric))
63
+ critical("Unknown metric #{opt(:metric)}")
64
+ end
65
+
66
+ stages = { "master" => ["binlog-to-q","q-to-thl"],
67
+ "slave" => ["remote-to-thl","thl-to-q","q-to-dbms"],
68
+ "relay" => ["remote-to-thl","thl-to-q","q-to-dbms"],
69
+ "direct" => ["d-binlog-to-q","d-q-to-thl","d-thl-to-pq","d-pq-to-dbms"]
70
+ }
71
+ pre_results=Hash.new
72
+
73
+ role=TI.trepctl_value(opt(:service), "role").to_s()
74
+
75
+ pre_values = TI.trepctl_name_all(opt(:service),'tasks')
76
+
77
+ stages[role].each do |stage_name|
78
+ pre_results[stage_name]=find_values(pre_values,stage_name,opt(:metric))
79
+ end
80
+
81
+
63
82
  if TI.is_commercial?()
64
83
  TI.ensure_cctrl("cluster heartbeat")
65
84
  end
@@ -68,11 +87,16 @@ class ContinuentNagiosMonitorProgress
68
87
  TU.debug("Go to sleep for #{opt(:delay)} seconds")
69
88
  sleep(opt(:delay))
70
89
  end
71
-
72
- post_seqno = TI.trepctl_value(opt(:service), "appliedLastSeqno").to_s().to_f()
73
- difference = post_seqno - pre_seqno
74
-
75
- if difference > 0
90
+
91
+ replicator_making_progress=false
92
+
93
+ post_values = TI.trepctl_name_all(opt(:service),'tasks')
94
+ stages[role].each do |stage_name|
95
+ if find_values(post_values,stage_name,opt(:metric)) - pre_results[stage_name] > 0
96
+ replicator_making_progress=true
97
+ end
98
+ end
99
+ if replicator_making_progress
76
100
  ok("Tungsten Replicator #{opt(:service)} service is making progress")
77
101
  else
78
102
  critical("Tungsten Replicator #{opt(:service)} service did not show progress")
@@ -95,11 +119,30 @@ class ContinuentNagiosMonitorProgress
95
119
  :on => "--service String",
96
120
  :help => "The replication service or cluster to check"
97
121
  })
122
+
123
+ add_option(:metric, {
124
+ :on=> "--metric String",
125
+ :help=>"The field to use to determine progess",
126
+ :default=> "currentLastSeqno"
127
+ })
98
128
  end
99
129
 
100
130
  def script_name
101
131
  "tungsten_nagios_progress"
102
132
  end
133
+
134
+ def find_values(input_values,stage,key)
135
+
136
+ #Note: When currentLastSeqno is selected it will be combined with currentLastfragno to ensure the field
137
+ # always go up.
138
+ stage_values=input_values.find{|x| x['stage']=stage}
139
+ if key=='currentLastSeqno'
140
+ (stage_values['currentLastSeqno']+stage_values['currentLastFragno'].rjust(5,'0')).to_s().to_f()
141
+ else
142
+ stage_values[key].to_s().to_f()
143
+ end
144
+
145
+ end
103
146
 
104
147
  self.new().run()
105
- end
148
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: continuent-monitors-nagios
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Continuent
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-27 00:00:00.000000000 Z
11
+ date: 2014-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: continuent-tools-monitoring
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '>='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.5.0
19
+ version: 0.7.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.5.0
26
+ version: 0.7.0
27
27
  description:
28
28
  email: info@continuent.com
29
29
  executables: