sensu-plugins-java 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/CHANGELOG.md +5 -1
- data/bin/check-java-heap-pcnt.sh +10 -5
- data/bin/metrics-jstat.py +43 -1
- data/lib/sensu-plugins-java/version.rb +1 -1
- metadata +27 -27
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NTFjNGI4MjNmNGYzOTIzNWFhYTg3NTNlNmE2OTNkZDY1M2E0MTRjOA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 67ebd54061f265732e24b02bcc4a07893ebe0897
|
4
|
+
data.tar.gz: cfb12fb13e140d225aa0c70a88f0a4712e04315d
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MDEzZTZkN2NkNTExZjQyNzEzN2NkZDM3MTkyZjZmYmMwZjE3NDRkMDc3NjZh
|
11
|
-
MzI0MDM3NWMwZjI2MmNmZjM1M2NmZmZlMmYzYjFkMGE4YTg5OGI=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
OWE4ZTQ2ZDgyNTQ2MDg2ZGUzZTdiODg3NDM3MGJhMTU3MGMxNTgyOTBmMDBm
|
14
|
-
MmUyMmY4ODRhMGRmYTliNjUzNDc4MDMyZjliODFjM2JiNjk0OGE0NDI3Nzky
|
15
|
-
MjZiOGExNmI0NGMwMmYxYjQ4YWU4MTViZWE0YmEwNzUyNWI3N2Q=
|
6
|
+
metadata.gz: fa6a77231c5a163b1eca5fec1281881ee95645bd96de298870f2af155c2a6abf6427508cc9e71f705d381a9d58d07dba30a745639a04cb53ee87335a97e1d05b
|
7
|
+
data.tar.gz: 08278681637d5a3fd280ad88a887a85def2809e43b1a0b1180df73e9d5fa0db444f34a03a977afaef9b5e2038e0493da95cc348343c56a76120bf0008b8e5a0e
|
data/CHANGELOG.md
CHANGED
@@ -3,7 +3,11 @@ 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
|
+
## [0.0.5] - 2016-11-02
|
7
|
+
### Changed
|
8
|
+
- metrics-jstat.py: support added for py2.6 (RHEL/CentOS 6.x)
|
9
|
+
- check-java-heap-pcnt.sh: add -j option to specify location of java binaries
|
10
|
+
- check-java-heap-pcnt.sh: add -o option to allow specifying command line arguments to jps
|
7
11
|
|
8
12
|
## [0.0.4] - 2016-04-26
|
9
13
|
### Changed
|
data/bin/check-java-heap-pcnt.sh
CHANGED
@@ -12,11 +12,13 @@
|
|
12
12
|
# Also make sure the user "sensu" can sudo without password
|
13
13
|
|
14
14
|
# #RED
|
15
|
-
while getopts 'w:c:n:hp' OPT; do
|
15
|
+
while getopts 'w:c:n:o:j:hp' OPT; do
|
16
16
|
case $OPT in
|
17
17
|
w) WARN=$OPTARG;;
|
18
18
|
c) CRIT=$OPTARG;;
|
19
19
|
n) NAME=$OPTARG;;
|
20
|
+
o) OPTIONS=$OPTARG;;
|
21
|
+
j) JAVA_BIN=$OPTARG;;
|
20
22
|
h) hlp="yes";;
|
21
23
|
p) perform="yes";;
|
22
24
|
*) unknown="yes";;
|
@@ -25,11 +27,13 @@ done
|
|
25
27
|
|
26
28
|
# usage
|
27
29
|
HELP="
|
28
|
-
usage: $0 [ -n value -w value -c value -p -h ]
|
30
|
+
usage: $0 [ -n value -w value -c value -o value -p -h ]
|
29
31
|
|
30
32
|
-n --> Name of JVM process < value
|
31
33
|
-w --> Warning Percentage < value
|
32
34
|
-c --> Critical Percentage < value
|
35
|
+
-o --> options to pass to jps
|
36
|
+
-j --> path to java bin dir (include trailing /)
|
33
37
|
-p --> print out performance data
|
34
38
|
-h --> print this help screen
|
35
39
|
"
|
@@ -42,16 +46,17 @@ fi
|
|
42
46
|
WARN=${WARN:=0}
|
43
47
|
CRIT=${CRIT:=0}
|
44
48
|
NAME=${NAME:=0}
|
49
|
+
JAVA_BIN=${JAVA_BIN:=""}
|
45
50
|
|
46
51
|
#Get PID of JVM.
|
47
52
|
#At this point grep for the name of the java process running your jvm.
|
48
|
-
PID=$(sudo jps | grep $NAME | awk '{ print $1}')
|
53
|
+
PID=$(sudo ${JAVA_BIN}jps $OPTIONS | grep $NAME | awk '{ print $1}')
|
49
54
|
|
50
55
|
#Get heap capacity of JVM
|
51
|
-
TotalHeap=$(sudo jstat -gccapacity $PID | tail -n 1 | awk '{ print ($4 + $5 + $6 + $10) / 1024 }')
|
56
|
+
TotalHeap=$(sudo ${JAVA_BIN}jstat -gccapacity $PID | tail -n 1 | awk '{ print ($4 + $5 + $6 + $10) / 1024 }')
|
52
57
|
|
53
58
|
#Determine amount of used heap JVM is using
|
54
|
-
UsedHeap=$(sudo jstat -gc $PID | tail -n 1 | awk '{ print ($3 + $4 + $6 + $8 + $10) / 1024 }')
|
59
|
+
UsedHeap=$(sudo ${JAVA_BIN}jstat -gc $PID | tail -n 1 | awk '{ print ($3 + $4 + $6 + $8 + $10) / 1024 }')
|
55
60
|
|
56
61
|
#Get heap usage percentage
|
57
62
|
HeapPer=$(echo "scale=3; $UsedHeap / $TotalHeap * 100" | bc -l| cut -d "." -f1)
|
data/bin/metrics-jstat.py
CHANGED
@@ -35,10 +35,52 @@
|
|
35
35
|
import logging
|
36
36
|
import logging.handlers
|
37
37
|
import optparse
|
38
|
-
from subprocess import check_output
|
39
38
|
import sys
|
40
39
|
import time
|
41
40
|
|
41
|
+
"""
|
42
|
+
Python 2.6 support for check_output:
|
43
|
+
http://stackoverflow.com/questions/4814970/subprocess-check-output-doesnt-seem-to-exist-python-2-6-5
|
44
|
+
"""
|
45
|
+
try:
|
46
|
+
from subprocess import STDOUT, check_output, CalledProcessError
|
47
|
+
except ImportError: # pragma: no cover
|
48
|
+
# python 2.6 doesn't include check_output
|
49
|
+
# monkey patch it in!
|
50
|
+
import subprocess
|
51
|
+
STDOUT = subprocess.STDOUT
|
52
|
+
|
53
|
+
def check_output(*popenargs, **kwargs):
|
54
|
+
if 'stdout' in kwargs: # pragma: no cover
|
55
|
+
raise ValueError('stdout argument not allowed, '
|
56
|
+
'it will be overridden.')
|
57
|
+
process = subprocess.Popen(stdout=subprocess.PIPE,
|
58
|
+
*popenargs, **kwargs)
|
59
|
+
output, _ = process.communicate()
|
60
|
+
retcode = process.poll()
|
61
|
+
if retcode:
|
62
|
+
cmd = kwargs.get("args")
|
63
|
+
if cmd is None:
|
64
|
+
cmd = popenargs[0]
|
65
|
+
raise subprocess.CalledProcessError(retcode, cmd,
|
66
|
+
output=output)
|
67
|
+
return output
|
68
|
+
subprocess.check_output = check_output
|
69
|
+
|
70
|
+
# overwrite CalledProcessError due to `output`
|
71
|
+
# keyword not being available (in 2.6)
|
72
|
+
class CalledProcessError(Exception):
|
73
|
+
|
74
|
+
def __init__(self, returncode, cmd, output=None):
|
75
|
+
self.returncode = returncode
|
76
|
+
self.cmd = cmd
|
77
|
+
self.output = output
|
78
|
+
|
79
|
+
def __str__(self):
|
80
|
+
return "Command '%s' returned non-zero exit status %d" % (
|
81
|
+
self.cmd, self.returncode)
|
82
|
+
subprocess.CalledProcessError = CalledProcessError
|
83
|
+
|
42
84
|
class JstatMetricsToGraphiteFormat(object):
|
43
85
|
'''Prints jstat metrics to stdout in graphite format
|
44
86
|
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-java
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
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:
|
11
|
+
date: 2017-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -42,130 +42,130 @@ dependencies:
|
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.7'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.7'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: codeclimate-test-reporter
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0.4'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.4'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: github-markup
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '1.3'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pry
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0.10'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0.10'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ~>
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '10.5'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - ~>
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '10.5'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: redcarpet
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - ~>
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '3.2'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - ~>
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '3.2'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rubocop
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - ~>
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: 0.40.0
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - ~>
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: 0.40.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rspec
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - ~>
|
143
|
+
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '3.4'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - ~>
|
150
|
+
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '3.4'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: yard
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- - ~>
|
157
|
+
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0.8'
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- - ~>
|
164
|
+
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0.8'
|
167
167
|
description: Sensu plugins for Java
|
168
|
-
email: <sensu-users@googlegroups.com>
|
168
|
+
email: "<sensu-users@googlegroups.com>"
|
169
169
|
executables:
|
170
170
|
- check-java-heap-pcnt.rb
|
171
171
|
- check-java-permgen.rb
|
@@ -203,12 +203,12 @@ require_paths:
|
|
203
203
|
- lib
|
204
204
|
required_ruby_version: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
|
-
- -
|
206
|
+
- - ">="
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: 1.9.3
|
209
209
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
210
210
|
requirements:
|
211
|
-
- -
|
211
|
+
- - ">="
|
212
212
|
- !ruby/object:Gem::Version
|
213
213
|
version: '0'
|
214
214
|
requirements: []
|