sensu-plugins-kannel 0.0.3 → 0.1.0

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 CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e81bb383e66086a42ee98ed54ab065d5b77544f3
4
- data.tar.gz: 973889f299bb468507d61c3f8b14d1a87925191c
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OGNlNjA0ZWY5MmIwZWM0YTliNmRhNTI2MDg5OTViMGYxZjMyNmZmZg==
5
+ data.tar.gz: !binary |-
6
+ OTUzZmExMzMwNjI4ZjgyMjdkOWM0Y2NmYjRlNTI3ZWZkOGViYTQ4OA==
5
7
  SHA512:
6
- metadata.gz: 524c19ff08615eedde70967f60488e9d55bc6602f544c23b68261a3b4886a94de3a8f2d602f85c904a194b7d70006bf6d5a66af61690b166bae7e17f1eb7254c
7
- data.tar.gz: d50939df67f0a78257fbea6f2da2647a69ea6b03704b506b336556138f4d5689a9126a2d33d5a9fb76b1eec869225397ebb7f769f1521e0dbc7a847aebb5cdb5
8
+ metadata.gz: !binary |-
9
+ NTRjMzU0ZDc2ZDNjOTE0M2I0Njc4MWU1MWYyYjYyOWY4MjZiM2M2ODM3ZWNk
10
+ ODUyNTdlYzU1NWUzMTkxZmExMDJlYmI1NWIwNDNjYWM3ZWYzNDk2ZjkzYjZi
11
+ NmVlZmE5MWFiYWFhNjdjZGI3YmZjNTBiOGZmNWY4MWY0ZmVmNjY=
12
+ data.tar.gz: !binary |-
13
+ YjA4ZGJlMGYzYjNmZjEyODQyNDQ3ZTc1NTVjYWYyOWQ1NmU1NjdmNzMwMmZh
14
+ NGRhNjZjODgwZDQ1ZDliNDg5NmI0Zjk3YThjOTI2YTZkYTQyZTAzMzc4NjU0
15
+ ZDUwZmQ0ZTZjYTQ0OTc5MDQ4NDNmMzRjYWU0YjEyNDNkYzBhMmE=
data/CHANGELOG.md CHANGED
@@ -3,21 +3,31 @@ This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
4
  This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
5
 
6
- ## Unreleased][unreleased]
6
+ ## [Unreleased]
7
7
 
8
- ## [0.0.3] - 2015-07-14
8
+ ## [0.1.0] - 2016-08-18
9
9
  ### Changed
10
- - updated sensu-plugin gem to 1.2.0
11
-
12
- ## 0.0.1 - 2015-05-04
10
+ - Updated sensu-plugin dependency from `= 1.2.0` to `~> 1.2.0`
13
11
 
14
12
  ### Added
15
- - initial release
13
+ - metrics-kannel.rb: new metric plugin added!
14
+ - check-kannel.rb: new option for specifying pattern to match SMSC id
16
15
 
17
- ## [0.0.2] - 2015-06-03
16
+ ## [0.0.3] - 2015-07-14
17
+ ### Changed
18
+ - updated sensu-plugin gem to 1.2.0
18
19
 
20
+ ## [0.0.2] - 2015-06-03
19
21
  ### Fixed
20
22
  - added binstubs
21
23
 
22
24
  ### Changed
23
- - removed cruft from /lib
25
+ - removed cruft from /lib
26
+ ## 0.0.1 - 2015-05-04
27
+ ### Added
28
+ - initial release
29
+
30
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-kannel/compare/0.1.0...HEAD
31
+ [0.1.0]: https://github.com/sensu-plugins/sensu-plugins-kannel/compare/0.0.3...0.1.0
32
+ [0.0.3]: https://github.com/sensu-plugins/sensu-plugins-kannel/compare/0.0.2...0.0.3
33
+ [0.0.2]: https://github.com/sensu-plugins/sensu-plugins-kannel/compare/0.0.1...0.0.2
data/README.md CHANGED
@@ -5,17 +5,17 @@
5
5
  [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-kannel/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-kannel)
6
6
  [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-kannel/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-kannel)
