sensu-plugins-process-checks 0.0.1.alpha.5 → 0.0.1
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +34 -18
- data/LICENSE +1 -1
- data/README.md +14 -38
- data/bin/check-cmd.rb +1 -1
- data/bin/check-process-restart.rb +1 -1
- data/bin/check-process.rb +3 -3
- data/bin/check-threads-count.rb +1 -1
- data/bin/metrics-process-status.rb +3 -3
- data/bin/metrics-processes-threads-count.rb +1 -1
- data/lib/sensu-plugins-process-checks.rb +10 -3
- data/lib/sensu-plugins-process-checks/version.rb +28 -0
- metadata +24 -26
- metadata.gz.sig +0 -0
- data/bin/check-process.sh +0 -71
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf33137bcabfd69cb77209d563ab95f55e80f704
|
4
|
+
data.tar.gz: 4b0a230001ad71cf9a9621fe4ca070179e84bd25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5b0e9c4099d1251e29af5c7ffe28daa1376be31422c51eb72f8bb8e55cd41acbcca12e6c391e04d1da2777c298f23a3cc05c4c59116334e2b1966f0bb660187
|
7
|
+
data.tar.gz: 84d8b400043b2c1c2163ce7f87ab5c4490d434c2063622cb01ecb33dc3dd146d2dc7d1782a6b588bfa4c697c6e7252ffa446f73304218b42341d91fa4648818b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,31 +1,47 @@
|
|
1
|
-
|
1
|
+
#Change Log
|
2
|
+
This project adheres to [Semantic Versioning](http://semver.org/).
|
2
3
|
|
3
|
-
|
4
|
-
* changed *check-procs* to *check-process* to better reflect its use
|
5
|
-
* basic yard coverage
|
6
|
-
* pinned dependencies
|
7
|
-
* built against 1.9.3, 2.0, 2.1
|
8
|
-
* cryptographically signed
|
4
|
+
This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
|
9
5
|
|
10
|
-
|
6
|
+
## Unreleased][unreleased]
|
11
7
|
|
12
|
-
|
13
|
-
* update LICENSE and gemspec authors
|
14
|
-
* update README
|
15
|
-
* add required Ruby version *>= 1.9.3*
|
16
|
-
* add test/spec_help.rb
|
8
|
+
## 0.0.1 - 2015-05-01
|
17
9
|
|
18
|
-
|
10
|
+
### Added
|
11
|
+
- initial release
|
19
12
|
|
20
|
-
|
21
|
-
|
13
|
+
#### 0.0.1.alpha.6
|
14
|
+
|
15
|
+
* add chef provisioner to Vagrantfile
|
16
|
+
* fix rubocop errors
|
17
|
+
* add metadata to gemspec
|
18
|
+
|
19
|
+
#### 0.0.1.alpha.5
|
20
|
+
|
21
|
+
* add new check for process uptime metrics
|
22
22
|
|
23
23
|
#### 0.0.1.alpha.4
|
24
24
|
|
25
25
|
* convert scrips to sys-proctable gem for platform independence
|
26
26
|
|
27
|
-
#### 0.0.1
|
27
|
+
#### 0.0.1-alpha.3
|
28
28
|
|
29
|
-
* add
|
29
|
+
* add proc-status-metrics
|
30
|
+
* change proc-status-metrics to process-status-metrics
|
31
|
+
|
32
|
+
#### 0.0.1-alpha.2
|
33
|
+
|
34
|
+
* bump Vagrant to Chef 6.6
|
35
|
+
* update LICENSE and gemspec authors
|
36
|
+
* update README
|
37
|
+
* add required Ruby version *>= 1.9.3*
|
38
|
+
* add test/spec_help.rb
|
30
39
|
|
40
|
+
#### 0.1.0-alpha.1
|
31
41
|
|
42
|
+
* baseline release identical to **sensu-community-plugins** repo
|
43
|
+
* changed *check-procs* to *check-process* to better reflect its use
|
44
|
+
* basic yard coverage
|
45
|
+
* pinned dependencies
|
46
|
+
* built against 1.9.3, 2.0, 2.1
|
47
|
+
* cryptographically signed
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
[](https://travis-ci.org/sensu-plugins/sensu-plugins-process-checks)
|
4
|
+
[](http://badge.fury.io/rb/sensu-plugins-process-checks)
|
5
|
+
[](https://codeclimate.com/github/sensu-plugins/sensu-plugins-process-checks)
|
6
|
+
[](https://codeclimate.com/github/sensu-plugins/sensu-plugins-process-checks)
|
7
|
+
[](https://gemnasium.com/sensu-plugins/sensu-plugins-process-checks)
|
8
|
+
[](https://codeship.com/projects/77521)
|
6
9
|
|
7
10
|
## Functionality
|
8
11
|
|
@@ -14,42 +17,15 @@
|
|
14
17
|
* bin/check-cmd.rb
|
15
18
|
* bin/check-process-restart.rb
|
16
19
|
* bin/check-process.rb
|
17
|
-
* bin/check-
|
18
|
-
* bin/metrics-process-status
|
20
|
+
* bin/check-threads-count.rb
|
21
|
+
* bin/metrics-process-status.rb
|
22
|
+
* bin/metrics-processes-threads-count.rb
|
23
|
+
* bin/process-uptime-metrics.sh
|
19
24
|
|
20
25
|
## Usage
|
21
26
|
|
22
|
-
|
23
|
-
|
24
|
-
`gem install sensu-plugins-process-checks`
|
25
|
-
|
26
|
-
#### Bundler
|
27
|
-
|
28
|
-
Add *sensu-plugins-disk-checks* to your Gemfile and run `bundle install` or `bundle update`
|
27
|
+
### Installation
|
29
28
|
|
30
|
-
|
31
|
-
|
32
|
-
Using the Sensu **sensu_gem** LWRP
|
33
|
-
```
|
34
|
-
sensu_gem 'sensu-plugins-process-checks' do
|
35
|
-
options('--prerelease')
|
36
|
-
version '0.0.1.alpha.4'
|
37
|
-
end
|
38
|
-
```
|
39
|
-
|
40
|
-
Using the Chef **gem_package** resource
|
41
|
-
```
|
42
|
-
gem_package 'sensu-plugins-process-checks' do
|
43
|
-
options('--prerelease')
|
44
|
-
version '0.0.1.alpha.4'
|
45
|
-
end
|
46
|
-
```
|
29
|
+
[Installation and Setup](https://github.com/sensu-plugins/documentation/blob/master/user_docs/installation_instructions.md)
|
47
30
|
|
48
31
|
## Notes
|
49
|
-
|
50
|
-
|
51
|
-
[1]:[https://travis-ci.org/sensu-plugins/sensu-plugins-process-checks]
|
52
|
-
[2]:[http://badge.fury.io/rb/sensu-plugins-process-checks]
|
53
|
-
[3]:[https://codeclimate.com/github/sensu-plugins/sensu-plugins-process-checks]
|
54
|
-
[4]:[https://codeclimate.com/github/sensu-plugins/sensu-plugins-process-checks]
|
55
|
-
[5]:[https://gemnasium.com/sensu-plugins/sensu-plugins-process-checks]
|
data/bin/check-cmd.rb
CHANGED
@@ -52,7 +52,7 @@ class CheckCmdStatus < Sensu::Plugin::Check::CLI
|
|
52
52
|
# Acquire the exit code and/or output of a command and alert if it is not
|
53
53
|
# what is expected.
|
54
54
|
#
|
55
|
-
def acquire_cmd_status
|
55
|
+
def acquire_cmd_status # rubocop:disable all
|
56
56
|
stdout = `#{config[:command]}`
|
57
57
|
# #YELLOW
|
58
58
|
unless $CHILD_STATUS.exitstatus.to_s == config[:status] # rubocop:disable UnlessElse
|
@@ -94,7 +94,7 @@ class CheckProcessRestart < Sensu::Plugin::Check::CLI
|
|
94
94
|
|
95
95
|
# Main run method for the check
|
96
96
|
#
|
97
|
-
def run
|
97
|
+
def run # rubocop:disable all
|
98
98
|
unless checkrestart?
|
99
99
|
unknown "Can't seem to find checkrestart. This check only works in a Debian based distribution and you need debian-goodies package installed"
|
100
100
|
end
|
data/bin/check-process.rb
CHANGED
@@ -217,21 +217,21 @@ class CheckProcess < Sensu::Plugin::Check::CLI
|
|
217
217
|
|
218
218
|
# Match to a time
|
219
219
|
#
|
220
|
-
def etime_to_esec(etime)
|
220
|
+
def etime_to_esec(etime) # rubocop:disable all
|
221
221
|
m = /(\d+-)?(\d\d:)?(\d\d):(\d\d)/.match(etime)
|
222
222
|
(m[1] || 0).to_i * 86_400 + (m[2] || 0).to_i * 3600 + (m[3] || 0).to_i * 60 + (m[4] || 0).to_i
|
223
223
|
end
|
224
224
|
|
225
225
|
# Match to a time
|
226
226
|
#
|
227
|
-
def cputime_to_csec(time)
|
227
|
+
def cputime_to_csec(time) # rubocop:disable all
|
228
228
|
m = /(\d+-)?(\d\d:)?(\d\d):(\d\d)/.match(time)
|
229
229
|
(m[1] || 0).to_i * 86_400 + (m[2] || 0).to_i * 3600 + (m[3] || 0).to_i * 60 + (m[4] || 0).to_i
|
230
230
|
end
|
231
231
|
|
232
232
|
# The main function
|
233
233
|
#
|
234
|
-
def run
|
234
|
+
def run # rubocop:disable all
|
235
235
|
procs = acquire_procs
|
236
236
|
|
237
237
|
if config[:file_pid] && (file_pid = read_pid(config[:file_pid]))
|
data/bin/check-threads-count.rb
CHANGED
@@ -100,7 +100,7 @@ class ProcStatus < Sensu::Plugin::Metric::CLI::Graphite
|
|
100
100
|
#
|
101
101
|
# @param pid [String]
|
102
102
|
#
|
103
|
-
def acquire_stats_for_pid(pid)
|
103
|
+
def acquire_stats_for_pid(pid) # rubocop:disable all
|
104
104
|
return nil unless ::File.exist?(::File.join('/proc', pid, 'cmdline'))
|
105
105
|
|
106
106
|
cmdline_raw = `cat /proc/#{pid}/cmdline`
|
@@ -112,7 +112,7 @@ class ProcStatus < Sensu::Plugin::Metric::CLI::Graphite
|
|
112
112
|
out = { "#{cmdline}" => {} }
|
113
113
|
|
114
114
|
metric_names.each do |m|
|
115
|
-
line = proc_status_lines.select { |x| /^#{m}/.match(x) }.first
|
115
|
+
line = proc_status_lines.select { |x| /^#{m}/.match(x) }.first # rubocop:disable all
|
116
116
|
val = line ? line.split("\t")[1].to_i : nil
|
117
117
|
out[cmdline.to_s][m] = val
|
118
118
|
end
|
@@ -121,7 +121,7 @@ class ProcStatus < Sensu::Plugin::Metric::CLI::Graphite
|
|
121
121
|
|
122
122
|
# Main functino
|
123
123
|
#
|
124
|
-
def run
|
124
|
+
def run # rubocop:disable all
|
125
125
|
fail 'You must supply -u USER or -p PROCESSNAME' unless config[:user] || config[:processname]
|
126
126
|
metrics = {}
|
127
127
|
pgrep_output = `#{pgrep_command}`
|
@@ -1,7 +1,14 @@
|
|
1
|
+
require 'sensu-plugins-process-checks/version'
|
2
|
+
|
3
|
+
# Load the defaults
|
4
|
+
|
1
5
|
#
|
2
|
-
#
|
6
|
+
# Default class
|
3
7
|
#
|
4
8
|
module SensuPluginsProcessChecks
|
5
|
-
|
6
|
-
|
9
|
+
class << self
|
10
|
+
end
|
11
|
+
|
12
|
+
class << self
|
13
|
+
end
|
7
14
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
# encoding: utf-8
|
4
|
+
module SensuPluginsProcessChecks
|
5
|
+
# This defines the version of the gem
|
6
|
+
module Version
|
7
|
+
MAJOR = 0
|
8
|
+
MINOR = 0
|
9
|
+
PATCH = 1
|
10
|
+
|
11
|
+
VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
|
12
|
+
|
13
|
+
NAME = 'sensu-plugins-process-checks'
|
14
|
+
BANNER = "#{NAME} v%s"
|
15
|
+
|
16
|
+
module_function
|
17
|
+
|
18
|
+
def version
|
19
|
+
format(BANNER, VER_STRING)
|
20
|
+
end
|
21
|
+
|
22
|
+
def json_version
|
23
|
+
{
|
24
|
+
'version' => VER_STRING
|
25
|
+
}.to_json
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-process-checks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Sensu-Plugins and contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
|
31
31
|
HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2015-
|
33
|
+
date: 2015-05-01 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: english
|
@@ -92,30 +92,30 @@ dependencies:
|
|
92
92
|
name: codeclimate-test-reporter
|
93
93
|
requirement: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- - "
|
95
|
+
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: '0'
|
97
|
+
version: '0.4'
|
98
98
|
type: :development
|
99
99
|
prerelease: false
|
100
100
|
version_requirements: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- - "
|
102
|
+
- - "~>"
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: '0'
|
104
|
+
version: '0.4'
|
105
105
|
- !ruby/object:Gem::Dependency
|
106
106
|
name: rubocop
|
107
107
|
requirement: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
109
|
- - "~>"
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: '0.
|
111
|
+
version: '0.30'
|
112
112
|
type: :development
|
113
113
|
prerelease: false
|
114
114
|
version_requirements: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
116
|
- - "~>"
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version: '0.
|
118
|
+
version: '0.30'
|
119
119
|
- !ruby/object:Gem::Dependency
|
120
120
|
name: rspec
|
121
121
|
requirement: !ruby/object:Gem::Requirement
|
@@ -214,17 +214,9 @@ dependencies:
|
|
214
214
|
- - "~>"
|
215
215
|
- !ruby/object:Gem::Version
|
216
216
|
version: '0.10'
|
217
|
-
description: Sensu
|
217
|
+
description: Sensu plugins for checking running processes
|
218
218
|
email: "<sensu-users@googlegroups.com>"
|
219
|
-
executables:
|
220
|
-
- check-cmd.rb
|
221
|
-
- check-process-restart.rb
|
222
|
-
- check-process.rb
|
223
|
-
- check-process.sh
|
224
|
-
- check-threads-count.rb
|
225
|
-
- metrics-process-status.rb
|
226
|
-
- metrics-processes-threads-count.rb
|
227
|
-
- process-uptime-metrics.sh
|
219
|
+
executables: []
|
228
220
|
extensions: []
|
229
221
|
extra_rdoc_files: []
|
230
222
|
files:
|
@@ -234,17 +226,23 @@ files:
|
|
234
226
|
- bin/check-cmd.rb
|
235
227
|
- bin/check-process-restart.rb
|
236
228
|
- bin/check-process.rb
|
237
|
-
- bin/check-process.sh
|
238
229
|
- bin/check-threads-count.rb
|
239
230
|
- bin/metrics-process-status.rb
|
240
231
|
- bin/metrics-processes-threads-count.rb
|
241
232
|
- bin/process-uptime-metrics.sh
|
242
233
|
- lib/sensu-plugins-process-checks.rb
|
234
|
+
- lib/sensu-plugins-process-checks/version.rb
|
243
235
|
homepage: https://github.com/sensu-plugins/sensu-plugins-process-checks
|
244
236
|
licenses:
|
245
237
|
- MIT
|
246
|
-
metadata:
|
247
|
-
|
238
|
+
metadata:
|
239
|
+
maintainer: "@rmc3"
|
240
|
+
development_status: active
|
241
|
+
production_status: unstable - testing recommended
|
242
|
+
release_draft: 'false'
|
243
|
+
release_prerelease: 'false'
|
244
|
+
post_install_message: You can use the embedded Ruby by setting EMBEDDED_RUBY=true
|
245
|
+
in /etc/default/sensu
|
248
246
|
rdoc_options: []
|
249
247
|
require_paths:
|
250
248
|
- lib
|
@@ -255,13 +253,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
255
253
|
version: 1.9.3
|
256
254
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
257
255
|
requirements:
|
258
|
-
- - "
|
256
|
+
- - ">="
|
259
257
|
- !ruby/object:Gem::Version
|
260
|
-
version:
|
258
|
+
version: '0'
|
261
259
|
requirements: []
|
262
260
|
rubyforge_project:
|
263
|
-
rubygems_version: 2.
|
261
|
+
rubygems_version: 2.4.6
|
264
262
|
signing_key:
|
265
263
|
specification_version: 4
|
266
|
-
summary: Sensu
|
264
|
+
summary: Sensu plugins for checking running processes
|
267
265
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|
data/bin/check-process.sh
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
#
|
3
|
-
# Check process
|
4
|
-
#
|
5
|
-
# ===
|
6
|
-
#
|
7
|
-
# Examples:
|
8
|
-
#
|
9
|
-
# # check by process name
|
10
|
-
# check-process.sh -p nginx
|
11
|
-
#
|
12
|
-
# # check by PID file
|
13
|
-
# check-process.sh -f /var/spool/postfix/pid/master.pid
|
14
|
-
#
|
15
|
-
# Date: 2014-09-12
|
16
|
-
# Author: Jun Ichikawa <jun1ka0@gmail.com>
|
17
|
-
#
|
18
|
-
# Released under the same terms as Sensu (the MIT license); see LICENSE
|
19
|
-
# for details.
|
20
|
-
|
21
|
-
# get arguments
|
22
|
-
while getopts 'p:f:h' OPT; do
|
23
|
-
case $OPT in
|
24
|
-
p) PROCESS=$OPTARG;;
|
25
|
-
f) PID_FILE=$OPTARG;;
|
26
|
-
h) hlp="yes";;
|
27
|
-
*) unknown="yes";;
|
28
|
-
esac
|
29
|
-
done
|
30
|
-
|
31
|
-
# usage
|
32
|
-
HELP="
|
33
|
-
usage: $0 [ -p value -f value -h ]
|
34
|
-
|
35
|
-
-p --> process name
|
36
|
-
-f --> file path to pid file
|
37
|
-
-h --> print this help screen
|
38
|
-
"
|
39
|
-
|
40
|
-
if [ "$hlp" = "yes" ]; then
|
41
|
-
echo "$HELP"
|
42
|
-
exit 0
|
43
|
-
fi
|
44
|
-
|
45
|
-
if [ ${PROCESS} ]; then
|
46
|
-
scriptname=`basename $0`
|
47
|
-
ret=`ps aux | grep "${PROCESS}" | grep -v grep | grep -v $scriptname`
|
48
|
-
if [ ! "${ret}" ]; then
|
49
|
-
echo "CRITICAL - process ${PROCESS} does not exist"
|
50
|
-
exit 2
|
51
|
-
fi
|
52
|
-
echo "PROCESS OK - ${PROCESS}"
|
53
|
-
exit 0
|
54
|
-
fi
|
55
|
-
|
56
|
-
if [ ${PID_FILE} ]; then
|
57
|
-
if [ ! -e ${PID_FILE} ]; then
|
58
|
-
echo "CRITICAL - PID file ${PID_FILE} does not exist"
|
59
|
-
exit 2
|
60
|
-
fi
|
61
|
-
pid=`cat ${PID_FILE} | tr -d ' '`
|
62
|
-
if [ ! -f /proc/${pid}/status ]; then
|
63
|
-
echo "CRITICAL - status of ${PID_FILE} not found"
|
64
|
-
exit 2
|
65
|
-
fi
|
66
|
-
echo "PROCESS OK - ${PID_FILE}"
|
67
|
-
exit 0
|
68
|
-
fi
|
69
|
-
|
70
|
-
echo "$HELP"
|
71
|
-
exit 2
|