sensu-plugins-numa 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: 1db066b0bb012a3bb51364ead4be3628c28ad7a4
4
+ data.tar.gz: ef1d7095db89fe2e3863cb68867db5a8e94dc63c
5
+ SHA512:
6
+ metadata.gz: 8daa265586d67fa8742a168934e85cb14cdb06df1dae23e7005ba5f754e1a353614e6728ea6d95b43aee158886a412ae0470b02ee5f3db022595e2fe052e62a9
7
+ data.tar.gz: e131434c9ae1cf8f749efded2177443205cea8109b8763e8debd853d1cb4fbff965db8b7a57b6c9466f4c3a7d1c3cc52375d79eb229b9d169d555d07b61138bf
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-05
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,13 @@
1
+ # Sensu plugin for monitoring NUMA
2
+
3
+ A sensu plugin to monitor whether NUMA is supported and enabled.
4
+
5
+ ## Usage
6
+
7
+ The plugin accepts the following command line options:
8
+
9
+ ```
10
+ ```
11
+
12
+ ## Author
13
+ Matteo Cerutti - <matteo.cerutti@hotmail.co.uk>
data/bin/check-numa.rb ADDED
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # check-numa.rb
4
+ #
5
+ # Author: Matteo Cerutti <matteo.cerutti@hotmail.co.uk>
6
+ #
7
+
8
+ require 'sensu-plugin/check/cli'
9
+
10
+ class CheckNuma < Sensu::Plugin::Check::CLI
11
+ option :warn,
12
+ :description => "Warn instead of throwing a critical failure",
13
+ :short => "-w",
14
+ :long => "--warn",
15
+ :boolean => true,
16
+ :default => false
17
+
18
+ def initialize()
19
+ super
20
+
21
+ @cpuinfo = get_cpuinfo()
22
+ end
23
+
24
+ def get_cpuinfo()
25
+ cpuinfo = {}
26
+
27
+ data = %x[cat /proc/cpuinfo]
28
+ cpuinfo['model'] = data[/^model\s*:\s*(\d+)/, 1].to_i
29
+ cpuinfo['physicalprocessorcount'] = data.scan(/^physical id\s*:/).size
30
+
31
+ cpuinfo
32
+ end
33
+
34
+ def is_supported?()
35
+ # a few CPUs that made history
36
+ case @cpuinfo['model']
37
+ when 13 # Dothan
38
+ return false
39
+ when 3, 4 # Prescott
40
+ return false
41
+ when 6 # Presler
42
+ return false
43
+ when 22, 15 # Merom
44
+ return false
45
+ when 29, 23 # Penryn
46
+ return false
47
+ else # >= Nehalem
48
+ return true
49
+ end
50
+ end
51
+
52
+ def numa_nodes_count()
53
+ %x[find /sys/devices/system/node/* -maxdepth 0 -type d -name 'node*'].split("\n").count
54
+ end
55
+
56
+ def run
57
+ if is_supported?()
58
+ if @cpuinfo['physicalprocessorcount'] > 1
59
+ if numa_nodes_count() > 1 and
60
+ ok("NUMA is enabled")
61
+ else
62
+ if config[:warn]
63
+ warning("NUMA is disabled")
64
+ else
65
+ critical("NUMA is disabled")
66
+ end
67
+ end
68
+ else
69
+ ok("NUMA not monitored - Only 1 physical processor detected")
70
+ end
71
+ else
72
+ ok("NUMA is not supported")
73
+ end
74
+ end
75
+ end
@@ -0,0 +1 @@
1
+ require 'sensu-plugins-numa/version'
@@ -0,0 +1,9 @@
1
+ module SensuPluginsNuma
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-numa
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 NUMA
28
+ email: "<matteo.cerutti@hotmail.co.uk>"
29
+ executables:
30
+ - check-numa.rb
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - CHANGELOG.md
35
+ - LICENSE
36
+ - README.md
37
+ - bin/check-numa.rb
38
+ - lib/sensu-plugins-numa.rb
39
+ - lib/sensu-plugins-numa/version.rb
40
+ homepage: https://github.com/m4ce/sensu-plugins-numa
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 NUMA
70
+ test_files: []