sensu-plugins-mailq 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d27a2ec6e4a4703dcde40b64f629e52d7fe9b608
4
+ data.tar.gz: 957543d7e749b86f2985745c0be8b96905170c31
5
+ SHA512:
6
+ metadata.gz: d95fb78cb17a38d706ef63e739c4008a59a6e176390c86d024261f852e038ff224e2649054fd2f3d463354a33323de08aa53075586b1bd8f759666cfc3c74902
7
+ data.tar.gz: 5ab80c56ce63004dc154d9af591051861d7ddbc6d8e7afea90b1a1f7016a25a94abe5c0c72132d4b5da3f0c8f87e7b5480d83e9ca26350b16b2da24f25840875
@@ -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
+
@@ -0,0 +1,17 @@
1
+ # Sensu plugin for monitoring the system mail queue
2
+
3
+ A sensu plugin to monitor the system mail queue. It supports both <b>Postfix</b> and <b>Exim</b>.
4
+
5
+ ## Usage
6
+
7
+ The plugin accepts the following command line options:
8
+
9
+ ```
10
+ Usage: check-mailq.rb (options)
11
+ -c, --critical <LENGTH> Critical if LENGTH exceeds current mail queue
12
+ --mailq-cmd <PATH> Path to mailq executable (default: /usr/bin/mailq)
13
+ -w, --warn <LENGTH> Warn if LENGTH exceeds current mail queue
14
+ ```
15
+
16
+ ## Author
17
+ Matteo Cerutti - <matteo.cerutti@hotmail.co.uk>
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # check-mailq.rb
4
+ #
5
+ # Author: Matteo Cerutti <matteo.cerutti@hotmail.co.uk>
6
+ #
7
+
8
+ require 'sensu-plugin/check/cli'
9
+
10
+ class CheckMailQueue < Sensu::Plugin::Check::CLI
11
+ option :mailq_cmd,
12
+ :description => "Path to mailq executable (default: /usr/bin/mailq)",
13
+ :long => "--mailq-cmd <PATH>",
14
+ :default => "/usr/bin/mailq"
15
+
16
+ option :warn,
17
+ :description => "Warn if LENGTH exceeds current mail queue",
18
+ :short => "-w <LENGTH>",
19
+ :long => "--warn <LENGTH>",
20
+ :proc => proc(&:to_i),
21
+ :default => 1
22
+
23
+ option :crit,
24
+ :description => "Critical if LENGTH exceeds current mail queue",
25
+ :short => "-c <LENGTH>",
26
+ :long => "--critical <LENGTH>",
27
+ :proc => proc(&:to_i),
28
+ :default => 5
29
+
30
+ def initialize()
31
+ super
32
+
33
+ raise "Unable to find mailq command" unless File.executable?(config[:mailq_cmd])
34
+ end
35
+
36
+ def run
37
+ mailq = %x[#{config[:mailq_cmd]}]
38
+ if mailq =~ /^Mail queue is empty$/
39
+ ok("Mail queue is empty")
40
+ else
41
+ # calculate queue length
42
+ length = mailq[/^-- \d+ Kbytes in (\d+) Request/, 1].to_i
43
+
44
+ critical("Mail queue has #{length} messages") if length >= config[:crit]
45
+ warning("Mail queue has #{length} messages") if length >= config[:warn]
46
+ end
47
+ end
48
+ end
@@ -0,0 +1 @@
1
+ require 'sensu-plugins-mailq/version'
@@ -0,0 +1,9 @@
1
+ module SensuPluginsMailQueue
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-mailq
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 system mail queue
28
+ email: "<matteo.cerutti@hotmail.co.uk>"
29
+ executables:
30
+ - check-mailq.rb
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - CHANGELOG.md
35
+ - LICENSE
36
+ - README.md
37
+ - bin/check-mailq.rb
38
+ - lib/sensu-plugins-mailq.rb
39
+ - lib/sensu-plugins-mailq/version.rb
40
+ homepage: https://github.com/m4ce/sensu-plugins-mailq
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 the system mail queue
70
+ test_files: []