megaraid-collectd 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +23 -0
- data/Rakefile +1 -0
- data/bin/megaraid-collectd.rb +9 -0
- data/lib/megaraid-collectd/version.rb +5 -0
- data/lib/megaraid-collectd.rb +36 -0
- data/megaraid-collectd.gemspec +19 -0
- metadata +74 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Pierre-Yves Ritschard
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# Megaraid::Collectd
|
2
|
+
|
3
|
+
Simple gem which provides a long-running process
|
4
|
+
to help collectd graph megaraid status.
|
5
|
+
|
6
|
+
This relies on the command `megaclisas-status` being
|
7
|
+
available
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Install it yourself as:
|
12
|
+
|
13
|
+
$ gem install megaraid-collectd
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
Drop the following in your collectd configuration:
|
18
|
+
|
19
|
+
```
|
20
|
+
<Plugin exec>
|
21
|
+
Exec "root:root" "megaraid-collectd.rb"
|
22
|
+
</Plugin>
|
23
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require "megaraid-collectd/version"
|
2
|
+
|
3
|
+
module Megaraid
|
4
|
+
module Collectd
|
5
|
+
DEFAULT_INTERVAL = 900 # poll every 15 minute by default
|
6
|
+
DEFAULT_HOSTNAME = `hostname`.chomp
|
7
|
+
class Check
|
8
|
+
def initialize hostname=nil, interval=nil
|
9
|
+
@hostname = hostname || DEFAULT_HOSTNAME
|
10
|
+
@interval = interval || DEFAULT_INTERVAL
|
11
|
+
@interval = interval.to_i
|
12
|
+
end
|
13
|
+
|
14
|
+
def run
|
15
|
+
while true
|
16
|
+
init_stamp = Time.now.to_i
|
17
|
+
if `megaclisas-status --nagios` =~ /^RAID ([a-zA-Z]+) - Arrays: OK:(\d+) Bad:(\d+) - Disks: OK:(\d+) Bad:(\d+)/
|
18
|
+
array_ok = $2
|
19
|
+
array_bad = $3
|
20
|
+
disk_ok = $4
|
21
|
+
disk_bad = $5
|
22
|
+
|
23
|
+
puts "PUTVAL \"#{@hostname}/megaraid/gauge-array_ok\" interval=#{interval} N:#{array_ok}"
|
24
|
+
puts "PUTVAL \"#{@hostname}/megaraid/gauge-array_bad\" interval=#{interval} N:#{array_bad}"
|
25
|
+
puts "PUTVAL \"#{hostname}/megaraid/gauge-disk_ok\" interval=#{interval} N:#{disk_ok}"
|
26
|
+
puts "PUTVAL \"#{hostname}/megaraid/gauge-disk_bad\" interval=#{interval} N:#{disk_bad}"
|
27
|
+
end
|
28
|
+
end_stamp = Time.now.to_i
|
29
|
+
|
30
|
+
waitfor = @interval - (end_stamp - init_stamp)
|
31
|
+
sleep waitfor if waitfor > 0
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'megaraid-collectd/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "megaraid-collectd"
|
8
|
+
gem.version = Megaraid::Collectd::VERSION
|
9
|
+
gem.authors = ["Pierre-Yves Ritschard"]
|
10
|
+
gem.email = ["prd@exoscale.ch"]
|
11
|
+
gem.description = %q{collectd exec module to watch megaraid status}
|
12
|
+
gem.summary = %q{graph megaraid status}
|
13
|
+
gem.homepage = "https://github.com/exoscale/megaraid-collectd"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: megaraid-collectd
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 11
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 5
|
9
|
+
- 0
|
10
|
+
version: 0.5.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Pierre-Yves Ritschard
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-12-11 00:00:00 Z
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: collectd exec module to watch megaraid status
|
22
|
+
email:
|
23
|
+
- prd@exoscale.ch
|
24
|
+
executables:
|
25
|
+
- megaraid-collectd.rb
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- .gitignore
|
32
|
+
- Gemfile
|
33
|
+
- LICENSE.txt
|
34
|
+
- README.md
|
35
|
+
- Rakefile
|
36
|
+
- bin/megaraid-collectd.rb
|
37
|
+
- lib/megaraid-collectd.rb
|
38
|
+
- lib/megaraid-collectd/version.rb
|
39
|
+
- megaraid-collectd.gemspec
|
40
|
+
homepage: https://github.com/exoscale/megaraid-collectd
|
41
|
+
licenses: []
|
42
|
+
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options: []
|
45
|
+
|
46
|
+
require_paths:
|
47
|
+
- lib
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
hash: 3
|
54
|
+
segments:
|
55
|
+
- 0
|
56
|
+
version: "0"
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
hash: 3
|
63
|
+
segments:
|
64
|
+
- 0
|
65
|
+
version: "0"
|
66
|
+
requirements: []
|
67
|
+
|
68
|
+
rubyforge_project:
|
69
|
+
rubygems_version: 1.8.24
|
70
|
+
signing_key:
|
71
|
+
specification_version: 3
|
72
|
+
summary: graph megaraid status
|
73
|
+
test_files: []
|
74
|
+
|