sensu-plugins-windows 2.2.1 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,109 @@
1
+ #
2
+ # check-processes.ps1
3
+ #
4
+ # DESCRIPTION:
5
+ # This plugin checks that the specified processes are running.
6
+ #
7
+ # It accepts the '-CriticalProcesses' and '-ImportantProcesses' parameters to
8
+ # provide different status level outputs and also checks if the items passed
9
+ # are missing completely. Please see the '-Help' parameter, under the 'Sensu
10
+ # check token substitution' header for more info on some extra parsing
11
+ # features.
12
+ #
13
+ # It is built atop check-multi-template.ps1 as an example, and can be easily
14
+ # adapted to check other things.
15
+ #
16
+ # OUTPUT:
17
+ # Missing example:
18
+ # CheckProcesses CRITICAL:
19
+ # The following processes are not running:
20
+ # - chrome
21
+ #
22
+ # OK example:
23
+ # CheckProcesses OK:
24
+ # All processes are running.
25
+ #
26
+ # WARN example:
27
+ # CheckProcesses WARN:
28
+ # The following processes are not running:
29
+ # - firefox
30
+ #
31
+ # CRITICAL example:
32
+ # CheckProcesses CRITICAL:
33
+ # The following critical processes are not running:
34
+ # - chrome
35
+ # The following critical processes are not running:
36
+ # - firefox
37
+ #
38
+ # PLATFORMS:
39
+ # Windows
40
+ #
41
+ # DEPENDENCIES:
42
+ #
43
+ # USAGE:
44
+ # Please run this check with the '-help' parameter for more info.
45
+ #
46
+ # NOTES:
47
+ #
48
+ # LICENSE:
49
+ # Copyright 2016 James Booth <james@absolutejam.co.uk>
50
+ # Released under the same terms as Sensu (the MIT license); see LICENSE for
51
+ # details.
52
+ #
53
+
54
+
55
+ [CmdletBinding()]
56
+ Param(
57
+ # Processes to check. If any are not running, they will return a
58
+ # CRITICAL (2) status.
59
+ [Parameter(
60
+ Mandatory = $False
61
+ )]
62
+ [string]$CriticalProcesses,
63
+
64
+ # Processes to check. If any are not running, they will return a
65
+ # WARNING (1) status.
66
+ [Parameter(
67
+ Mandatory = $False
68
+ )]
69
+ [string]$ImportantProcesses,
70
+
71
+ # Display help about this check.
72
+ [switch]$Help
73
+ )
74
+
75
+ # Import template
76
+ $here = Split-Path -Parent $MyInvocation.MyCommand.Path
77
+ . "$here\check-multi-template.ps1"
78
+
79
+ # Override check options
80
+ $CheckOptions = @{
81
+ 'CheckName' = 'CheckProcesses'
82
+ 'MessageOK' = 'All processes are up.'
83
+ 'MessageImportant' = 'The following important processes are not running:'
84
+ 'MessageCritical' = 'The following critical processes are not running:'
85
+ 'MessageNoneSpecified' = 'No processes specified.'
86
+ 'Inverse' = $True
87
+ 'MissingState' = 2
88
+
89
+ 'ScriptBlockMatchItems' = {
90
+ Get-Process |
91
+ Select-Object -ExpandProperty ProcessName
92
+ }
93
+
94
+ 'CheckHelp' = @'
95
+ Checks whether any specified processes are not running.
96
+
97
+ Arguments:
98
+ -CriticalProcesses A string of comma-separated processes
99
+ -ImportantProcesses A string of comma-separated processes
100
+ -Help Show help
101
+
102
+ Example usage:
103
+ powershell.exe -file check-processes.ps1 -criticalprocesses "chrome,notepad" -warningprocesses "firefox"
104
+
105
+ '@
106
+ }
107
+
108
+ # Run!
109
+ Invoke-Main -CriticalItems $CriticalProcesses -ImportantItems $ImportantProcesses
@@ -0,0 +1,116 @@
1
+ #
2
+ # check-services.ps1
3
+ #
4
+ # DESCRIPTION:
5
+ # This plugin checks that the specified network adapters are up.
6
+ #
7
+ # It accepts the '-CriticalServices' and '-ImportantServices' parameters to
8
+ # provide different status level outputs and also checks if the items passed
9
+ # are missing completely. Please see the '-Help' parameter, under the 'Sensu
10
+ # check token substitution' header for more info on some extra parsing
11
+ # features.
12
+ #
13
+ # It is built atop check-multi-template.ps1 as an example, and can be easily
14
+ # adapted to check other things.
15
+ #
16
+ # OUTPUT:
17
+ # Missing example:
18
+ # CheckService CRITICAL:
19
+ # The following services are missing:
20
+ # - salt-minion
21
+ #
22
+ # OK example:
23
+ # CheckService OK:
24
+ # All services are running.
25
+ #
26
+ # WARN example:
27
+ # CheckService WARN:
28
+ # The following important services are not running:
29
+ # - salt-minion
30
+ #
31
+ # CRITICAL example:
32
+ # CheckService CRITICAL:
33
+ # The following critical services are not running:
34
+ # - dns
35
+ # The following important services are not running:
36
+ # - salt-minion
37
+ #
38
+ # PLATFORMS:
39
+ # Windows
40
+ #
41
+ # DEPENDENCIES:
42
+ #
43
+ # USAGE:
44
+ # Please run this check with the '-help' parameter for more info.
45
+ #
46
+ # NOTES:
47
+ #
48
+ # LICENSE:
49
+ # Copyright 2016 James Booth <james@absolutejam.co.uk>
50
+ # Released under the same terms as Sensu (the MIT license); see LICENSE for
51
+ # details.
52
+ #
53
+
54
+
55
+ [CmdletBinding()]
56
+ Param(
57
+ # Services to check. If any are not running, they will return a
58
+ # CRITICAL (2) status.
59
+ [Parameter(
60
+ Mandatory = $False
61
+ )]
62
+ [string]$CriticalServices,
63
+
64
+ # Services to check. If any are not running, they will return a
65
+ # WARNING (1) status.
66
+ [Parameter(
67
+ Mandatory = $False
68
+ )]
69
+ [string]$ImportantServices,
70
+
71
+ # Display help about this check.
72
+ [switch]$Help
73
+ )
74
+
75
+ # Import template
76
+ $here = Split-Path -Parent $MyInvocation.MyCommand.Path
77
+ . "$here\check-multi-template.ps1"
78
+
79
+ # Override check options
80
+ $CheckOptions = @{
81
+ 'CheckName' = 'CheckService'
82
+ 'MessageOK' = 'All services are running.'
83
+ 'MessageImportant' = 'The following important services are not running:'
84
+ 'MessageCritical' = 'The following critical services are not running:'
85
+ 'MessageMissing' = 'The following services are missing:'
86
+ 'MessageNoneSpecified' = 'No services specified.'
87
+ 'MissingState' = 2
88
+ 'CheckMissing' = $True
89
+
90
+ 'ScriptBlockBaseItems' = {
91
+ Get-Service |
92
+ Select-Object -ExpandProperty Name
93
+ }
94
+
95
+ 'ScriptBlockMatchItems' = {
96
+ Get-Service |
97
+ Where-Object { $_.Status -ne 'Running' } |
98
+ Select-Object -ExpandProperty Name
99
+ }
100
+
101
+ 'CheckHelp' = @'
102
+ Checks whether any specified services are not running.
103
+
104
+ Arguments:
105
+ -CriticalServices A string of comma-separated services
106
+ -ImportantServices A string of comma-separated services
107
+ -Help Show help
108
+
109
+ Example usage:
110
+ powershell.exe -file check-adapters.ps1 -CriticalServices "CLUSTER NETWORK" -warningadapters"MONITORING NETWORK"
111
+
112
+ '@
113
+ }
114
+
115
+ # Run!
116
+ Invoke-Main -CriticalItems $CriticalServices -ImportantItems $ImportantServices
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsWindows
2
2
  module Version
