sensu-plugins-filenr 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fcf10470071c9ec89b91c5c278b9d1b84bbc7bb8
4
+ data.tar.gz: 4528342566d18fb348c67d4b04e1f51d9b53724f
5
+ SHA512:
6
+ metadata.gz: 2deda34df2cc7679622d9118dac9f22b19cf514168c9359987f2cdda878a209d0d8df154b8c1711ec54d6e2339df706a6b93765014dc574c042192ca0d1abdb3
7
+ data.tar.gz: dac0b347942f800d045e12a9ad8dfa6cf302821817eca081d8d01bd32b1e2a632f2ec9606583c7d50f7962075330aa12adf308e787db2b2776e979a44e1d9509
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] - 2015-12-28
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,18 @@
1
+ # Sensu plugin for monitoring the number of allocated file handles
2
+
3
+ A sensu plugin to monitor the number of allocated file handles (file descriptors) on a system.
4
+
5
+ ## Usage
6
+
7
+ The plugin accepts the following command line options:
8
+
9
+ ```
10
+ Usage: check-filenr.rb (options)
11
+ -c, --critical <NR> Critical if NR exceeds the current number of file handles (default: 383786)
12
+ -w, --warn <NR> Warn if NR exceeds current number of file handles (default: 345407)
13
+ ```
14
+
15
+ The default critical value is set to the fs.file-max (/proc/sys/fs/file-max), whereas the warning is set to 90% of the file-max value.
16
+
17
+ ## Author
18
+ Matteo Cerutti - <matteo.cerutti@hotmail.co.uk>
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # check-filenr.rb
4
+ #
5
+ # Author: Matteo Cerutti <matteo.cerutti@hotmail.co.uk>
6
+ #
7
+
8
+ require 'sensu-plugin/check/cli'
9
+
10
+ class CheckFileNr < Sensu::Plugin::Check::CLI
11
+ option :warn,
12
+ :description => "Warn if NR exceeds current number of file handles (default: #{File.read("/proc/sys/fs/file-max").chomp.to_i * 90 / 100})",
13
+ :short => "-w <NR>",
14
+ :long => "--warn <NR>",
15
+ :proc => proc(&:to_i),
16
+ :default => (File.read("/proc/sys/fs/file-max").chomp.to_i * 90 / 100)
17
+
18
+ option :crit,
19
+ :description => "Critical if NR exceeds the current number of file handles (default: #{File.read("/proc/sys/fs/file-max").chomp.to_i})",
20
+ :short => "-c <NR>",
21
+ :long => "--critical <NR>",
22
+ :proc => proc(&:to_i),
23
+ :default => File.read("/proc/sys/fs/file-max").chomp.to_i
24
+
25
+ def initialize()
26
+ super
27
+ end
28
+
29
+ def run
30
+ allocated = File.read("/proc/sys/fs/file-nr").split(' ')[0].to_i
31
+
32
+ critical("Too many allocated file handles (#{allocated} >= #{config[:crit]})") if allocated >= config[:crit]
33
+ warning("#{allocated} allocated file handles (>= #{config[:warn]})") if allocated >= config[:warn]
34
+
35
+ ok("#{allocated} allocated file handles")
36
+ end
37
+ end
@@ -0,0 +1 @@
1
+ require 'sensu-plugins-filenr/version'
@@ -0,0 +1,9 @@
1
+ module SensuPluginsFileNr
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,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sensu-plugins-filenr
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-04 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 number of allocated
28
+ file handles
29
+ email: "<matteo.cerutti@hotmail.co.uk>"
30
+ executables:
31
+ - check-filenr.rb
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - CHANGELOG.md
36
+ - LICENSE
37
+ - README.md
38
+ - bin/check-filenr.rb
39
+ - lib/sensu-plugins-filenr.rb
40
+ - lib/sensu-plugins-filenr/version.rb
41
+ homepage: https://github.com/m4ce/sensu-plugins-filenr
42
+ licenses:
43
+ - MIT
44
+ metadata:
45
+ maintainer: "@m4ce"
46
+ development_status: active
47
+ production_status: stable
48
+ release_draft: 'false'
49
+ release_prerelease: 'false'
50
+ post_install_message: You can use the embedded Ruby by setting EMBEDDED_RUBY=true
51
+ in /etc/default/sensu
52
+ rdoc_options: []
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 1.9.3
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ requirements: []
66
+ rubyforge_project:
67
+ rubygems_version: 2.4.5.1
68
+ signing_key:
69
+ specification_version: 4
70
+ summary: Sensu plugins for monitoring the number of allocated file handles
71
+ test_files: []