sensu-plugins-windows 0.0.2 → 0.0.3

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,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 68df85fa709f9fd50cf158b037b201655124765e
4
- data.tar.gz: 108ef64f4552825adad6762e3d747e74c8303224
3
+ metadata.gz: 4622a0b5981fa157fff7a040eef1d82f7ab4d33e
4
+ data.tar.gz: a1936a7be532651c19bbc2cb2dbc40cae761154c
5
5
  SHA512:
6
- metadata.gz: fac82fa80e6038885ded6ac7430c7799baec7bf6b56acbab53de02f52749ebddfd0a5d402ce64e6946b176bda256be7ebc80521dd1b93c7843fbd1a896e691a6
7
- data.tar.gz: 7d7ba25a64faa7f5229d690a7db3000b97fcb8978ce3de82915c2774ce665577f52a042d82c16a3a7ec3999bf681c5dce2b0df4e18daad52ebc0d41f7e540d2e
6
+ metadata.gz: 71d6c06e2398d17960dc4875415b72394294886c4b34f510fc7ba62ee88e747c2f6b9dae9f700941e66a2a317cb35f4a6442fc9ce38b22e5f27bab113ef8a4f1
7
+ data.tar.gz: d6e99d764fba6f62bc68c80776688a0a234fbd561f4716366c9fcf0606b87bf4e63d2049df2f6223e971561d4dc87d04ec17e4e0e1f0719d717311de94ba6864
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -5,6 +5,15 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
5
5
 
6
6
  ## Unreleased][unreleased]
7
7
 
8
+ ## [0.0.4] - 2015-07-05
9
+ ### Added
10
+ - windows uptime metrics
11
+ - windows RAM metrics
12
+ - windows network metrics
13
+
14
+ ### Removed
15
+ - removed IIS check / metrics plugins and moved them to their own sensu iis plugin repository
16
+
8
17
  ## [0.0.2] - 2015-06-03
9
18
 
10
19
  ### Fixed
data/README.md CHANGED
@@ -13,13 +13,10 @@
13
13
  * bin/metrics-windows-ram-usage.rb
14
14
  * bin/metrics-windows-cpu-load.rb
15
15
  * bin/metrics-windows-disk-usage.rb
16
- * bin/metrics-iis-get-requests.rb
17
- * bin/metrics-iis-current-connections.rb
18
16
  * bin/check-windows-service.rb
19
17
  * bin/check-windows-process.rb
20
18
  * bin/check-windows-disk.rb
21
19
  * bin/check-windows-cpu-load.rb
22
- * bin/check-iis-current-connections.rb
23
20
 
24
21
  ## Usage
25
22
 
