continuent-monitors-nagios 0.5.1 → 0.5.2
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/README.md +10 -0
- data/bin/tungsten_nagios_latency +8 -5
- data/bin/tungsten_nagios_managed_configuration +86 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4adb289e16938bc7425f2202c7346b1d25a33711
|
4
|
+
data.tar.gz: 6b0616429d4309d9141e996b3e0a4df3164e8135
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2c8ea7d429a8e4140bffdf7232d27839f08b2452ace4c905e1fe8416172c342cdcaf53fd78dda29122e5d179c93fb56a43ab6675a513d0e5769b6724f1bec57
|
7
|
+
data.tar.gz: 86197aee006dee89a0e0ad2845cdf16472d0c8284e860ed249396d1e0c54ccee8e4c79ac4ec5a9dacdb348bdd9d17669bead61aa60de1210e5a48c9a9373c21e
|
data/README.md
CHANGED
@@ -3,6 +3,16 @@ continuent-monitors-nagios
|
|
3
3
|
|
4
4
|
A Ruby Gem containing Nagios checks for Continuent Tungsten and Tungsten Replicator
|
5
5
|
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
```gem install continuent-monitors-nagios```
|
9
|
+
|
10
|
+
## Example Nagios Service Check
|
11
|
+
|
12
|
+
```
|
13
|
+
check_by_ssh -H $HOSTADDRESS$ -t 30 -o="StrictHostKeyChecking=no" -C "sudo -u tungsten /usr/bin/tungsten_nagios_latency -w 60 -c 120 --directory=/opt/continuent/"
|
14
|
+
```
|
15
|
+
|
6
16
|
## Other useful projects
|
7
17
|
|
8
18
|
* https://github.com/Ericbla/check_jstat
|
data/bin/tungsten_nagios_latency
CHANGED
@@ -56,6 +56,7 @@ class ContinuentNagiosMonitorLatency
|
|
56
56
|
|
57
57
|
max_latency = 0
|
58
58
|
errors = []
|
59
|
+
info = []
|
59
60
|
perslave_performance_data = []
|
60
61
|
|
61
62
|
status = TI.status(opt(:service))
|
@@ -86,7 +87,7 @@ class ContinuentNagiosMonitorLatency
|
|
86
87
|
|
87
88
|
latency = latency.to_s().to_f()
|
88
89
|
if is_critical?(latency) || is_warning?(latency)
|
89
|
-
|
90
|
+
info << "#{hostname}=#{latency}s"
|
90
91
|
end
|
91
92
|
|
92
93
|
if latency > max_latency
|
@@ -106,10 +107,12 @@ class ContinuentNagiosMonitorLatency
|
|
106
107
|
@perfdata << "max_latency=#{max_latency};#{opt(:warning_level)};#{opt(:critical_level)};;"
|
107
108
|
end
|
108
109
|
|
109
|
-
if
|
110
|
-
critical(errors.join(', '))
|
110
|
+
if errors.size() > 0
|
111
|
+
critical((errors+info).join(', '))
|
112
|
+
elsif is_critical?(max_latency)
|
113
|
+
critical(info.join(', '))
|
111
114
|
elsif is_warning?(max_latency)
|
112
|
-
warning(
|
115
|
+
warning(info.join(', '))
|
113
116
|
else
|
114
117
|
ok("All slaves are running normally (max_latency=#{max_latency})")
|
115
118
|
end
|
@@ -156,4 +159,4 @@ class ContinuentNagiosMonitorLatency
|
|
156
159
|
end
|
157
160
|
|
158
161
|
self.new().run()
|
159
|
-
end
|
162
|
+
end
|
@@ -0,0 +1,86 @@
|
|
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 ContinuentNagiosManagedConfiguration
|
29
|
+
include TungstenScript
|
30
|
+
include TungstenNagiosMonitor
|
31
|
+
private
|
32
|
+
|
33
|
+
def main
|
34
|
+
unless File.exist?(opt(:lastrun))
|
35
|
+
critical("The #{opt(:lastrun)} file is not present")
|
36
|
+
end
|
37
|
+
|
38
|
+
begin
|
39
|
+
last_exit_code = File.new(opt(:lastrun)).read().chomp()
|
40
|
+
|
41
|
+
if last_exit_code.to_s() != "0"
|
42
|
+
critical("The last run of tungsten_manage_configuration was not successful")
|
43
|
+
end
|
44
|
+
rescue
|
45
|
+
critical("There were issues reading #{opt(:lastrun)}")
|
46
|
+
end
|
47
|
+
|
48
|
+
begin
|
49
|
+
mtime = File.mtime(opt(:lastrun))
|
50
|
+
difference = Time.now()-mtime
|
51
|
+
add_perfdata("lastrun", "#{difference};#{opt(:warning_level)};#{opt(:critical_level)};")
|
52
|
+
|
53
|
+
if is_critical?(difference)
|
54
|
+
critical("The tungsten_manage_configuration script last ran #{difference}s ago")
|
55
|
+
elsif is_warning?(difference)
|
56
|
+
warning("The tungsten_manage_configuration script last ran #{difference}s ago")
|
57
|
+
else
|
58
|
+
ok("The tungsten_manage_configuration script was successful")
|
59
|
+
end
|
60
|
+
rescue
|
61
|
+
critical("There were issues reading #{opt(:lastrun)} modification time")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def configure
|
66
|
+
super()
|
67
|
+
|
68
|
+
add_option(:lastrun, {
|
69
|
+
:on => "--lastrun String",
|
70
|
+
:help => "Path to the lastrun file written by tungsten_manage_configuration",
|
71
|
+
:required => true
|
72
|
+
})
|
73
|
+
|
74
|
+
description("Check that the local managed configuration has run recently and was successful")
|
75
|
+
end
|
76
|
+
|
77
|
+
def script_name
|
78
|
+
"tungsten_nagios_managed_configuration"
|
79
|
+
end
|
80
|
+
|
81
|
+
def uses_thresholds?
|
82
|
+
true
|
83
|
+
end
|
84
|
+
|
85
|
+
self.new().run()
|
86
|
+
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
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Continuent
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: continuent-tools-monitoring
|
@@ -30,6 +30,7 @@ executables:
|
|
30
30
|
- tungsten_nagios_backups
|
31
31
|
- tungsten_nagios_connector
|
32
32
|
- tungsten_nagios_latency
|
33
|
+
- tungsten_nagios_managed_configuration
|
33
34
|
- tungsten_nagios_monitor_threads
|
34
35
|
- tungsten_nagios_online
|
35
36
|
- tungsten_nagios_policy
|
@@ -41,6 +42,7 @@ files:
|
|
41
42
|
- bin/tungsten_nagios_backups
|
42
43
|
- bin/tungsten_nagios_connector
|
43
44
|
- bin/tungsten_nagios_latency
|
45
|
+
- bin/tungsten_nagios_managed_configuration
|
44
46
|
- bin/tungsten_nagios_monitor_threads
|
45
47
|
- bin/tungsten_nagios_online
|
46
48
|
- bin/tungsten_nagios_policy
|