I am facing issues with sensu-plugins-java. I have installed plugin in our server and I need to use check-java-heap-pcnt.rb to monitor the heap size in our server, but it is not showing proper output when I try to run the check locally. Here's how I tried to run the check locally:
# ./check-java-heap-pcnt.rb -n java -w 70 -c 85 -j /usr/java/defaults/bin/ -p
Here's the output it generated:
invalid argument count
Usage: jstat -help|-options
jstat -<option> [-t] [-h<lines>] <vmid> [<interval> [<count>]]
Definitions:
<option> An option reported by the -options option
<vmid> Virtual Machine Identifier. A vmid takes the following form:
<lvmid>[@<hostname>[:<port>]]
Where <lvmid> is the local vm identifier for the target
Java virtual machine, typically a process id; <hostname>is
the name of the host running the target Java virtual machine;
and <port> is the port number for the rmiregistry on the
target host. See the jvmstat documentation for a more complete
description of the Virtual Machine Identifier.
<lines> Number of samples between header lines.
<interval> Sampling interval. The following forms are allowed:
<n>["ms"|"s"]
Where <n> is an integer and the suffix specifies the units as
milliseconds("ms") or seconds("s"). The default units are "ms".
<count> Number of samples to take before terminating.
-J<flag> Pass <flag> directly to the runtime system.
(standard_in) 1: syntax error
MEM UNKNOWN -
Download the nagios plugins from https://kb.op5.com/display/HOWTOs/Jboss+Monitoring+with+check_jmx
and use with sensu.
Name:- check_jmx
For thread cound command:-
./check_jmx -U service:jmx:rmi:///jndi/rmi://'servername':'port'/jmxrmi -O java.lang:type=Threading -A ThreadCount -K 9200 -w 250 -c 300
For Heap Memory:-
./check_jmx -U service:jmx:rmi:///jndi/rmi://'servername':'port'/jmxrmi -O java.lang:type=Memory -A HeapMemoryUsage -K used -I HeapMemoryUsage -J used -vvvv -w 102400 -c 81290