@@ -0,0 +1,62 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # check-windows-ram.rb
4
+ #
5
+ # DESCRIPTION:
6
+ #
7
+ # OUTPUT:
8
+ # plain text
9
+ #
10
+ # PLATFORMS:
11
+ # Windows
12
+ #
13
+ # DEPENDENCIES:
14
+ # gem: sensu-plugin
15
+ #
16
+ # USAGE:
17
+ #
18
+ # NOTES:
19
+ # Tested on Windows 2008RC2.
20
+ #
21
+ # LICENSE:
22
+ # Jean-Francois Theroux <me@failshell.io>
23
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
24
+ # for details.
25
+ #
26
+
27
+ require 'sensu-plugin/check/cli'
28
+
29
+ #
30
+ # Check Windows RAM Load
31
+ #
32
+ class CheckWindowsRAMLoad < Sensu::Plugin::Check::CLI
33
+ option :warning,
34
+ short: '-w WARNING',
35
+ default: 85,
36
+ proc: proc(&:to_i)
37
+
38
+ option :critical,
39
+ short: '-c CRITICAL',
40
+ default: 95,
41
+ proc: proc(&:to_i)
42
+
43
+ def acquire_ram_usage # rubocop:disable all
44
+ temp_arr_1 = []
45
+ temp_arr_2 = []
46
+ IO.popen("typeperf -sc 1 \"Memory\\Available bytes\" ") { |io| io.each { |line| temp_arr_1.push(line) } }
47
+ temp = temp_arr_1[2].split(',')[1]
48
+ ram_available_in_bytes = temp[1, temp.length - 3].to_f
49
+ IO.popen('wmic OS get TotalVisibleMemorySize /Value') { |io| io.each { |line| temp_arr_2.push(line) } }
50
+ total_ram = temp_arr_2[4].split('=')[1].to_f
51
+ total_ram_in_bytes = total_ram * 1000.0
52
+ ram_use_percent = (total_ram_in_bytes - ram_available_in_bytes) * 100.0 / (total_ram_in_bytes)
53
+ ram_use_percent.round(2)
54
+ end
55
+
56
+ def run # rubocop:disable all
57
+ ram_load = acquire_ram_usage
58
+ critical "RAM at #{ram_load}%" if ram_load > config[:critical]
59
+ warning "RAM at #{ram_load}%" if ram_load > config[:warning]
60
+ ok "RAM at #{ram_load}%"
61
+ end
62
+ end
@@ -0,0 +1,68 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # uptime-windows
4
+ #
5
+ # DESCRIPTION:
6
+ # This is metrics which outputs the uptime in seconds in Graphite acceptable format.
7
+ #
8
+ # OUTPUT:
9
+ # metric data
10
+ #
11
+ # PLATFORMS:
12
+ # Windows
13
+ #
14
+ # DEPENDENCIES:
15
+ # gem: sensu-plugin
16
+ # gem: socket
17
+ #
18
+ # USAGE:
19
+ #
20
+ # NOTES:
21
+ #
22
+ # LICENSE:
23
+ # Copyright 2015 <miguelangel.garcia@gmail.com>
24
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
25
+ # for details.
26
+ #
27
+
28
+ require 'rubygems' if RUBY_VERSION < '1.9.0'
29
+ require 'sensu-plugin/metric/cli'
30
+ require 'socket'
31
+ require 'time'
32
+ require 'csv'
33
+
34
+ class UptimeMetric < Sensu::Plugin::Metric::CLI::Graphite
35
+ option :scheme,
36
+ description: 'Metric naming scheme, text to prepend to .$interface.$metric',
37
+ long: '--scheme SCHEME',
38
+ default: "#{Socket.gethostname}.system.network"
39
+ option :interface,
40
+ description: 'Metric naming scheme, text to prepend to .$parent.$child',
41
+ long: '--interface INTERFACE',
42
+ default: '*'
43
+
44
+ def run
45
+ interface = config[:interface]
46
+ timestamp = Time.now.utc.to_i
47
+ IO.popen("typeperf -sc 1 \"\\Network Interface(#{interface})\\*\" ") do |io|
48
+ CSV.parse(io.read, headers: true) do |row|
49
+ row.each do |k, v|
50
+ next unless v && k
51
+ break if v.start_with? 'Exiting'
52
+
53
+ path = k.split('\\')
54
+ ifz = path[3]
55
+ metric = path[4]
56
+ next unless ifz && metric
57
+
58
+ ifz_name = ifz[18, ifz.length - 19].gsub('.', ' ')
59
+ value = format('%.2f', v.to_f)
60
+ name = [config[:scheme], ifz_name, metric].join('.').gsub(' ', '_').tr('{}', '')
61
+
62
+ output name, value, timestamp
63
+ end
64
+ end
65
+ end
66
+ ok
67
+ end
68
+ end
@@ -0,0 +1,54 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # uptime-windows
4
+ #
5
+ # DESCRIPTION:
6
+ # This is metrics which outputs the uptime in seconds in Graphite acceptable format.
7
+ #
8
+ # OUTPUT:
9
+ # metric data
10
+ #
11
+ # PLATFORMS:
12
+ # Windows
13
+ #
14
+ # DEPENDENCIES:
15
+ # gem: sensu-plugin
16
+ # gem: socket
17
+ #
18
+ # USAGE:
19
+ #
20
+ # NOTES:
21
+ #
22
+ # LICENSE:
23
+ # Copyright 2015 <miguelangel.garcia@gmail.com>
24
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
25
+ # for details.
26
+ #
27
+
28
+ require 'rubygems' if RUBY_VERSION < '1.9.0'
29
+ require 'sensu-plugin/metric/cli'
30
+ require 'socket'
31
+ require 'time'
32
+
33
+ class UptimeMetric < Sensu::Plugin::Metric::CLI::Graphite
34
+ option :scheme,
35
+ description: 'Metric naming scheme, text to prepend to .$parent.$child',
36
+ long: '--scheme SCHEME',
37
+ default: "#{Socket.gethostname}.system"
38
+
39
+ def acquire_uptime
40
+ temp_arr = []
41
+ timestamp = Time.now.utc.to_i
42
+ IO.popen("typeperf -sc 1 \"\\System\\System Up Time\" ") { |io| io.each { |line| temp_arr.push(line) } }
43
+ uptime_str = temp_arr[2].split(',')[1]
44
+ uptime = uptime_str.strip[1, uptime_str.length - 3]
45
+ [format('%.2f', uptime), timestamp]
46
+ end
47
+
48
+ def run
49
+ # To get the uptime usage
50
+ values = acquire_uptime
51
+ output [config[:scheme], 'uptime'].join('.'), values[0], values[1]
52
+ ok
53
+ end
54
+ end
@@ -2,7 +2,7 @@ module SensuPluginsWindows
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- PATCH = 2
5
+ PATCH = 3
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-windows
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
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-06-04 00:00:00.000000000 Z
33
+ date: 2015-07-06 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: sensu-plugin
@@ -64,14 +64,14 @@ dependencies:
64
64
  name: rubocop
