check_es 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.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in check_es.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,25 @@
1
+ check_graphite is a nagios module to query graphite
2
+
3
+ ## Example
4
+
5
+ check_graphite -H 'http://my.graphite.host
6
+
7
+ check_graphite -H "http://your.graphite.host/render" -M collectd.somebox.load.load.midterm -w 1 -c 2 -N load
8
+ WARNING|load=1.4400000000000002;;;;
9
+
10
+ check_graphite accepts the following options:
11
+
12
+ * `-H` or `--endpoint`: the graphite HTTP endpoint which can be queried
13
+ * `-M' or `--metric`: the metric expression which will be queried, it can be an expression
14
+ * `-F` or `--from`: time frame for which to query metrics, defaults to "30seconds"
15
+ * `-N` or `--name`: name to give to the metric, defaults to "value"
16
+ * `-w`: warning threshold for the metric
17
+ * `-c`: critical threshold for the metric
18
+ * `-t`: timeout after which the metric should be considered unknown
19
+
20
+ ## How it works
21
+
22
+ check_graphite, asks for a small window of metrics, and computes an average over the last valid
23
+ points collected, it then checks the value against supplied thresholds.
24
+
25
+ NaN values are not taken into account in the average
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/check_es ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'check_es'
4
+ CheckES::Command.new.run
data/check_es.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "check_es/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "check_es"
7
+ s.version = CheckES::VERSION
8
+ s.authors = ["Pierre-Yves Ritschard"]
9
+ s.email = ["pyr@spootnik.org"]
10
+ s.homepage = "https://github.com/pyr/check-es"
11
+ s.summary = %q{check_es}
12
+ s.description = %q{check values from a es server}
13
+
14
+ s.rubyforge_project = "check_es"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+ s.add_runtime_dependency "nagios_check"
24
+ s.add_runtime_dependency "http"
25
+ end
@@ -0,0 +1,3 @@
1
+ module CheckES
2
+ VERSION = "0.0.1"
3
+ end
data/lib/check_es.rb ADDED
@@ -0,0 +1,31 @@
1
+ require "nagios_check"
2
+ require "json"
3
+ require "http"
4
+ require "check_es/version"
5
+
6
+ module CheckES
7
+
8
+ class Command
9
+ include NagiosCheck
10
+
11
+ on "--endpoint ENDPOINT", "-H ENDPOINT", :mandatory
12
+
13
+ enable_warning
14
+ enable_critical
15
+ enable_timeout
16
+
17
+ def check
18
+ data = Http.get "#{options.endpoint}/_cluster/health"
19
+ status = data['status']
20
+ nodes = data['number_of_nodes']
21
+
22
+ if status != 'green'
23
+ store_message "cluster status is #{status} with #{nodes} nodes"
24
+ store_value :nodes, nodes
25
+ 0
26
+ else
27
+ nodes.to_i
28
+ end
29
+ end
30
+ end
31
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: check_es
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Pierre-Yves Ritschard
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-31 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: nagios_check
16
+ requirement: &13001980 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *13001980
25
+ - !ruby/object:Gem::Dependency
26
+ name: http
27
+ requirement: &13001400 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *13001400
36
+ description: check values from a es server
37
+ email:
38
+ - pyr@spootnik.org
39
+ executables:
40
+ - check_es
41
+ extensions: []
42
+ extra_rdoc_files: []
43
+ files:
44
+ - .gitignore
45
+ - Gemfile
46
+ - README.md
47
+ - Rakefile
48
+ - bin/check_es
49
+ - check_es.gemspec
50
+ - lib/check_es.rb
51
+ - lib/check_es/version.rb
52
+ homepage: https://github.com/pyr/check-es
53
+ licenses: []
54
+ post_install_message:
55
+ rdoc_options: []
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ requirements: []
71
+ rubyforge_project: check_es
72
+ rubygems_version: 1.8.10
73
+ signing_key:
74
+ specification_version: 3
75
+ summary: check_es
76
+ test_files: []