sensu-plugins-exim 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: 2764703e8e7f1f84932af3453c910fdda47d517c
4
+ data.tar.gz: 39199dcd3ee1771879025a353af9d7532584f614
5
+ SHA512:
6
+ metadata.gz: 8648bcf8c3b86bff21d849f41e7d1e3b86904e81b06f4fed561e9bc41249112dfca0cadcb439b66cc0bdc2dd3e86a341001f7519437bc60f64bbb2a7bfba703a
7
+ data.tar.gz: 9f2236163dfbb5d7bbf92393430b02d991256412f7f879fdeb5a91d46b636a3652dab217b27941198510a53df9044540040f9672a198e63e4bd6b929a7b76547
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2017 Ed Robinson / Reevoo LTD
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,7 @@
1
+ # Sensu Plugin for Exim
2
+
3
+ ## Functionality
4
+ Checks the exim queue length
5
+
6
+ ### Files
7
+ bin/check-exim-queue.rb
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # check-exim-queue
4
+ #
5
+ # DESCRIPTION:
6
+ # Check the size of the Exim mail queue
7
+ #
8
+ # OUTPUT:
9
+ # Plain text
10
+ #
11
+ # PLATFORMS:
12
+ # Linux; any platform with Exim and Sensu
13
+ #
14
+ # DEPENDENCIES:
15
+ # gem: sensu-plugin
16
+ #
17
+
18
+ require 'sensu-plugin/check/cli'
19
+ require 'open3'
20
+
21
+ module SensuPluginsExim
22
+ # Check the size of the Exim mail queue
23
+ class CheckCLI < Sensu::Plugin::Check::CLI
24
+ option :path,
25
+ short: '-p EXIM_PATH',
26
+ long: '--path EXIM_PATH',
27
+ description: 'Path to the exim binary. Defaults to /usr/sbin/exim',
28
+ default: '/usr/sbin/exim'
29
+
30
+ option :warning,
31
+ short: '-w WARN_NUM',
32
+ long: '--warnnum WARN_NUM',
33
+ description: 'Number of messages in the queue' \
34
+ 'considered to be a warning',
35
+ required: true
36
+
37
+ option :critical,
38
+ short: '-c CRIT_NUM',
39
+ long: '--critnum CRIT_NUM',
40
+ description: 'Number of messages in the queue' \
41
+ 'considered to be critical',
42
+ required: true
43
+ def run
44
+ critical(msg) if queue_size >= critical_size
45
+ warning(msg) if queue_size >= warning_size
46
+ ok(msg)
47
+ end
48
+
49
+ private
50
+
51
+ def msg
52
+ "#{queue_size} messages in the exim queue"
53
+ end
54
+
55
+ def queue_size
56
+ @_queue_size ||= check_queue
57
+ end
58
+
59
+ def check_queue
60
+ out, status = Open3.capture2e("#{config[:path]} -bpc")
61
+ return out.chomp.to_i if status.success?
62
+ unknown(out)
63
+ end
64
+
65
+ def critical_size
66
+ config[:critical].to_i
67
+ end
68
+
69
+ def warning_size
70
+ config[:warning].to_i
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,9 @@
1
+ module SensuPluginsExim
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,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sensu-plugins-exim
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ed Robinson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-06-28 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'
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'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.40.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.40.0
69
+ description: This plugin provides exim queuemonitoring and metrics collection
70
+ email: ed@reevoo.com
71
+ executables:
72
+ - check-exim-queue.rb
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - LICENSE
77
+ - README.md
78
+ - bin/check-exim-queue.rb
79
+ - lib/sensu-plugins-exim/version.rb
80
+ homepage: https://github.com/reevoo/sensu-plugins-exim
81
+ licenses:
82
+ - MIT
83
+ metadata:
84
+ maintainer: reevoo
85
+ development_status: active
86
+ production_status: unstable
87
+ release_draft: 'false'
88
+ release_prerelease: 'false'
89
+ post_install_message: You can use the embedded Ruby by settingEMBEDDED_RUBY=true in
90
+ /etc/default/sensu
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 2.0.0
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 2.6.8
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: Sensu plugins for exim
110
+ test_files: []