65
65
  requirement: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - "~>"
67
+ - - '='
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0.30'
70
70
  type: :development
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - "~>"
74
+ - - '='
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0.30'
77
77
  - !ruby/object:Gem::Dependency
@@ -175,34 +175,34 @@ dependencies:
175
175
  description: Sensu plugins for Windows
176
176
  email: "<sensu-users@googlegroups.com>"
177
177
  executables:
178
+ - metrics-windows-uptime.rb
178
179
  - metrics-windows-ram-usage.rb
180
+ - metrics-windows-network.rb
179
181
  - metrics-windows-disk-usage.rb
180
182
  - metrics-windows-cpu-load.rb
181
- - metrics-iis-get-requests.rb
182
- - metrics-iis-current-connections.rb
183
183
  - extension-wmi-metrics.rb
184
184
  - check-windows-service.rb
185
+ - check-windows-ram.rb
185
186
  - check-windows-process.rb
186
187
  - check-windows-disk.rb
187
188
  - check-windows-cpu-load.rb
188
- - check-iis-current-connections.rb
189
189
  extensions: []
190
190
  extra_rdoc_files: []
191
191
  files:
192
192
  - CHANGELOG.md
193
193
  - LICENSE
194
194
  - README.md
195
- - bin/check-iis-current-connections.rb
196
195
  - bin/check-windows-cpu-load.rb
197
196
  - bin/check-windows-disk.rb
198
197
  - bin/check-windows-process.rb
198
+ - bin/check-windows-ram.rb
199
199
  - bin/check-windows-service.rb
200
200
  - bin/extension-wmi-metrics.rb
201
- - bin/metrics-iis-current-connections.rb
202
- - bin/metrics-iis-get-requests.rb
203
201
  - bin/metrics-windows-cpu-load.rb
204
202
  - bin/metrics-windows-disk-usage.rb
203
+ - bin/metrics-windows-network.rb
205
204
  - bin/metrics-windows-ram-usage.rb
205
+ - bin/metrics-windows-uptime.rb
206
206
  - lib/sensu-plugins-windows.rb
207
207
  - lib/sensu-plugins-windows/version.rb
208
208
  homepage: https://github.com/sensu-plugins/sensu-plugins-windows
