sensu-plugins-process-checks 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -8
- data/bin/metrics-processes-threads-count.rb +45 -1
- data/lib/sensu-plugins-process-checks/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4c1e16b051ae71d9479b95387e22c504ab7a7f0
|
4
|
+
data.tar.gz: 43d7d36c527666e51220a43a05c26793ea420397
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d4cca0b109f96d84089aa5855841a9bc50e8214949c883092850c16d43ada5af4912ec5da7f7cac1915ee81fe2c9e34e46e9731f0b379d5f61c6836ed621829
|
7
|
+
data.tar.gz: 512a08cd43764730059955e144f7dd3772ae9944b517a7bc5ac969ad5b07be2d6b7a8e136a73ff8693436b6e442638a34a17c758209cff2c1dd62be80164b791
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,23 @@
|
|
1
|
-
#Change Log
|
1
|
+
# Change Log
|
2
2
|
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
|
+
|
6
7
|
## [Unreleased]
|
8
|
+
|
9
|
+
## [2.4.0] - 2017-07-18
|
10
|
+
### Added
|
11
|
+
- ruby 2.4 testing (@majormoses)
|
12
|
+
- metric-processes-threads-count.rb: count processes by status (for Linux machines only) (@alcasim)
|
13
|
+
|
14
|
+
### Changed
|
15
|
+
- PR template fixes (@majormoses)
|
16
|
+
|
17
|
+
### Fixed
|
18
|
+
- misc changelog fixup (@majormoses)
|
19
|
+
- fixed `rake check_binstubs` by requiging `English`
|
20
|
+
|
7
21
|
## [2.3.0] - 2017-05-29
|
8
22
|
### Changed
|
9
23
|
- metrics-per-process.py: Use memory_info() in psutil versions greater than 4.0.0, as memory_info_ex() was deprecated.
|
@@ -40,6 +54,9 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
40
54
|
- Updated Rubocop to 0.40, applied auto-correct
|
41
55
|
- Remove Ruby 1.9.3 support; add Ruby 2.3.0 support to test matrix
|
42
56
|
|
57
|
+
## [0.1.0] - 2015-08-11
|
58
|
+
### Added
|
59
|
+
- Add metrics-per-process.py plugin (require python psutil module)
|
43
60
|
|
44
61
|
## [0.0.6] - 2015-08-24
|
45
62
|
### Fixed
|
@@ -52,15 +69,11 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
52
69
|
### Changed
|
53
70
|
- rename process-uptime metrics.sh -> metrics-process-uptime.sh
|
54
71
|
|
55
|
-
## [0.1.0] - 2015-08-11
|
56
|
-
### Added
|
57
|
-
- Add metrics-per-process.py plugin (require python psutil module)
|
58
|
-
|
59
72
|
## [0.0.4] - 2015-07-14
|
60
73
|
### Changed
|
61
74
|
- updated sensu-plugin gem to 1.2.0
|
62
75
|
|
63
|
-
## [0.0.3] -
|
76
|
+
## [0.0.3] - 2015-07-13
|
64
77
|
### Fixed
|
65
78
|
- issue #9: variable type conversion to_i in check-process-restart
|
66
79
|
|
@@ -77,7 +90,7 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
77
90
|
### Changed
|
78
91
|
- removed cruft from /lib
|
79
92
|
|
80
|
-
## 0.0.1 -
|
93
|
+
## [0.0.1] - 2015-05-01
|
81
94
|
### Added
|
82
95
|
- initial stable release
|
83
96
|
|
@@ -126,7 +139,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
126
139
|
- built against 1.9.3, 2.0, 2.1
|
127
140
|
- cryptographically signed
|
128
141
|
|
129
|
-
[
|
142
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-process-checks/compare/2.3.0...HEAD
|
143
|
+
[2.4.0]: https://github.com/sensu-plugins/sensu-plugins-process-checks/compare/2.3.0...
|
130
144
|
[2.3.0]: https://github.com/sensu-plugins/sensu-plugins-process-checks/compare/2.2.0...2.3.0
|
131
145
|
[2.2.0]: https://github.com/sensu-plugins/sensu-plugins-process-checks/compare/2.1.0...2.2.0
|
132
146
|
[2.1.0]: https://github.com/sensu-plugins/sensu-plugins-process-checks/compare/2.0.0...2.1.0
|
@@ -137,3 +151,4 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
137
151
|
[0.0.4]: https://github.com/sensu-plugins/sensu-plugins-process-checks/compare/0.0.3...0.0.4
|
138
152
|
[0.0.3]: https://github.com/sensu-plugins/sensu-plugins-process-checks/compare/0.0.2...0.0.3
|
139
153
|
[0.0.2]: https://github.com/sensu-plugins/sensu-plugins-process-checks/compare/0.0.1...0.0.2
|
154
|
+
[0.0.1]: https://github.com/sensu-plugins/sensu-plugins-process-checks/compare/4fd88a85f31d52c0f7145807365c911ea7f935c1...0.0.1
|
@@ -51,6 +51,13 @@ class ProcessesThreadsCount < Sensu::Plugin::Metric::CLI::Graphite
|
|
51
51
|
boolean: true,
|
52
52
|
default: false
|
53
53
|
|
54
|
+
option :statuses,
|
55
|
+
description: 'If specified, count each process number by status in addition to processes. Note: Requires sys-proctables > 0.9.5',
|
56
|
+
short: '-S',
|
57
|
+
long: '--statuses',
|
58
|
+
boolean: true,
|
59
|
+
default: false
|
60
|
+
|
54
61
|
PROCTABLE_MSG = 'sys-proctable version newer than 0.9.5 is required for counting threads with -t or --threads'.freeze
|
55
62
|
|
56
63
|
# Exit with an unknown if sys-proctable is not high enough to support counting threads.
|
@@ -86,9 +93,26 @@ class ProcessesThreadsCount < Sensu::Plugin::Metric::CLI::Graphite
|
|
86
93
|
end
|
87
94
|
end
|
88
95
|
|
96
|
+
# Takes a process struct from Sys::ProcTable.ps() as an argument
|
97
|
+
# Initialises a list of different Linux process statuses
|
98
|
+
# Tries to use the Linux proccess status :state field, returns the initializedl list if it fails
|
99
|
+
# Counts the processes by status and returns the hash
|
100
|
+
def count_processes_by_status(ps_table)
|
101
|
+
list_proc = {}
|
102
|
+
%w(S R D T t X Z).each do |v|
|
103
|
+
list_proc[v] = 0
|
104
|
+
end
|
105
|
+
if ps_table.first.respond_to?(:state)
|
106
|
+
ps_table.each do |pr|
|
107
|
+
list_proc[pr[:state]] += 1
|
108
|
+
end
|
109
|
+
end
|
110
|
+
list_proc
|
111
|
+
end
|
112
|
+
|
89
113
|
# Main function
|
90
114
|
def run
|
91
|
-
if config[:threads]
|
115
|
+
if config[:threads] || config[:statuses]
|
92
116
|
unknown PROCTABLE_MSG unless check_proctable_version
|
93
117
|
end
|
94
118
|
ps_table = Sys::ProcTable.ps
|
@@ -100,6 +124,26 @@ class ProcessesThreadsCount < Sensu::Plugin::Metric::CLI::Graphite
|
|
100
124
|
if config[:threads]
|
101
125
|
output "#{[config[:scheme], 'thread_count'].join('.')} #{threads} #{timestamp}"
|
102
126
|
end
|
127
|
+
if config[:statuses]
|
128
|
+
count_processes_by_status(ps_table).each do |type, proc_count|
|
129
|
+
case type
|
130
|
+
when 'S'
|
131
|
+
output "#{[config[:scheme], 'sleeping'].join('.')} #{proc_count} #{timestamp}"
|
132
|
+
when 'R'
|
133
|
+
output "#{[config[:scheme], 'running'].join('.')} #{proc_count} #{timestamp}"
|
134
|
+
when 'D'
|
135
|
+
output "#{[config[:scheme], 'ininterruptible_sleep'].join('.')} #{proc_count} #{timestamp}"
|
136
|
+
when 'T'
|
137
|
+
output "#{[config[:scheme], 'stopped'].join('.')} #{proc_count} #{timestamp}"
|
138
|
+
when 't'
|
139
|
+
output "#{[config[:scheme], 'stopped_by_debugger'].join('.')} #{proc_count} #{timestamp}"
|
140
|
+
when 'X'
|
141
|
+
output "#{[config[:scheme], 'dead'].join('.')} #{proc_count} #{timestamp}"
|
142
|
+
when 'Z'
|
143
|
+
output "#{[config[:scheme], 'zombie'].join('.')} #{proc_count} #{timestamp}"
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
103
147
|
ok
|
104
148
|
end
|
105
149
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-process-checks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.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-
|
11
|
+
date: 2017-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: english
|