continuent-monitors-nagios 0.5.3 → 0.5.4

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: fca110aa38c24c19f840dc25d174e7f56296389e
4
- data.tar.gz: 0aee544247f2c9a0798bf8642ae550c9fe7a57ed
3
+ metadata.gz: 864077deccf530735d550ba5c5f94ac4805528bb
4
+ data.tar.gz: c6a60a3189f9fd365648421df038832099769526
5
5
  SHA512:
6
- metadata.gz: 84e761f28274ab04ce34778f18f616d71465b2008bb48c1cdffd8bf146fd9897b8d18b8b8f7ec3d36a0a811a6fd38e21182ea0bb0b9da39bf622342d65dc9ea9
7
- data.tar.gz: 54e786e415f0fc320a9f96b1e16f4a6ebb338ee3f3cdd40140553b949273a94c12ad136147833ff8e9368fca2235e32085b282bb8b9b13538edbfe9459abf51f
6
+ metadata.gz: c5eb1488153973dee30027d9baede38d0e0a6316fff1f37a58ad015e1a0963f46a3f71284923a13107445e78cf782f97a4c47940681e630a53d2c58b4eab69ad
7
+ data.tar.gz: 2205c15fd9b613f2164e446bbae9103cc1a86949f2a0296f36e00a891468f21bce0a3f2aa278c9663542f4f69f25f0377866564162385e643ef31fcb967df860
@@ -74,7 +74,7 @@ class ContinuentNagiosMonitorConnector
74
74
  end
75
75
 
76
76
  unless TI.is_connector?()
77
- ok("This server is not a Tungsten Connector")
77
+ ok("This server is not running a Tungsten Connector")
78
78
  end
79
79
 
80
80
  if opt(:defaults_file).to_s() == ""
