sensu-plugins-jolokia 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/check-jvm-thread-count-pcnt.rb +75 -0
- data/lib/sensu-plugins-jolokia/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f766899cab21d9c030123857b644dd5c0919a39
|
4
|
+
data.tar.gz: 3e1b5ef6635cab42822864364b2e4eb34139e542
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7408fb7552c043e72ab340edecfbf648c1c27d44dd2ac63dd07d3a3b7dba1c40b416e9bf1782ccccbf2f88f4d298929dc2a2ac5b78161d5842e3a0414711fd69
|
7
|
+
data.tar.gz: e021a2f0d29abf35e81e0c159f6febe16cfc10c3da6152d6baf70ee04349427f3116220dca7031c6b912695a7dd689e7c2329073ece273c53105c775f3014fd6
|
@@ -0,0 +1,75 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require 'sensu-plugin/check/cli'
|
3
|
+
require 'jolokia'
|
4
|
+
|
5
|
+
# check-jvm-thread-count-pcnt
|
6
|
+
#
|
7
|
+
# DESCRIPTION: Check the percentage of Java JVM User Thread Count:
|
8
|
+
#
|
9
|
+
# OUTPUT:
|
10
|
+
# plain text
|
11
|
+
#
|
12
|
+
# PLATFORMS:
|
13
|
+
# Linux
|
14
|
+
#
|
15
|
+
# DEPENDENCIES:
|
16
|
+
# gem: sensu-plugin
|
17
|
+
# gem: jolokia
|
18
|
+
#
|
19
|
+
# USAGE:
|
20
|
+
# Specify Usage (Options):
|
21
|
+
# ./check-jvm-thread-count-pcnt.rb -w 90 -c 95'
|
22
|
+
#
|
23
|
+
# http://www.rubydoc.info/gems/jolokia/0.1.0
|
24
|
+
# *:type=Connector,*
|
25
|
+
|
26
|
+
class CheckJvmThreadCountPcnt < Sensu::Plugin::Check::CLI
|
27
|
+
option :url,
|
28
|
+
description: 'URL of the Jolokia Agent to the constructor for creating the client',
|
29
|
+
short: '-u URL',
|
30
|
+
long: '--url URL',
|
31
|
+
default: 'http://localhost:8080/jolokia'
|
32
|
+
|
33
|
+
option :warn,
|
34
|
+
description: 'The warning value when comparing against commited percent used',
|
35
|
+
short: '-w VALUE',
|
36
|
+
long: '--warning VALUE',
|
37
|
+
required: true
|
38
|
+
|
39
|
+
option :crit,
|
40
|
+
description: 'The critical value when comparing against commited percent used',
|
41
|
+
short: '-c VALUE',
|
42
|
+
long: '--critical VALUE',
|
43
|
+
required: true
|
44
|
+
|
45
|
+
def run
|
46
|
+
# Create an instance of Jolokia::Client to comunicate with the Jolokia Agent
|
47
|
+
|
48
|
+
jolokia = Jolokia.new(url: config[:url])
|
49
|
+
|
50
|
+
# Perform actions read or execute the operations of the MBeans
|
51
|
+
begin
|
52
|
+
jolokia_response = jolokia.request(
|
53
|
+
:post,
|
54
|
+
type: 'read',
|
55
|
+
mbean: 'java.lang:type=Threading',
|
56
|
+
attribute: 'ThreadCount'
|
57
|
+
)
|
58
|
+
rescue StandardError => e
|
59
|
+
puts ''
|
60
|
+
unknown e.message
|
61
|
+
end
|
62
|
+
|
63
|
+
max = `/bin/sh -c 'ulimit -u'`.to_i
|
64
|
+
used = (jolokia_response['value'])
|
65
|
+
pct_used = (used.to_f / max.to_f * 100).to_i
|
66
|
+
|
67
|
+
if pct_used > config[:crit].to_i
|
68
|
+
critical "Java User Thread Count Percentage: Used #{pct_used}%"
|
69
|
+
elsif pct_used > config[:warn].to_i
|
70
|
+
warning "Java User Thread Count Percentage: Used #{pct_used}%"
|
71
|
+
else
|
72
|
+
ok "Java User Thread Count Percentage: Used #{pct_used}%"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-jolokia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
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: 2016-09-
|
11
|
+
date: 2016-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|
@@ -170,6 +170,7 @@ executables:
|
|
170
170
|
- check-java-app-deployment.rb
|
171
171
|
- check-joloika-key.rb
|
172
172
|
- check-jvm-memory-pcnt.rb
|
173
|
+
- check-jvm-thread-count-pcnt.rb
|
173
174
|
extensions: []
|
174
175
|
extra_rdoc_files: []
|
175
176
|
files:
|
@@ -179,6 +180,7 @@ files:
|
|
179
180
|
- bin/check-java-app-deployment.rb
|
180
181
|
- bin/check-joloika-key.rb
|
181
182
|
- bin/check-jvm-memory-pcnt.rb
|
183
|
+
- bin/check-jvm-thread-count-pcnt.rb
|
182
184
|
- lib/sensu-plugins-jolokia.rb
|
183
185
|
- lib/sensu-plugins-jolokia/version.rb
|
184
186
|
homepage: https://github.com/sensu-plugins/sensu-plugins-jolokia
|