sensu-plugins-strongswan 1.1.0 → 1.2.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
  SHA256:
3
- metadata.gz: 711c5b636803ec54756604e3cd1b41134c8ec9ec65a9795e67d872aceedaf633
4
- data.tar.gz: d2ad13c0ab097f364277edae55faebf40cb4b271abf64927e839281aa975100d
3
+ metadata.gz: 80f7ac80f303c96409a6b0ad8ba853c53843874a09a24cb3cc3a3f777026b808
4
+ data.tar.gz: 1e2e9abc29a5d95370f1b6d3058eb43089c603b30795635049490d8982cf2516
5
5
  SHA512:
6
- metadata.gz: cb6e96b31adf18a045f3358683e4a7e04e9fce77dd44f2ea97cd29b2de0e704990eaddc24181728bc90faeabd70d74f61bc39472fcc7400026350bfcd75a8541
7
- data.tar.gz: 563064f24fd4da0bcab190a11b2f1057a0d01e2f3d26220e96e947e44d9b13a9656840537df7f60b7ad21ad892b6faf9682c6c93914fcf82e2b96d56ed6648fb
6
+ metadata.gz: 66bec0cf1935fbabe0b0c071a1250ac1102e0721ec25920d4f51c8fa1f3bc8404d896abeb989617aa488a7593c80189948504760ff25df8dede9f4fb2b26dbe0
7
+ data.tar.gz: 0d87c74966d332db3375714458966ab1b11fcb5698b59e7b203482ab8a6994a539eb9c703878009df0a768fd10ce92f12ad63efef1c1c69e30d8157a2ca82e9b
data/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.2.0] - 2018-03-04
9
+ ### Added
10
+ - Added new metrics-strongswan-listcounters.rb plugin for getting IKE counters (@yuri-zubov)
11
+
12
+ ### Breaking Changes
13
+ Dropping ruby `< 2.1` support (@yuri-zubov)
14
+
8
15
  ## [1.1.0] - 2018-02-22
9
16
  ### Added
10
17
  - check-strongswan-connection.rb: checks the health of a strongwan connection (@nishiki)
@@ -36,7 +43,8 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
36
43
  ### Added
37
44
  - add check-strongswan.rb and metrics-strongswan.rb plugins
38
45
 
39
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-strongswan/compare/1.1.0...HEAD
46
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-strongswan/compare/1.2.0...HEAD
47
+ [1.2.0]: https://github.com/sensu-plugins/sensu-plugins-strongswan/compare/1.1.0...1.2.0
40
48
  [1.1.0]: https://github.com/sensu-plugins/sensu-plugins-strongswan/compare/1.0.0...1.1.0
41
49
  [1.0.0]: https://github.com/sensu-plugins/sensu-plugins-strongswan/0.1.1...1.0.0
42
50
  [0.1.1]: https://github.com/sensu-plugins/sensu-plugins-strongswan/compare/0.1.0...0.1.1
data/README.md CHANGED
@@ -13,6 +13,7 @@
13
13
  * bin/check-strongswan.rb
14
14
  * bin/metrics-strongswan.rb
15
15
  * bin/check-strongswan-connection.rb
16
+ * bin/check-strongswan-listcounters.rb
16
17
 
17
18
  ## Usage
18
19
 
@@ -0,0 +1,69 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # metrics-strongswan-listcounters.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-listcounters.rb
19
+ #
20
+ # NOTES:
21
+ # This plugin should be executed as root using sudo
22
+ #
23
+ # LICENSE:
24
+ # Copyright Yuri Zubov <yury.zubau@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 StrongswanListcountersMetrics < 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
+ option :connection,
42
+ description: 'Connection name to check',
43
+ short: '-c NAME',
44
+ long: '--connection NAME'
45
+
46
+ def run_ipsec_listcounters
47
+ stdout, result = Open3.capture2("ipsec listcounters #{config[:connection]}")
48
+ unknown 'Unable to get Strongswan listcounters' unless result.success?
49
+ stdout
50
+ end
51
+
52
+ def run
53
+ ipsec_status = run_ipsec_listcounters
54
+
55
+ found = false
56
+ ipsec_status.each_line do |line|
57
+ result = line.match(/(?<key>\w+).* (?<value>\d+)/)
58
+ if result
59
+ found = true
60
+ output "#{config[:scheme]}.#{result[:key]}", result[:value]
61
+ end
62
+ end
63
+ if found
64
+ ok
65
+ else
66
+ critical(ipsec_status)
67
+ end
68
+ end
69
+ end
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsStrongswan
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 1
4
+ MINOR = 2
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-strongswan
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-23 00:00:00.000000000 Z
11
+ date: 2018-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -155,6 +155,7 @@ email: "<sensu-users@googlegroups.com>"
155
155
  executables:
156
156
  - check-strongswan-connection.rb
157
157
  - check-strongswan.rb
158
+ - metrics-strongswan-listcounters.rb
158
159
  - metrics-strongswan.rb
159
160
  extensions: []
160
161
  extra_rdoc_files: []
@@ -164,6 +165,7 @@ files:
164
165
  - README.md
165
166
  - bin/check-strongswan-connection.rb
166
167
  - bin/check-strongswan.rb
168
+ - bin/metrics-strongswan-listcounters.rb
167
169
  - bin/metrics-strongswan.rb
168
170
  - lib/sensu-plugins-strongswan.rb
169
171
  - lib/sensu-plugins-strongswan/version.rb