sensu-plugins-uptime 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ea9e4f7514a72be83f781d20249cc4fa644e85da
4
+ data.tar.gz: 7af012c6ef03d815d105ddc4ee0fbcac80688c11
5
+ SHA512:
6
+ metadata.gz: 0d4c12f7b5c45451f3202d163a6a182570d406ea666cf98e576320935d596183665ae36e238a377b33502a40e939e62627e2e57f18666c8b5013bdd308737321
7
+ data.tar.gz: 9f2f3434928ff929c298289a6a1799ff1af8bdfa81dbdf30fc17cbe78ea92d24aa788e935bd3c1f8a4806343199390c6a352133fe6cd698a99b1cb11f0a40e1c
data/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # Change Log
2
+ This project adheres to [Semantic Versioning](http://semver.org/).
3
+
4
+ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
+
6
+ ## Unreleased
7
+
8
+ ## [0.0.1] - 2016-01-06
9
+ ### Added
10
+ - Initial release
data/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2015 Matteo Cerutti
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+
data/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # Sensu plugin for monitoring the system's uptime
2
+
3
+ A sensu plugin to monitor the system's uptime, useful to identify when reboots take place
4
+
5
+ ## Usage
6
+
7
+ The plugin accepts the following command line options:
8
+
9
+ ```
10
+ Usage: check-uptime.rb (options)
11
+ --uptime <UPTIME> Uptime in seconds
12
+ -w, --warn Warn instead of throwing a critical failure
13
+ ```
14
+
15
+ ## Author
16
+ Matteo Cerutti - <matteo.cerutti@hotmail.co.uk>
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # check-uptime.rb
4
+ #
5
+ # Author: Matteo Cerutti <matteo.cerutti@hotmail.co.uk>
6
+ #
7
+
8
+ require 'sensu-plugin/check/cli'
9
+
10
+ class CheckUptime < Sensu::Plugin::Check::CLI
11
+ option :uptime,
12
+ :description => "Uptime in seconds",
13
+ :long => "--uptime <UPTIME>",
14
+ :proc => proc(&:to_i),
15
+ :default => 300
16
+
17
+ option :warn,
18
+ :description => "Warn instead of throwing a critical failure",
19
+ :short => "-w",
20
+ :long => "--warn",
21
+ :boolean => true,
22
+ :default => false
23
+
24
+ def initialize()
25
+ super
26
+
27
+ @uptime = get_uptime()
28
+ end
29
+
30
+ def get_uptime()
31
+ %x[cat /proc/uptime].split(' ').first.to_i
32
+ end
33
+
34
+ def run
35
+ if config[:uptime] >= @uptime
36
+ msg = "System rebooted #{@uptime} seconds ago"
37
+ if config[:warn]
38
+ warning(msg)
39
+ else
40
+ critical(msg)
41
+ end
42
+ else
43
+ ok("System has been up since #{Time.now - @uptime}")
44
+ end
45
+ end
46
+ end
@@ -0,0 +1 @@
1
+ require 'sensu-plugins-uptime/version'
@@ -0,0 +1,9 @@
1
+ module SensuPluginsUptime
2
+ module Version
3
+ MAJOR = 0
4
+ MINOR = 0
5
+ PATCH = 1
6
+
7
+ VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sensu-plugins-uptime
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Matteo Cerutti
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sensu-plugin
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.2.0
27
+ description: This plugin provides facilities for monitoring the system uptime
28
+ email: "<matteo.cerutti@hotmail.co.uk>"
29
+ executables:
30
+ - check-uptime.rb
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - CHANGELOG.md
35
+ - LICENSE
36
+ - README.md
37
+ - bin/check-uptime.rb
38
+ - lib/sensu-plugins-uptime.rb
39
+ - lib/sensu-plugins-uptime/version.rb
40
+ homepage: https://github.com/m4ce/sensu-plugins-uptime
41
+ licenses:
42
+ - MIT
43
+ metadata:
44
+ maintainer: "@m4ce"
45
+ development_status: active
46
+ production_status: stable
47
+ release_draft: 'false'
48
+ release_prerelease: 'false'
49
+ post_install_message: You can use the embedded Ruby by setting EMBEDDED_RUBY=true
50
+ in /etc/default/sensu
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: 1.9.3
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ requirements: []
65
+ rubyforge_project:
66
+ rubygems_version: 2.4.5.1
67
+ signing_key:
68
+ specification_version: 4
69
+ summary: Sensu plugins for monitoring the system uptime
70
+ test_files: []