sensu-plugins-java 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5f23b291403560a94ed4a4336b8a3ea11ff655c5
4
+ data.tar.gz: f74509f5e9cb66a376ebf01496bc636225f90199
5
+ SHA512:
6
+ metadata.gz: e3cf4d6603a22da3f2ab80fb0b49e3e39728ade3f6e8eadf9773bc1b71ba928fed73f20b52f574e3cc951b6f5b61826099aa71652c53872017cf18f2bf88a627
7
+ data.tar.gz: 159bc6d2ac7bdef4bd3c3b7ca1ba9f0e9803eb53277919b7855dbc20f13cc55ef88cd57c1c4d5dcaca75bbc7a3babb205c23ee3ab51070d1808220330cd7b1c4
Binary file
@@ -0,0 +1,2 @@
1
+ 9���c����0�8�i�^,{�o�ȗ �hE1���կc�Yyq-������L��R����0� ح�����E�"`��a�<���=��[���'��w�U4 ��Α��Xω�0<\���pU�ܕ'��Px�Ck���*
2
+ �HaC�{�W�k�ýS-�@U���!��G�N2p��� �������K@L�>�n�@D(�3�=%��B��d���z*���V�(֨��b� ��ulC���a�:>�br͟
@@ -0,0 +1,11 @@
1
+ #Change Log
2
+ This project adheres to [Semantic Versioning](http://semver.org/).
3
+
4
+ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
+
6
+ ## Unreleased][unreleased
7
+
8
+ ## 0.0.1 - 2015-05-29
9
+
10
+ ### Added
11
+ - initial release
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Sensu-Plugins
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,24 @@
1
+ ## Sensu-Plugins-java
2
+
3
+ [![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-java.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-java)
4
+ [![Gem Version](https://badge.fury.io/rb/sensu-plugins-java.svg)](http://badge.fury.io/rb/sensu-plugins-java)
5
+ [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-java/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-java)
6
+ [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-java/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-java)
7
+ [![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-java.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-java)
8
+ [![Codeship Status for sensu-plugins/sensu-plugins-java](https://codeship.com/projects/3cea95c0-e897-0132-5df3-62885e5c211b/status?branch=master)](https://codeship.com/projects/82838)
9
+
10
+ ## Functionality
11
+
12
+ ## Files
13
+ * bin/check-java-permgen.rb
14
+ * bin/java-heap-pcnt.sh
15
+ * bin/metrics-java-heap-graphite.sh
16
+ * bin/metrics-jstat.py
17
+
18
+ ## Usage
19
+
20
+ ## Installation
21
+
22
+ [Installation and Setup](https://github.com/sensu-plugins/documentation/blob/master/user_docs/installation_instructions.md)
23
+
24
+ ## Notes
@@ -0,0 +1,77 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # java-permgen
4
+ #
5
+ # DESCRIPTION:
6
+ # Java PermGen Check
7
+ #
8
+ # OUTPUT:
9
+ # plain text
10
+ #
11
+ # PLATFORMS:
12
+ # Linux
13
+ #
14
+ # DEPENDENCIES:
15
+ # gem: sensu-plugin
16
+ #
17
+ # USAGE:
18
+ # #YELLOW
19
+ #
20
+ # NOTES:
21
+ #
22
+ # LICENSE:
23
+ # Copyright 2011 Sonian, Inc <chefs@sonian.net>
24
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
25
+ # for details.
26
+ #
27
+
28
+ require 'sensu-plugin/check/cli'
29
+ require 'English'
30
+
31
+ #
32
+ # Check Java
33
+ #
34
+ class CheckJavaPermGen < Sensu::Plugin::Check::CLI
35
+ check_name 'Java PermGen'
36
+
37
+ option :warn, short: '-w WARNLEVEL', default: '85'
38
+ option :crit, short: '-c CRITLEVEL', default: '95'
39
+
40
+ def run
41
+ warn_procs = []
42
+ crit_procs = []
43
+ java_pids = []
44
+
45
+ IO.popen('jps -q') do |cmd|
46
+ java_pids = cmd.read.split
47
+ end
48
+
49
+ java_pids.each do |java_proc|
50
+ pgcmx = nil
51
+ pu = nil
52
+ IO.popen("jstat -gcpermcapacity #{java_proc} 1 1 2>&1") do |cmd|
53
+ pgcmx = cmd.read.split[9]
54
+ end
55
+ exit_code = $CHILD_STATUS.exitstatus
56
+ next if exit_code != 0
57
+
58
+ IO.popen("jstat -gcold #{java_proc} 1 1 2>&1") do |cmd|
59
+ pu = cmd.read.split[9]
60
+ end
61
+ exit_code = $CHILD_STATUS.exitstatus
62
+ next if exit_code != 0
63
+
64
+ proc_permgen = (pu.to_f / pgcmx.to_f) * 100
65
+ warn_procs << java_proc if proc_permgen > config[:warn].to_f
66
+ crit_procs << java_proc if proc_permgen > config[:crit].to_f
67
+ end
68
+
69
+ if !crit_procs.empty?
70
+ critical "Java processes Over PermGen CRIT threshold of #{config[:crit]}%: #{crit_procs.join(', ')}"
71
+ elsif !warn_procs.empty?
72
+ warning "Java processes Over PermGen WARN threshold of #{config[:warn]}%: #{warn_procs.join(', ')}"
73
+ else
74
+ ok 'No Java processes over PermGen thresholds'
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Evaluate percentage of heap usage on specfic Tomcat backed JVM from Linux based systems based on percentage
4
+ # This was forked from Sensu Community Plugins
5
+
6
+ # Date: 2013-9-30
7
+ # Modified: Mario Harvey - badmadrad.com
8
+
9
+ # You must have openjdk-7-jdk and openjdk-7-jre packages installed
10
+ # http://openjdk.java.net/install/
11
+
12
+ # Also make sure the user "sensu" can sudo without password
13
+
14
+ # #RED
15
+ while getopts 'w:c:n:hp' OPT; do
16
+ case $OPT in
17
+ w) WARN=$OPTARG;;
18
+ c) CRIT=$OPTARG;;
19
+ n) NAME=$OPTARG;;
20
+ h) hlp="yes";;
21
+ p) perform="yes";;
22
+ *) unknown="yes";;
23
+ esac
24
+ done
25
+
26
+ # usage
27
+ HELP="
28
+ usage: $0 [ -n value -w value -c value -p -h ]
29
+
30
+ -n --> Name of JVM process < value
31
+ -w --> Warning Percentage < value
32
+ -c --> Critical Percentage < value
33
+ -p --> print out performance data
34
+ -h --> print this help screen
35
+ "
36
+
37
+ if [ "$hlp" = "yes" ]; then
38
+ echo "$HELP"
39
+ exit 0
40
+ fi
41
+
42
+ WARN=${WARN:=0}
43
+ CRIT=${CRIT:=0}
44
+ NAME=${NAME:=0}
45
+
46
+ #Get PID of JVM.
47
+ #At this point grep for the name of the java process running your jvm.
48
+ PID=$(sudo jps | grep $NAME | awk '{ print $1}')
49
+
50
+ #Get heap capacity of JVM
51
+ TotalHeap=$(sudo jstat -gccapacity $PID | tail -n 1 | awk '{ print ($4 + $5 + $6 + $10) / 1024 }')
52
+
53
+ #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 }')
55
+
56
+ #Get heap usage percentage
57
+ HeapPer=$(echo "scale=3; $UsedHeap / $TotalHeap * 100" | bc -l| cut -d "." -f1)
58
+
59
+
60
+ if [ "$HeapPer" = "" ]; then
61
+ echo "MEM UNKNOWN -"
62
+ exit 3
63
+ fi
64
+
65
+ if [ "$perform" = "yes" ]; then
66
+ output="jvm heap usage: $HeapPer% | heap usage="$HeapPer"%;$WARN;$CRIT;0"
67
+ else
68
+ output="jvm heap usage: $HeapPer% | $UsedHeap MB out of $TotalHeap MB"
69
+ fi
70
+
71
+ if (( $HeapPer >= $CRIT )); then
72
+ echo "MEM CRITICAL - $output"
73
+ exit 2
74
+ elif (( $HeapPer >= $WARN )); then
75
+ echo "MEM WARNING - $output"
76
+ exit 1
77
+ else
78
+ echo "MEM OK - $output"
79
+ exit 0
80
+ fi
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Collect metrics on your JVM and allow you to trace usage in graphite
4
+
5
+ # Modified: Mario Harvey - badmadrad.com
6
+
7
+ # You must have openjdk-7-jdk and openjdk-7-jre packages installed
8
+ # http://openjdk.java.net/install/
9
+
10
+ # Also make sure the user "sensu" can sudo without password
11
+
12
+ # #RED
13
+ while getopts 's:n:h' OPT; do
14
+ case $OPT in
15
+ s) SCHEME=$OPTARG;;
16
+ n) NAME=$OPTARG;;
17
+ h) hlp="yes";;
18
+ esac
19
+ done
20
+ #usage
21
+ HELP="
22
+ usage $0 [ -n value -s value -h ]
23
+ -n --> NAME or name of jvm process < value
24
+ -s --> SCHEME or server name ex. :::name::: < value
25
+ -h --> print this help screen
26
+ "
27
+ if [ "$hlp" = "yes" ]; then
28
+ echo "$HELP"
29
+ exit 0
30
+ fi
31
+
32
+ SCHEME=${SCHEME:=0}
33
+ NAME=${NAME:=0}
34
+
35
+ #Get PID of JVM.
36
+ #At this point grep for the name of the java process running your jvm.
37
+ PID=$(sudo jps | grep $NAME | awk '{ print $1}')
38
+
39
+ #Get heap capacity of JVM
40
+ TotalHeap=$(sudo jstat -gccapacity $PID | tail -n 1 | awk '{ print ($4 + $5 + $6 + $10) / 1024 }')
41
+
42
+ #Determine amount of used heap JVM is using
43
+ UsedHeap=$(sudo jstat -gc $PID | tail -n 1 | awk '{ print ($3 + $4 + $6 + $8 + $10) / 1024 }')
44
+
45
+ #Determine Old Space Utilization
46
+ OldGen=$(sudo jstat -gc $PID | tail -n 1 | awk '{ print ($8) / 1024 }')
47
+
48
+ #Determine Permanent Space Utilization
49
+ PermGen=$(sudo jstat -gc $PID | tail -n 1 | awk '{ print ($10) / 1024 }')
50
+
51
+ #Determine Eden Space Utilization
52
+ ParEden=$(sudo jstat -gc $PID | tail -n 1 | awk '{ print ($6) / 1024 }')
53
+
54
+ #Determine Survivor Space utilization
55
+ ParSurv=$(sudo jstat -gc $PID | tail -n 1 | awk '{ print ($3 + $4) / 1024 }')
56
+
57
+ echo "JVMs.$SCHEME.Committed_Heap $TotalHeap `date '+%s'`"
58
+ echo "JVMs.$SCHEME.Used_Heap $UsedHeap `date '+%s'`"
59
+ echo "JVMs.$SCHEME.Eden_Util $ParEden `date '+%s'`"
60
+ echo "JVMs.$SCHEME.Survivor_Util $ParSurv `date '+%s'`"
61
+ echo "JVMs.$SCHEME.Old_Util $OldGen `date '+%s'`"
62
+ echo "JVMs.$SCHEME.Perm_Util $PermGen `date '+%s'`"
@@ -0,0 +1,271 @@
1
+ #!/usr/bin/python -tt
2
+ #
3
+ # DESCRIPTION:
4
+ # Collect everything that can be collected out of jstat (shells out 5 times)
5
+ # and spits to STDOUT in a graphite ready format, thus meant to be used with a
6
+ # graphite metric tcp handler.
7
+ # Since it shells out to jps(1) you will need the user running the sensu client
8
+ # executing this script to be able to run jps as the same user running the JVM
9
+ # you are trying to get stats from.
10
+ # In addition it will also need to be able to run jstat(2) against the JVM
11
+ # This can be all achieved by allowing the script to be ran as the same user
12
+ # running the JVM, for instance by prepending "sudo -u <jvm_process_owner>"
13
+ # in the command check definition (with the proper sudoers config to allow this
14
+ # with no password being asked)
15
+ #
16
+ # The graphite node is composed of an optional root node (defaults to 'metrics')
17
+ # the specified FQDN "reversed" ('foo.bar.com' becomes 'com.bar.foo') and an
18
+ # optional scheme (defaults to 'jstat')
19
+ #
20
+ # (1) http://docs.oracle.com/javase/7/docs/technotes/tools/share/jps.html
21
+ # (2) http://docs.oracle.com/javase/7/docs/technotes/tools/share/jstat.html
22
+ #
23
+ # OUTPUT:
24
+ # Graphite plain-text format (name value timestamp\n)
25
+ #
26
+ # DEPENDENCIES:
27
+ # Python 2.7 (untested on python 3 but should work fine)
28
+ # Java 6 (untested on Java 7 but should work fine)
29
+ #
30
+ #
31
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
32
+ # for details.
33
+
34
+ # #RED
35
+ import logging
36
+ import logging.handlers
37
+ import optparse
38
+ from subprocess import check_output
39
+ import sys
40
+ import time
41
+
42
+ class JstatMetricsToGraphiteFormat(object):
43
+ '''Prints jstat metrics to stdout in graphite format
44
+
45
+ Shells out to run jstat using the JVM id found via jps (also shelled out) and
46
+ passed argument to print to STDOUT (for use with sensu) the metrics value.
47
+ Jstat column titles are replaced with more explanatory names. Requires to be
48
+ ran as a user that can get the JVM id via jps and run jstat on that JVM'''
49
+
50
+ def main(self):
51
+ # Setting up logging to syslog
52
+ try:
53
+ logger = logging.getLogger(__name__)
54
+ logger.setLevel(logging.DEBUG)
55
+
56
+ formatter = logging.Formatter("%(pathname)s: %(message)s")
57
+
58
+ handler = logging.handlers.SysLogHandler(address = '/dev/log')
59
+ handler.setFormatter(formatter)
60
+ logger.addHandler(handler)
61
+ except Exception:
62
+ # booting is more important than logging
63
+ logging.critical("Failed to configure syslog handler")
64
+
65
+ parser = optparse.OptionParser()
66
+
67
+ parser.add_option('-g', '--graphite-base',
68
+ default = 'metrics',
69
+ dest = 'graphite_base',
70
+ help = 'The base graphite node',
71
+ metavar = 'NODE')
72
+
73
+ parser.add_option('-D', '--debug',
74
+ action = 'store_true',
75
+ default = False,
76
+ dest = 'debug',
77
+ help = 'Debug output (NOISY!)')
78
+
79
+ parser.add_option('-H', '--host',
80
+ default = None,
81
+ dest = 'hostname',
82
+ help = 'The name of the host to run jstat on',
83
+ metavar = 'HOST')
84
+
85
+ parser.add_option('-j', '--java-name',
86
+ default = None,
87
+ dest = 'java_app_name',
88
+ help = 'The name of the Java app to call jstat on',
89
+ metavar = 'JAVANAME')
90
+
91
+ parser.add_option('-s', '--scheme',
92
+ default = 'jstat',
93
+ dest = 'service',
94
+ help = 'Metric naming scheme, text to prepend to metric',
95
+ metavar = 'SERVICE')
96
+
97
+ (options, args) = parser.parse_args()
98
+
99
+ if not options.java_app_name:
100
+ parser.error('A Java app name is required')
101
+
102
+ if not options.hostname:
103
+ parser.error('A host name is required')
104
+
105
+ # Replace jstat colums titles with more explicit ones
106
+ # Stats coming from -gc
107
+ metric_maps_gc = { "S0C": "current_survivor_space_0_capacity_KB",
108
+ "S1C": "current_survivor_space_1_capacity_KB",
109
+ "S0U": "survivor_space_0_utilization_KB",
110
+ "S1U": "survivor_space_1_utilization_KB",
111
+ "EC": "current_eden_space_capacity_KB",
112
+ "EU": "eden_space_utilization_KB",
113
+ "OC": "current_old_space_capacity_KB",
114
+ "OU": "old_space_utilization_KB",
115
+ "PC": "current_permanent_space_capacity_KB",
116
+ "PU": "permanent_space_utilization_KB",
117
+ "YGC": "number_of_young_generation_GC_events",
118
+ "YGCT": "young_generation_garbage_collection_time",
119
+ "FGC": "number_of_stop_the_world_events",
120
+ "FGCT": "full_garbage_collection_time",
121
+ "GCT": "total_garbage_collection_time"
122
+ }
123
+
124
+ # Stats coming from -gccapacity
125
+ metric_maps_gccapacity = { "NGCMN": "minimum_size_of_new_area",
126
+ "NGCMX": "maximum_size_of_new_area",
127
+ "NGC": "current_size_of_new_area",
128
+ "OGCMN": "minimum_size_of_old_area",
129
+ "OGCMX": "maximum_size_of_old_area",
130
+ "OGC": "current_size_of_old_area",
131
+ "PGCMN": "minimum_size_of_permanent_area",
132
+ "PGCMX": "maximum_size_of_permanent_area",
133
+ "PGC": "current_size_of_permanent_area",
134
+ "PC": "current_size_of_permanent_area"
135
+ }
136
+
137
+ # Stats coming from -gcnew
138
+ metric_maps_gcnew = { "TT" : "tenuring_threshold",
139
+ "MTT": "maximum_tenuring_threshold",
140
+ "DSS": "adequate_size_of_survivor"
141
+ }
142
+
143
+ # Stats coming from -compiler
144
+ metric_maps_compiler = {
145
+ "Compiled": "compilation_tasks_performed",
146
+ "Failed": "compilation_tasks_failed",
147
+ "Invalid": "compilation_tasks_invalidated",
148
+ "Time": "time_spent_on_compilation_tasks"
149
+ }
150
+
151
+ # Stats coming from -class
152
+ ## Note that since "Bytes" appears twice in jstat -class output we need
153
+ ## to differentiate them by colum number
154
+ metric_maps_class = {
155
+ "Loaded": "loaded_classes",
156
+ "Bytes_column2": "loaded_KB",
157
+ "Unloaded": "unloaded_classes",
158
+ "Bytes_column4": "unloaded_KB",
159
+ "Time": "time_spent_on_class_load_unload"
160
+ }
161
+
162
+ def get_jstat_metrics(jstat_option, lvmid, metric_maps):
163
+ '''Runs jstat with provided option on provided host, returns mapped stats'''
164
+ def is_number(s):
165
+ '''returns true if string is a number'''
166
+ try:
167
+ float(s)
168
+ return True
169
+ except ValueError:
170
+ pass
171
+ try:
172
+ import unicodedata
173
+ unicodedata.numeric(s)
174
+ return True
175
+ except (TypeError, ValueError):
176
+ pass
177
+ return False
178
+
179
+ # Get stats from jstat stdout
180
+ try :
181
+ jstat_gc_out = check_output(["jstat", jstat_option, lvmid])
182
+ except Exception as e:
183
+ if options.debug:
184
+ print e
185
+ sys.exit(1)
186
+ logger.critical(e)
187
+ sys.exit(1)
188
+
189
+ values_all = jstat_gc_out.split("\n")[1].split()
190
+ # Remove non number strings
191
+ values = [ jstat_val for jstat_val in values_all if is_number(jstat_val) ]
192
+ # Transform float strings to integers
193
+ values = map(int, map(float, values))
194
+
195
+ # Change stats titles to long names
196
+ titles = jstat_gc_out.split("\n")[0].split()
197
+ # Deal with -class special "double Bytes" output
198
+ if jstat_option == "-class":
199
+ titles[2] = "Bytes_column2"
200
+ titles[4] = "Bytes_column4"
201
+ return dict([(metric_maps[title], values[position]) for position, title in enumerate(titles) if title in metric_maps])
202
+
203
+ # Get lvmid (JVM id)
204
+ try :
205
+ jps_out = check_output(["jps"])
206
+ except Exception as e:
207
+ if options.debug:
208
+ print e
209
+ sys.exit(1)
210
+ logger.critical(e)
211
+ sys.exit(1)
212
+
213
+ lvmid = False
214
+ for line in jps_out.split("\n"):
215
+ if options.java_app_name in line:
216
+ lvmid = line.split()[0]
217
+
218
+ if not lvmid:
219
+ if options.debug:
220
+ print "Could not get an LVM id"
221
+ sys.exit(1)
222
+ logger.critical("Could not get an LVM id")
223
+ sys.exit(1)
224
+
225
+ # Get stats from -gc
226
+ gc_stats = get_jstat_metrics("-gc", lvmid, metric_maps_gc)
227
+ if options.debug:
228
+ print gc_stats
229
+ # Get stats from -gccapacity
230
+ gccapacity_stats = get_jstat_metrics("-gccapacity",
231
+ lvmid, metric_maps_gccapacity)
232
+ if options.debug:
233
+ print gccapacity_stats
234
+ # Get stats from -gcnew
235
+ gcnew_stats = get_jstat_metrics("-gcnew", lvmid, metric_maps_gcnew)
236
+ if options.debug:
237
+ print gccapacity_stats
238
+
239
+ # Put all GC related stats to the same dict
240
+ gc_stats.update(gccapacity_stats)
241
+ gc_stats.update(gcnew_stats)
242
+
243
+ # Get stats from -compiler
244
+ compiler_stats = get_jstat_metrics("-compiler", lvmid, metric_maps_compiler)
245
+ if options.debug:
246
+ print compiler_stats
247
+
248
+ # Get stats from -class
249
+ class_stats = get_jstat_metrics("-class", lvmid, metric_maps_class)
250
+ if options.debug:
251
+ print class_stats
252
+
253
+ # Print to stdout in graphite format
254
+ now = time.time()
255
+ graphite_base = '.'.join([options.graphite_base,
256
+ '.'.join(reversed(options.hostname.split('.')))])
257
+
258
+ for metric in gc_stats:
259
+ print "%s.%s.jvm.gc.%s %s %d" % (graphite_base, options.service, metric,
260
+ gc_stats[metric], now)
261
+
262
+ for metric in compiler_stats:
263
+ print "%s.%s.jvm.compiler.%s %s %d" % (graphite_base, options.service,
264
+ metric, compiler_stats[metric], now)
265
+
266
+ for metric in class_stats:
267
+ print "%s.%s.jvm.class.%s %s %d" % (graphite_base, options.service,
268
+ metric, class_stats[metric], now)
269
+
270
+ if '__main__' == __name__:
271
+ JstatMetricsToGraphiteFormat().main()
@@ -0,0 +1 @@
1
+ require 'sensu-plugins-java/version'
@@ -0,0 +1,13 @@
1
+ require 'json'
2
+
3
+ # encoding: utf-8
4
+ module SensuPluginsJava
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
+ end
13
+ end
metadata ADDED
@@ -0,0 +1,234 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sensu-plugins-java
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Sensu-Plugins and contributors
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDgDCCAmigAwIBAgIBATANBgkqhkiG9w0BAQUFADBDMRIwEAYDVQQDDAltYXR0
14
+ am9uZXMxGDAWBgoJkiaJk/IsZAEZFgh5aWVsZGJvdDETMBEGCgmSJomT8ixkARkW
15
+ A2NvbTAeFw0xNTAxMjgyMTAyNTFaFw0xNjAxMjgyMTAyNTFaMEMxEjAQBgNVBAMM
16
+ CW1hdHRqb25lczEYMBYGCgmSJomT8ixkARkWCHlpZWxkYm90MRMwEQYKCZImiZPy
17
+ LGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyTSzVYnO
18
+ CLgyrIyT1mBQakArQyW8xhi6MlDqyzXHJGeERT790U6EgoBVeS4XoK0ptFZNR8Tf
19
+ zko0w+Nv47TarSCgkPOaxY+mxWnAVR10dOmfeLr7huiMyps+YD56/EF2FqQ3jf/+
20
+ qohENfKD91qy1ieEy+Fn7Pf74ltbNKUdkb9a9eFXQ0DQ4ip5vik7DzjQkUTj4lca
21
+ k6ArwnmHX4YDhZoYtrQJ8jVktN0/+NtA40M5qkCYHNe5tUW25b/tKVYuioxG6b2Z
22
+ oIzaZxRLxf6HVAWpCVRT/F5+/yjigkX4u++eYacfLGleXQzoK7BL65vHGMJygWEE
23
+ 0TKGqFOrl/L0AQIDAQABo38wfTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNV
24
+ HQ4EFgQUEf6a8Td7MrSZc8ImbLFZAENPbz0wIQYDVR0RBBowGIEWbWF0dGpvbmVz
25
+ QHlpZWxkYm90LmNvbTAhBgNVHRIEGjAYgRZtYXR0am9uZXNAeWllbGRib3QuY29t
26
+ MA0GCSqGSIb3DQEBBQUAA4IBAQBbzXAYA3BVGw8DZ0YYoY1VHPNEcH5qPIApmHO8
27
+ rvSmuUT0yMEi7u00H/5uHRFf4LleGT/+sTdyXKsNPGT9kdRuQEgwi+vf7Zfvd8aX
28
+ UF/+4VkEYf/8rV8Ere6u2QaWPgApdMV6JjKr1fAwCTd8AuGXNaWItiPPMseSQzLJ
29
+ JKP4hVvbc1d+oS925B1lcBiqn2aYvElbyNAVmQPywNNqkWmvtlqj9ZVJfV5HQLdu
30
+ 8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
31
+ HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
+ -----END CERTIFICATE-----
33
+ date: 2015-05-30 00:00:00.000000000 Z
34
+ dependencies:
35
+ - !ruby/object:Gem::Dependency
36
+ name: sensu-plugin
37
+ requirement: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '='
40
+ - !ruby/object:Gem::Version
41
+ version: 1.1.0
42
+ type: :runtime
43
+ prerelease: false
44
+ version_requirements: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '='
47
+ - !ruby/object:Gem::Version
48
+ version: 1.1.0
49
+ - !ruby/object:Gem::Dependency
50
+ name: english
51
+ requirement: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '='
54
+ - !ruby/object:Gem::Version
55
+ version: 0.6.3
56
+ type: :runtime
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '='
61
+ - !ruby/object:Gem::Version
62
+ version: 0.6.3
63
+ - !ruby/object:Gem::Dependency
64
+ name: codeclimate-test-reporter
65
+ requirement: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '0.4'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '0.4'
77
+ - !ruby/object:Gem::Dependency
78
+ name: rubocop
79
+ requirement: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '0.30'
84
+ type: :development
85
+ prerelease: false
86
+ version_requirements: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '0.30'
91
+ - !ruby/object:Gem::Dependency
92
+ name: rspec
93
+ requirement: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '3.1'
98
+ type: :development
99
+ prerelease: false
100
+ version_requirements: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: '3.1'
105
+ - !ruby/object:Gem::Dependency
106
+ name: bundler
107
+ requirement: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '1.7'
112
+ type: :development
113
+ prerelease: false
114
+ version_requirements: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: '1.7'
119
+ - !ruby/object:Gem::Dependency
120
+ name: rake
121
+ requirement: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '10.0'
126
+ type: :development
127
+ prerelease: false
128
+ version_requirements: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '10.0'
133
+ - !ruby/object:Gem::Dependency
134
+ name: github-markup
135
+ requirement: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '1.3'
140
+ type: :development
141
+ prerelease: false
142
+ version_requirements: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - "~>"
145
+ - !ruby/object:Gem::Version
146
+ version: '1.3'
147
+ - !ruby/object:Gem::Dependency
148
+ name: redcarpet
149
+ requirement: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - "~>"
152
+ - !ruby/object:Gem::Version
153
+ version: '3.2'
154
+ type: :development
155
+ prerelease: false
156
+ version_requirements: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - "~>"
159
+ - !ruby/object:Gem::Version
160
+ version: '3.2'
161
+ - !ruby/object:Gem::Dependency
162
+ name: yard
163
+ requirement: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - "~>"
166
+ - !ruby/object:Gem::Version
167
+ version: '0.8'
168
+ type: :development
169
+ prerelease: false
170
+ version_requirements: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - "~>"
173
+ - !ruby/object:Gem::Version
174
+ version: '0.8'
175
+ - !ruby/object:Gem::Dependency
176
+ name: pry
177
+ requirement: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - "~>"
180
+ - !ruby/object:Gem::Version
181
+ version: '0.10'
182
+ type: :development
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - "~>"
187
+ - !ruby/object:Gem::Version
188
+ version: '0.10'
189
+ description: Sensu plugins for Java
190
+ email: "<sensu-users@googlegroups.com>"
191
+ executables: []
192
+ extensions: []
193
+ extra_rdoc_files: []
194
+ files:
195
+ - CHANGELOG.md
196
+ - LICENSE
197
+ - README.md
198
+ - bin/check-java-permgen.rb
199
+ - bin/java-heap-pcnt.sh
200
+ - bin/metrics-java-heap-graphite.sh
201
+ - bin/metrics-jstat.py
202
+ - lib/sensu-plugins-java.rb
203
+ - lib/sensu-plugins-java/version.rb
204
+ homepage: https://github.com/sensu-plugins/sensu-plugins-java
205
+ licenses:
206
+ - MIT
207
+ metadata:
208
+ maintainer: ''
209
+ development_status: active
210
+ production_status: unstable - testing recommended
211
+ release_draft: 'false'
212
+ release_prerelease: 'false'
213
+ post_install_message: You can use the embedded Ruby by setting EMBEDDED_RUBY=true
214
+ in /etc/default/sensu
215
+ rdoc_options: []
216
+ require_paths:
217
+ - lib
218
+ required_ruby_version: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: 1.9.3
223
+ required_rubygems_version: !ruby/object:Gem::Requirement
224
+ requirements:
225
+ - - ">="
226
+ - !ruby/object:Gem::Version
227
+ version: '0'
228
+ requirements: []
229
+ rubyforge_project:
230
+ rubygems_version: 2.4.6
231
+ signing_key:
232
+ specification_version: 4
233
+ summary: Sensu plugins for Java
234
+ test_files: []
Binary file