nagios4 check_jvm plugin

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
manikanta
Posts: 3
Joined: Thu Jun 24, 2021 12:30 am

nagios4 check_jvm plugin

Post by manikanta »

i am using check_jvm plugin to monitor java threads,class count,heap memory and non heam memory

i am giving the command like this
command[check_jvm]=/usr/local/nagios/libexec/check_jvm -n org.apache.catalina.startup.Bootstrap -p heap -w 1073741824 -c 2147483648

but getting error like
UNKNOWN JVM is running with different username, run this script with UID 0

but i gave permissions to the script as root .as remaining plugins also same.
and i installed JvmInspector.jar also .

JVM pid: 1829
name: org.apache.catalina.startup.Bootstrap start
thread count: 26 (peak: 26)
class count: 3281
heap memory: max=6227755008|commited=125698048|used=35419184
non-heap memory: max=-1|commited=32178176|used=30893152
java version: 1.8.0_232 (AdoptOpenJDK)
java home: /opt/softwares/jdk8u232-b09/jre
jvm arguments: [-Djava.util.logging.config.file=/home/vidyayug/apache-tomcat-9.0.48/conf/logging.properties, -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager, -Xmx6g, -XX:MaxPermSize=2g, -Djdk.tls.ephemeralDHKeySize=2048, -Djava.protocol.handler.pkgs=org.apache.catalina.webresources, -Dorg.apache.catalina.security.SecurityListener.UMASK=0027, -Dignore.endorsed.dirs=, -Dcatalina.base=/home/vidyayug/apache-tomcat-9.0.48, -Dcatalina.home=/home/vidyayug/apache-tomcat-9.0.48, -Djava.io.tmpdir=/home/vidyayug/apache-tomcat-9.0.48/temp]
class path: /home/vidyayug/apache-tomcat-9.0.48/bin/bootstrap.jar:/home/vidyayug/apache-tomcat-9.0.48/bin/tomcat-juli.jar
server container: Apache Tomcat/9.0.48
active sessions: total=0|/docs=0|/examples=0|/manager=0|/=0|/host-manager=0
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: nagios4 check_jvm plugin

Post by mcapra »

If your Java process is running as root (UID 0), you'll need to also run your check_jvm plugin as root. This is a limitation of the JvmInspector jar file included with this plugin.
JvmInspector doesn't need local or remote JMX network socket.
It directly attaches to JVM's PerfData, so it must be started with
the same USERid as the target JVM.

You should be able to do this with NRPE with sudo, assuming the NRPE daemorn or xinetd user is in sudoers.

Code: Select all

sudo /usr/local/nagios/libexec/check_jvm -n org.apache.catalina.startup.Bootstrap -p heap -w 1073741824 -c 2147483648
Former Nagios employee
https://www.mcapra.com/
manikanta
Posts: 3
Joined: Thu Jun 24, 2021 12:30 am

Re: nagios4 check_jvm plugin

Post by manikanta »

i added nagios user in sudoers file. and java running with root and jvm plugin also running with root user only.

but getting same error only.

UNKNOWN JVM is running with different username, run this script with UID 0
Locked