@@ -0,0 +1,175 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (C) 2014 Continuent, Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may
5
+ # not use this file except in compliance with the License. You may obtain
6
+ # a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations
14
+ # under the License.
15
+ #
16
+ # Initial developer(s): Jeff Mace
17
+ # Contributor(s):
18
+
19
+ begin
20
+ require 'rubygems'
21
+ gem 'continuent-tools-core'
22
+ rescue LoadError
23
+ end
24
+
25
+ require 'continuent-tools-core'
26
+ require 'continuent-tools-nagios-monitor'
27
+
28
+ class ContinuentNagiosMonitorLatency
29
+ include TungstenScript
30
+ include TungstenNagiosMonitor
31
+ private
32
+
33
+ def main
34
+ if TI.is_commercial?()
35
+ critical("This check may not be run on a Continuent Tungsten cluster. It is intended for Tungsten Replicator installs")
36
+ else
37
+ unless TI.is_replicator?()
38
+ critical("The server is not a Tungsten Replicator")
39
+ end
40
+
41
+ unless TI.is_running?("replicator")
42
+ critical("The Tungsten Replicator is not running")
43
+ end
44
+ end
45
+
46
+ opt_default(:service, TI.default_dataservice())
47
+ if opt(:service) == nil
48
+ critical("The --service option was not given")
49
+ end
50
+
51
+ max_latency = 0
52
+ errors = []
53
+ info = []
54
+ perslave_performance_data = []
55
+
56
+ status = TI.status(opt(:service))
57
+ if status.is_composite?()
58
+ # Composite Dataservice
59
+ critical("Unable to check latency on #{opt(:service)} because it is a composite dataservice")
60
+ else
61
+ status.replicators().each{
62
+ |hostname|
63
+ # Ignore this host since the datasource is shunned
64
+ if opt(:skip_shunned) == true && status.is_physical?()
65
+ if status.datasource_status(hostname) == "SHUNNED"
66
+ next
67
+ end
68
+ end
69
+
70
+ latency = status.replicator_latency(hostname)
71
+ relative_latency = status.replicator_value(hostname, 'relativeLatency')
72
+
73
+ # Check for some special cases in latency
74
+ if latency.to_s() == "-1"
75
+ errors << "#{hostname} is missing latency information"
76
+ next
77
+ end
78
+ unless latency.to_s() =~ /^[0-9\.]+$/
79
+ errors << "#{hostname} is missing latency information"
80
+ next
81
+ end
82
+
83
+ latency = latency.to_s().to_f()
84
+ if is_critical?(latency) || is_warning?(latency)
85
+ info << "#{hostname}=#{latency}s"
86
+ end
87
+
88
+ # Check for some special cases in relative_latency
89
+ if relative_latency.to_s() == "-1"
90
+ errors << "#{hostname} is missing relative latency information"
91
+ next
92
+ end
93
+ unless relative_latency.to_s() =~ /^[0-9\.]+$/
94
+ errors << "#{hostname} is missing relative latency information"
95
+ next
96
+ end
97
+
98
+ latency = latency.to_s().to_f()
99
+ relative_latency = relative_latency.to_s().to_f()
100
+ latency = relative_latency - latency
101
+
102
+ if is_critical?(latency) || is_warning?(latency)
103
+ info << "#{hostname}=#{latency}s"
104
+ end
105
+
106
+ if latency > max_latency
107
+ max_latency = latency
108
+ end
109
+
110
+ perslave_performance_data << "#{hostname}=#{latency};#{opt(:warning_level)};#{opt(:critical_level)};;"
111
+ }
112
+ end
113
+
114
+ if opt(:perslave_perfdata) == true
115
+ perslave_performance_data.each{
116
+ |p|
117
+ @perfdata << p
118
+ }
119
+ elsif opt(:perfdata) == true
120
+ @perfdata << "max_relative_latency=#{max_latency};#{opt(:warning_level)};#{opt(:critical_level)};;"
121
+ end
122
+
123
+ if errors.size() > 0
124
+ critical((errors+info).join(', '))
125
+ elsif is_critical?(max_latency)
126
+ critical(info.join(', '))
127
+ elsif is_warning?(max_latency)
128
+ warning(info.join(', '))
129
+ else
130
+ ok("All slaves are running normally (max_relative_latency=#{max_latency})")
131
+ end
132
+ end
133
+
134
+ def configure
135
+ super()
136
+
137
+ description("Check the Tungsten Replicator relative latency on this host.")
138
+
139
+ add_option(:service, {
140
+ :on => "--service String",
141
+ :help => "The replication service or cluster to check"
142
+ })
143
+
144
+ add_option(:skip_shunned, {
145
+ :on => "--skip-shunned String",
146
+ :help => "Ignore Continuent Tungsten datasources that have been shunned.",
147
+ :parse => method(:parse_boolean_option),
148
+ :default => "false",
149
+ })
150
+
151
+ add_option(:perfdata, {
152
+ :on => "--perfdata String",
153
+ :help => "Display max_relative_latency performance data",
154
+ :parse => method(:parse_boolean_option),
155
+ :default => "false",
156
+ })
157
+
158
+ add_option(:perslave_perfdata, {
159
+ :on => "--perslave-perfdata String",
160
+ :help => "Display relative latency performance data for every replicator",
161
+ :parse => method(:parse_boolean_option),
162
+ :default => "false",
163
+ })
164
+ end
165
+
166
+ def script_name
167
+ "tungsten_nagios_relative_latency"
168
+ end
169
+
170
+ def uses_thresholds?
171
+ true
172
+ end
173
+
174
+ self.new().run()
175
+ 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.3
4
+ version: 0.5.4
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-14 00:00:00.000000000 Z
11
+ date: 2014-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: continuent-tools-monitoring
@@ -35,6 +35,7 @@ executables:
35
35
  - tungsten_nagios_online
36
36
  - tungsten_nagios_policy
37
37
  - tungsten_nagios_progress
38
+ - tungsten_nagios_relative_latency
38
39
  - tungsten_nagios_services
39
40
  extensions: []
40
41
  extra_rdoc_files: []
@@ -47,6 +48,7 @@ files:
47
48
  - bin/tungsten_nagios_online
48
49
  - bin/tungsten_nagios_policy
49
50
  - bin/tungsten_nagios_progress
51
+ - bin/tungsten_nagios_relative_latency
50
52
  - bin/tungsten_nagios_services
51
53
  - LICENSE
52
54
  - README.md