3
3
  MAJOR = 2
4
- MINOR = 2
5
- PATCH = 1
4
+ MINOR = 3
5
+ PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-windows
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.3.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: 2017-09-25 00:00:00.000000000 Z
11
+ date: 2017-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -183,6 +183,13 @@ files:
183
183
  - bin/metric-windows-processor-queue-length.rb
184
184
  - bin/metric-windows-ram-usage.rb
185
185
  - bin/metric-windows-uptime.rb
186
+ - bin/powershell/check-multi-template/README.md
187
+ - bin/powershell/check-multi-template/check-adapters.ps1
188
+ - bin/powershell/check-multi-template/check-focusedprocess.ps1
189
+ - bin/powershell/check-multi-template/check-iscsi.ps1
190
+ - bin/powershell/check-multi-template/check-multi-template.ps1
191
+ - bin/powershell/check-multi-template/check-processes.ps1
192
+ - bin/powershell/check-multi-template/check-services.ps1
186
193
  - bin/powershell/check-windows-cpu-load.ps1
187
194
  - bin/powershell/check-windows-disk-writeable.ps1
188
195
  - bin/powershell/check-windows-disk.ps1
@@ -229,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
236
  version: '0'
230
237
  requirements: []
231
238
  rubyforge_project:
232
- rubygems_version: 2.6.13
239
+ rubygems_version: 2.7.2
233
240
  signing_key:
234
241
  specification_version: 4
235
242
  summary: Sensu plugins for Windows