7
7
  [![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-kannel.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-kannel)
8
- [![Codeship Status for sensu-plugins/sensu-plugins-kannel](https://codeship.com/projects/d8d1c750-d467-0132-8fdb-467e8e32dda1/status?branch=master)](https://codeship.com/projects/77775)
9
8
 
10
9
  ## Functionality
11
10
 
12
11
  ## Files
13
12
  * bin/check-kannel.rb
13
+ * bin/metrics-kannel.rb
14
14
 
15
15
  ## Usage
16
16
 
17
17
  ## Installation
18
18
 
19
- [Installation and Setup](https://github.com/sensu-plugins/documentation/blob/master/user_docs/installation_instructions.md)
19
+ [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
20
20
 
21
21
  ## Notes
data/bin/check-kannel.rb CHANGED
@@ -52,6 +52,11 @@ class CheckKannel < Sensu::Plugin::Check::CLI
52
52
  long: '--password PASSWORD',
53
53
  description: 'Your Kannel password'
54
54
 
55
+ option :pattern,
56
+ short: '-i PATTERN',
57
+ long: '--id PATTERN',
58
+ description: 'Match a SMSC id against this pattern'
59
+
55
60
  def run
56
61
  path = "/status.xml?password=#{config[:password]}"
57
62
 
@@ -70,6 +75,8 @@ class CheckKannel < Sensu::Plugin::Check::CLI
70
75
  [smsc.text('id'), smsc.text('status')]
71
76
  end]
72
77
 
78
+ smscs_status.reject! { |id, _| /#{config[:pattern]}/ !~ id } if config[:pattern]
79
+
73
80
  offline_smscs = smscs_status.reject { |_, status| status.start_with? 'online' }.keys
74
81
 
75
82
  if offline_smscs.any?
@@ -0,0 +1,95 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # metrics-kannel
4
+ #
5
+ # DESCRIPTION:
6
+ # This plugin checks get metrics for kannel
7
+ #
8
+ # OUTPUT:
9
+ # plain text
10
+ #
11
+ # PLATFORMS:
12
+ # Linux
13
+ #
14
+ # DEPENDENCIES:
15
+ # gem: sensu-plugin
16
+ #
17
+ # USAGE:
18
+ # metrics-kannel -h host -p port -P password
19
+ #
20
+ # NOTES:
21
+ #
22
+ # LICENSE:
23
+ # Marc-Andre Gatien <https://github.com/mag009>
24
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
25
+ # for details.
26
+ #
27
+
28
+ require 'sensu-plugin/metric/cli'
29
+ require 'net/http'
30
+ require 'rexml/document'
31
+
32
+ class Graphite < Sensu::Plugin::Metric::CLI::Graphite
33
+ option :host,
34
+ short: '-h HOST',
35
+ long: '--host HOST',
36
+ description: 'Your Kannel endpoint',
37
+ default: 'localhost'
38
+
39
+ option :port,
40
+ short: '-P PORT',
41
+ long: '--port PORT',
42
+ description: 'Your Kannel port',
43
+ default: 13000, # rubocop:disable NumericLiterals
44
+ proc: proc(&:to_i)
45
+
46
+ option :password,
47
+ short: '-p PASSWORD',
48
+ long: '--password PASSWORD',
49
+ description: 'Your Kannel password'
50
+
51
+ option :scheme,
52
+ description: 'Metric naming scheme, text to prepend to metric',
53
+ short: '-s SCHEME',
54
+ long: '--scheme SCHEME',
55
+ default: "#{Socket.gethostbyname(Socket.gethostname.to_s).first}.kannel"
56
+
57
+ def run
58
+ path = "/status.xml?password=#{config[:password]}"
59
+
60
+ begin
61
+ response = Net::HTTP.get(config[:host], path, config[:port])
62
+ rescue => e
63
+ critical e
64
+ end
65
+
66
+ document = REXML::Document.new(response)
67
+ critical 'Invalid XML document' if document.root.nil?
68
+ critical 'Invalid root element' if 'gateway' != document.root.name
69
+ critical 'Denied' if 'Denied' == document.root.text.strip
70
+ list = ['received/total', 'sent/total', 'inbound', 'outbound', 'storesize']
71
+
72
+ sms = {}
73
+ list.each do |k|
74
+ sms[k.sub('/', '.').to_s] = [REXML::XPath.first(document, "//sms/#{k}/text()")]
75
+ end
76
+
77
+ sms.each do |k, v|
78
+ if k =~ /bound/
79
+ v = v.join(',').split(',')
80
+ end
81
+ v = v.first
82
+ output [config[:scheme], k].join('.'), v
83
+ end
84
+
85
+ Hash[REXML::XPath.each(document, '//smsc').map do |smsc|
86
+ output [config[:scheme], smsc.text('id'), 'failed'].join('.'), smsc.text('failed')
87
+ output [config[:scheme], smsc.text('id'), 'queued'].join('.'), smsc.text('queued')
88
+ output [config[:scheme], smsc.text('id'), 'received'].join('.'), smsc.text('sms/received')
89
+ output [config[:scheme], smsc.text('id'), 'sent'].join('.'), smsc.text('sms/sent')
90
+ output [config[:scheme], smsc.text('id'), 'inbound'].join('.'), smsc.text('sms/inbound').split(',').first
91
+ output [config[:scheme], smsc.text('id'), 'outbound'].join('.'), smsc.text('sms/outbound').split(',').first
92
+ end]
93
+ ok
94
+ end
95
+ end
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsKannel
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 0
5
- PATCH = 3
4
+ MINOR = 1
5
+ PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,181 +1,160 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-kannel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDgDCCAmigAwIBAgIBATANBgkqhkiG9w0BAQUFADBDMRIwEAYDVQQDDAltYXR0
14
- am9uZXMxGDAWBgoJkiaJk/IsZAEZFgh5aWVsZGJvdDETMBEGCgmSJomT8ixkARkW
15
- A2NvbTAeFw0xNTAxMjgyMTAyNTFaFw0xNjAxMjgyMTAyNTFaMEMxEjAQBgNVBAMM
16
- CW1hdHRqb25lczEYMBYGCgmSJomT8ixkARkWCHlpZWxkYm90MRMwEQYKCZImiZPy
17
- LGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyTSzVYnO
18
- CLgyrIyT1mBQakArQyW8xhi6MlDqyzXHJGeERT790U6EgoBVeS4XoK0ptFZNR8Tf
19
- zko0w+Nv47TarSCgkPOaxY+mxWnAVR10dOmfeLr7huiMyps+YD56/EF2FqQ3jf/+
20
- qohENfKD91qy1ieEy+Fn7Pf74ltbNKUdkb9a9eFXQ0DQ4ip5vik7DzjQkUTj4lca
21
- k6ArwnmHX4YDhZoYtrQJ8jVktN0/+NtA40M5qkCYHNe5tUW25b/tKVYuioxG6b2Z
22
- oIzaZxRLxf6HVAWpCVRT/F5+/yjigkX4u++eYacfLGleXQzoK7BL65vHGMJygWEE
23
- 0TKGqFOrl/L0AQIDAQABo38wfTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNV
24
- HQ4EFgQUEf6a8Td7MrSZc8ImbLFZAENPbz0wIQYDVR0RBBowGIEWbWF0dGpvbmVz
25
- QHlpZWxkYm90LmNvbTAhBgNVHRIEGjAYgRZtYXR0am9uZXNAeWllbGRib3QuY29t
26
- MA0GCSqGSIb3DQEBBQUAA4IBAQBbzXAYA3BVGw8DZ0YYoY1VHPNEcH5qPIApmHO8
27
- rvSmuUT0yMEi7u00H/5uHRFf4LleGT/+sTdyXKsNPGT9kdRuQEgwi+vf7Zfvd8aX
28
- UF/+4VkEYf/8rV8Ere6u2QaWPgApdMV6JjKr1fAwCTd8AuGXNaWItiPPMseSQzLJ
29
- JKP4hVvbc1d+oS925B1lcBiqn2aYvElbyNAVmQPywNNqkWmvtlqj9ZVJfV5HQLdu
30
- 8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
31
- HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
- -----END CERTIFICATE-----
33
- date: 2015-07-14 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2016-08-19 00:00:00.000000000 Z
34
12
  dependencies:
35
13
  - !ruby/object:Gem::Dependency
36
14
  name: sensu-plugin
37
15
  requirement: !ruby/object:Gem::Requirement
38
16
  requirements:
39
- - - '='
17
+ - - ~>
40
18
  - !ruby/object:Gem::Version
41
- version: 1.2.0
19
+ version: '1.2'
42
20
  type: :runtime
43
21
  prerelease: false
44
22
  version_requirements: !ruby/object:Gem::Requirement
45
23
  requirements:
46
- - - '='
24
+ - - ~>
47
25
  - !ruby/object:Gem::Version
48
- version: 1.2.0
26
+ version: '1.2'
49
27
  - !ruby/object:Gem::Dependency
50
- name: codeclimate-test-reporter
28
+ name: bundler
51
29
  requirement: !ruby/object:Gem::Requirement
52
30
  requirements:
53
- - - "~>"
31
+ - - ~>
54
32
  - !ruby/object:Gem::Version
55
- version: '0.4'
33
+ version: '1.7'
56
34
  type: :development
57
35
  prerelease: false
58
36
  version_requirements: !ruby/object:Gem::Requirement
59
37
  requirements:
60
- - - "~>"
38
+ - - ~>
61
39
  - !ruby/object:Gem::Version
62
- version: '0.4'
40
+ version: '1.7'
63
41
  - !ruby/object:Gem::Dependency
64
- name: rubocop
42
+ name: codeclimate-test-reporter
65
43
  requirement: !ruby/object:Gem::Requirement
66
44
  requirements:
67
- - - '='
45
+ - - ~>
68
46
  - !ruby/object:Gem::Version
69
- version: '0.30'
47
+ version: '0.4'
70
48
  type: :development
71
49
  prerelease: false
72
50
  version_requirements: !ruby/object:Gem::Requirement
73
51
  requirements:
74
- - - '='
52
+ - - ~>
75
53
  - !ruby/object:Gem::Version
76
- version: '0.30'
54
+ version: '0.4'
77
55
  - !ruby/object:Gem::Dependency
78
- name: rspec
56
+ name: github-markup
79
57
  requirement: !ruby/object:Gem::Requirement
80
58
  requirements:
81
- - - "~>"
59
+ - - ~>
82
60
  - !ruby/object:Gem::Version
83
- version: '3.1'
61
+ version: '1.3'
84
62
  type: :development
85
63
  prerelease: false
86
64
  version_requirements: !ruby/object:Gem::Requirement
87
65
  requirements:
88
- - - "~>"
66
+ - - ~>
89
67
  - !ruby/object:Gem::Version
90
- version: '3.1'
68
+ version: '1.3'
91
69
  - !ruby/object:Gem::Dependency
92
- name: bundler
70
+ name: pry
93
71
  requirement: !ruby/object:Gem::Requirement
94
72
  requirements:
95
- - - "~>"
73
+ - - ~>
96
74
  - !ruby/object:Gem::Version
97
- version: '1.7'
75
+ version: '0.10'
98
76
  type: :development
99
77
  prerelease: false
100
78
  version_requirements: !ruby/object:Gem::Requirement
101
79
  requirements:
102
- - - "~>"
80
+ - - ~>
103
81
  - !ruby/object:Gem::Version
104
- version: '1.7'
82
+ version: '0.10'
105
83
  - !ruby/object:Gem::Dependency
106
84
  name: rake
107
85
  requirement: !ruby/object:Gem::Requirement
108
86
  requirements:
109
- - - "~>"
87
+ - - ~>
110
88
  - !ruby/object:Gem::Version
111
- version: '10.0'
89
+ version: '10.5'
112
90
  type: :development
113
91
  prerelease: false
114
92
  version_requirements: !ruby/object:Gem::Requirement
115
93
  requirements:
116
- - - "~>"
94
+ - - ~>
117
95
  - !ruby/object:Gem::Version
118
- version: '10.0'
96
+ version: '10.5'
119
97
  - !ruby/object:Gem::Dependency
120
- name: github-markup
98
+ name: redcarpet
121
99
  requirement: !ruby/object:Gem::Requirement
122
100
  requirements:
123
- - - "~>"
101
+ - - ~>
124
102
  - !ruby/object:Gem::Version
125
- version: '1.3'
103
+ version: '3.2'
126
104
  type: :development
127
105
  prerelease: false
128
106
  version_requirements: !ruby/object:Gem::Requirement
129
107
  requirements:
130
- - - "~>"
108
+ - - ~>
131
109
  - !ruby/object:Gem::Version
132
- version: '1.3'
110
+ version: '3.2'
133
111
  - !ruby/object:Gem::Dependency
134
- name: redcarpet
112
+ name: rubocop
135
113
  requirement: !ruby/object:Gem::Requirement
136
114
  requirements:
137
- - - "~>"
115
+ - - ~>
138
116
  - !ruby/object:Gem::Version
139
- version: '3.2'
117
+ version: 0.40.0
140
118
  type: :development
141
119
  prerelease: false
142
120
  version_requirements: !ruby/object:Gem::Requirement
143
121
  requirements:
144
- - - "~>"
122
+ - - ~>
145
123
  - !ruby/object:Gem::Version
146
- version: '3.2'
124
+ version: 0.40.0
147
125
  - !ruby/object:Gem::Dependency
148
- name: yard
126
+ name: rspec
149
127
  requirement: !ruby/object:Gem::Requirement
150
128
  requirements:
151
- - - "~>"
129
+ - - ~>
152
130
  - !ruby/object:Gem::Version
153
- version: '0.8'
131
+ version: '3.4'
154
132
  type: :development
155
133
  prerelease: false
156
134
  version_requirements: !ruby/object:Gem::Requirement
157
135
  requirements:
158
- - - "~>"
136
+ - - ~>
159
137
  - !ruby/object:Gem::Version
160
- version: '0.8'
138
+ version: '3.4'
161
139
  - !ruby/object:Gem::Dependency
162
- name: pry
140
+ name: yard
163
141
  requirement: !ruby/object:Gem::Requirement
164
142
  requirements:
165
- - - "~>"
143
+ - - ~>
166
144
  - !ruby/object:Gem::Version
167
- version: '0.10'
145
+ version: '0.8'
168
146
  type: :development
169
147
  prerelease: false
170
148
  version_requirements: !ruby/object:Gem::Requirement
171
149
  requirements:
172
- - - "~>"
150
+ - - ~>
173
151
  - !ruby/object:Gem::Version
174
- version: '0.10'
152
+ version: '0.8'
175
153
  description: Sensu plugins for the Kannel WAP/SMS Gateway
176
- email: "<sensu-users@googlegroups.com>"
154
+ email: <sensu-users@googlegroups.com>
177
155
  executables:
178
156
  - check-kannel.rb
157
+ - metrics-kannel.rb
179
158
  extensions: []
180
159
  extra_rdoc_files: []
181
160
  files:
@@ -183,6 +162,7 @@ files:
183
162
  - LICENSE
184
163
  - README.md
185
164
  - bin/check-kannel.rb
165
+ - bin/metrics-kannel.rb
186
166
  - lib/sensu-plugins-kannel.rb
187
167
  - lib/sensu-plugins-kannel/version.rb
188
168
  homepage: https://github.com/sensu-plugins/sensu-plugins-kannel
@@ -201,17 +181,17 @@ require_paths:
201
181
  - lib
202
182
  required_ruby_version: !ruby/object:Gem::Requirement
203
183
  requirements:
204
- - - ">="
184
+ - - ! '>='
205
185
  - !ruby/object:Gem::Version
206
186
  version: 1.9.3
207
187
  required_rubygems_version: !ruby/object:Gem::Requirement
208
188
  requirements:
209
- - - ">="
189
+ - - ! '>='
210
190
  - !ruby/object:Gem::Version
211
191
  version: '0'
212
192
  requirements: []
213
193
  rubyforge_project:
214
- rubygems_version: 2.4.6
194
+ rubygems_version: 2.4.5
215
195
  signing_key:
216
196
  specification_version: 4
217
197
  summary: Sensu plugins for the Kannel WAP/SMS Gateway
checksums.yaml.gz.sig DELETED
Binary file
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
Binary file