metadata.gz.sig CHANGED
Binary file
@@ -1,54 +0,0 @@
1
- #! /usr/bin/env ruby
2
- #
3
- # check-iis-current-connections
4
- #
5
- # DESCRIPTION:
6
- #
7
- # OUTPUT:
8
- # plain text
9
- #
10
- # PLATFORMS:
11
- # Windows
12
- #
13
- # DEPENDENCIES:
14
- # gem: sensu-plugin
15
- #
16
- # USAGE:
17
- #
18
- # NOTES:
19
- # Tested on Windows 2012RC2.
20
- #
21
- # LICENSE:
22
- # Yohei Kawahara <inokara@gmail.com>
23
- # Released under the same terms as Sensu (the MIT license); see LICENSE
24
- # for details.
25
- #
26
-
27
- require 'sensu-plugin/check/cli'
28
-
29
- #
30
- # Check IIS Current Connections
31
- #
32
- class CheckIisCurrentConnections < Sensu::Plugin::Check::CLI
33
- option :warning,
34
- short: '-w WARNING',
35
- proc: proc(&:to_f),
36
- default: 50
37
-
38
- option :critical,
39
- short: '-c CRITICAL',
40
- proc: proc(&:to_f),
41
- default: 150
42
-
43
- option :site,
44
- short: '-s sitename',
45
- default: '_Total'
46
-
47
- def run # rubocop:disable all
48
- io = IO.popen("typeperf -sc 1 \"Web Service(#{config[:site]})\\Current\ Connections\"")
49
- current_connection = io.readlines[2].split(',')[1].gsub(/"/, '').to_f
50
- critical "Current Connectio at #{current_connection}" if current_connection > config[:critical]
51
- warning "Current Connectio at #{current_connection}" if current_connection > config[:warning]
52
- ok "Current Connection at #{current_connection}"
53
- end
54
- end
@@ -1,50 +0,0 @@
1
- #! /usr/bin/env ruby
2
- #
3
- # metrics-iis-current-connections.rb
4
- #
5
- # DESCRIPTION:
6
- #
7
- # OUTPUT:
8
- # metric data
9
- #
10
- # PLATFORMS:
11
- # Windows
12
- #
13
- # DEPENDENCIES:
14
- # gem: sensu-plugin
15
- #
16
- # USAGE:
17
- #
18
- # NOTES:
19
- # Tested on Windows 2012RC2.
20
- #
21
- # LICENSE:
22
- # Yohei Kawahara <inokara@gmail.com>
23
- # Released under the same terms as Sensu (the MIT license); see LICENSE
24
- # for details.
25
- #
26
-
27
- require 'sensu-plugin/metric/cli'
28
- require 'socket'
29
-
30
- #
31
- # IIS Current Connections Metric
32
- #
33
- class IisCurrentConnectionsMetric < Sensu::Plugin::Metric::CLI::Graphite
34
- option :scheme,
35
- description: 'Metric naming scheme, text to prepend to .$parent.$child',
36
- long: '--scheme SCHEME',
37
- default: "#{Socket.gethostname}.iis_current_connections"
38
-
39
- option :site,
40
- short: '-s sitename',
41
- default: '_Total'
42
-
43
- def run # rubocop:disable all
44
- io = IO.popen("typeperf -sc 1 \"Web Service(#{config[:site]})\\Current\ Connections\"")
45
- current_connection = io.readlines[2].split(',')[1].gsub(/"/, '').to_f
46
-
47
- output [config[:scheme], config[:site]].join('.'), current_connection
48
- ok
49
- end
50
- end
@@ -1,50 +0,0 @@
1
- #! /usr/bin/env ruby
2
- #
3
- # metrics-iis-get-requests.rb
4
- #
5
- # DESCRIPTION:
6
- #
7
- # OUTPUT:
8
- # metric data
9
- #
10
- # PLATFORMS:
11
- # Windows
12
- #
13
- # DEPENDENCIES:
14
- # gem: sensu-plugin
15
- #
16
- # USAGE:
17
- #
18
- # NOTES:
19
- # Tested on Windows 2012RC2.
20
- #
21
- # LICENSE:
22
- # Yohei Kawahara <inokara@gmail.com>
23
- # Released under the same terms as Sensu (the MIT license); see LICENSE
24
- # for details.
25
- #
26
-
27
- require 'sensu-plugin/metric/cli'
28
- require 'socket'
29
-
30
- #
31
- # IIS Get Requests
32
- #
33
- class IisGetRequests < Sensu::Plugin::Metric::CLI::Graphite
34
- option :scheme,
35
- description: 'Metric naming scheme, text to prepend to .$parent.$child',
36
- long: '--scheme SCHEME',
37
- default: "#{Socket.gethostname}.iis_get_requests"
38
-
39
- option :site,
40
- short: '-s sitename',
41
- default: '_Total'
42
-
43
- def run # rubocop:disable all
44
- io = IO.popen("typeperf -sc 1 \"Web Service(#{config[:site]})\\Get\ Requests\/sec\"")
45
- get_requests = io.readlines[2].split(',')[1].gsub(/"/, '').to_f
46
-
47
- output [config[:scheme], config[:site]].join('.'), get_requests
48
- ok
49
- end
50
- end