sensu-plugins-strongswan 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04fee9587f49f3dc307d42f944772813ed0baa5a
4
- data.tar.gz: eb53f67656c9ffe97749aac31e5eccfba806ab67
3
+ metadata.gz: 4d400ee9149a1a972c5a3f440a948454002c6553
4
+ data.tar.gz: decf451c9f701beb26916aab62b6bd3b89b9d248
5
5
  SHA512:
6
- metadata.gz: 2fe0e069520c1be2a6ab3c72a57cc5b88b4f65cc563c2d2631f3e0bf6c2a70971d1b591a555b70b2aff240759b4c66a828752d1b558d46ea9456c3a7615dfafb
7
- data.tar.gz: 0d698e8d34d9b87f5d4cd5d0c080aa73d2b297b3dbdb2a4a046674819e012ce7001631c095a09d77e8fb36102a49ee4d6062b03d842dd8d4f0b9799f30ea5ad1
6
+ metadata.gz: f2fa1ad1d51138a8d06f8eda4d88dda0826691fe9951a7c6bbbdb532fa6060499dcf34a95abb7272b078455dcbda7ef30442f81581bc2114bb0f383933a4e906
7
+ data.tar.gz: 214a3c7a75a633616ef57abd9d3d60d83c33b57f9aae35c3709d87c13f10c9487f00ecb0fb20dd2e8403fa79b3c5e47bd9e6ba396b286d620fe865a9076057b8
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -3,7 +3,10 @@ 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
+ ## [0.1.0] - 2015-07-23
7
7
 
8
8
  ### Changed
9
9
  - updated sensu-plugin gem to 1.2.0
10
+
11
+ ### Added
12
+ - add check-strongswan.rb and metrics-strongswan.rb plugins
data/README.md CHANGED
@@ -11,11 +11,11 @@
11
11
 
12
12
  ## Files
13
13
 
14
+ * bin/check-strongswan.rb
15
+ * bin/metrics-strongswan.rb
16
+
14
17
  ## Usage
15
18
 
16
19
  ## Installation
17
20
 
18
21
  [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
19
-
20
- ## Notes
21
-
@@ -0,0 +1,61 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # check-strongswan.rb
4
+ #
5
+ # DESCRIPTION:
6
+ # This plugin checks the health of a Strongswan VPN server
7
+ #
8
+ # OUTPUT:
9
+ # plain text
10
+ #
11
+ # PLATFORMS:
12
+ # Linux
13
+ #
14
+ # DEPENDENCIES:
15
+ # gem: sensu-plugin
16
+ #
17
+ # USAGE:
18
+ # check-strongswan.rb
19
+ #
20
+ # NOTES:
21
+ # This plugin should be executed as root using sudo
22
+ #
23
+ # LICENSE:
24
+ # Copyright Eric Heydrick <eheydrick@gmail.com>
25
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
26
+ # for details.
27
+ #
28
+
29
+ require 'sensu-plugin/check/cli'
30
+ require 'English'
31
+
32
+ # check strongswan status
33
+ class CheckStrongswan < Sensu::Plugin::Check::CLI
34
+ option :warn_only,
35
+ description: 'Warn instead of critical if problems are found',
36
+ short: '-w',
37
+ long: '--warn-only',
38
+ default: false
39
+
40
+ def run_ipsec_status
41
+ `ipsec status`
42
+ $CHILD_STATUS
43
+ end
44
+
45
+ def run
46
+ ipsec_status = run_ipsec_status
47
+
48
+ case ipsec_status
49
+ when 0
50
+ ok 'Strongswan is accepting connections'
51
+ when 1..3
52
+ if config[:warn_only]
53
+ warning 'Strongswan is not running'
54
+ else
55
+ critical 'Strongswan is not running'
56
+ end
57
+ else
58
+ unknown 'Unable to check Strongswan status'
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,57 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # metrics-strongswan.rb
4
+ #
5
+ # DESCRIPTION:
6
+ # This plugin collects metrics from a Strongswan VPN server
7
+ #
8
+ # OUTPUT:
9
+ # metric data
10
+ #
11
+ # PLATFORMS:
12
+ # Linux
13
+ #
14
+ # DEPENDENCIES:
15
+ # gem: sensu-plugin
16
+ #
17
+ # USAGE:
18
+ # metrics-strongswan.rb
19
+ #
20
+ # NOTES:
21
+ # This plugin should be executed as root using sudo
22
+ #
23
+ # LICENSE:
24
+ # Copyright Eric Heydrick <eheydrick@gmail.com>
25
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
26
+ # for details.
27
+ #
28
+
29
+ require 'sensu-plugin/metric/cli'
30
+ require 'open3'
31
+ require 'socket'
32
+
33
+ # Collect strongswan metrics
34
+ class StrongswanMetrics < Sensu::Plugin::Metric::CLI::Graphite
35
+ option :scheme,
36
+ description: 'Metric naming scheme, text to prepend to metric',
37
+ short: '-s SCHEME',
38
+ long: '--scheme SCHEME',
39
+ default: "#{Socket.gethostname}.strongswan"
40
+
41
+ def run_ipsec_status
42
+ stdout, result = Open3.capture2('ipsec status')
43
+ unknown 'Unable to get Strongswan status' unless result.success?
44
+ stdout
45
+ end
46
+
47
+ def run
48
+ ipsec_status = run_ipsec_status
49
+ ipsec_status.each_line do |line|
50
+ if line =~ /Security Associations/
51
+ connections = ipsec_status.match(/Security Associations \((\d+)/)[1].to_i
52
+ output "#{config[:scheme]}.connections", connections
53
+ end
54
+ ok
55
+ end
56
+ end
57
+ end
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsStrongswan
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 0
5
- PATCH = 2
4
+ MINOR = 1
5
+ PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-strongswan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
@@ -30,7 +30,7 @@ cert_chain:
30
30
  8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
31
31
  HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
32
  -----END CERTIFICATE-----
33
- date: 2015-07-14 00:00:00.000000000 Z
33
+ date: 2015-07-23 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: sensu-plugin
@@ -174,13 +174,17 @@ dependencies:
174
174
  version: '0.8'
175
175
  description: Sensu plugins for strongswan
176
176
  email: "<sensu-users@googlegroups.com>"
177
- executables: []
177
+ executables:
178
+ - metrics-strongswan.rb
179
+ - check-strongswan.rb
178
180
  extensions: []
179
181
  extra_rdoc_files: []
180
182
  files:
181
183
  - CHANGELOG.md
182
184
  - LICENSE
183
185
  - README.md
186
+ - bin/check-strongswan.rb
187
+ - bin/metrics-strongswan.rb
184
188
  - lib/sensu-plugins-strongswan.rb
185
189
  - lib/sensu-plugins-strongswan/version.rb
186
190
  homepage: https://github.com/sensu-plugins/sensu-plugins-strongswan
metadata.gz.sig CHANGED
Binary file