Re: NRPE sudo check_jvm not working on RHEL 8 or Debian 10
Posted: Wed Jan 20, 2021 10:29 am
Ah, OK. Thank you for the explanation about variables. I see what you're getting at then. Before starting this thread i did some exploration into variables, since i thought that could be the problem as well. But i was never able to solve it by setting variables.
Anyway, the strace looks like it gives something useful. I added this line to check_jvm:
I had to remove the $() wrapper that was on the line above as it suppressed the output.
When i run the check from the Nagios server, no /tmp/NAGIOSTEST.txt gets created on the client. I think that is because Systemd tries to isolate daemon's temporary files from each other with PrivateTmp=yes set by default. But, despite no /tmp file being created, some output makes it back to the server where i ran the command:
That is for the RHEL 8 client. It seems to be looking for something in the OpenJDK installation that doesn't exist. Such as looking for this path: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.275.b01-1.el8_3.x86_64/jre/lib/amd64/jli/tls/haswell/avx512_1/x86_64/libpthread.so.0. The closest to that which exists is this directory: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.275.b01-1.el8_3.x86_64/jre/lib/amd64/jli/.
I tried adding the same strace command on the Debian 10 client. Similar to RHEL 8, no /tmp/NAGIOSTEST.txt was created on the client system. But the server got back considerably more output than it did from the RHEL client; so much so that i'll attach it as a file rather than pasting it here.
Anyway, the strace looks like it gives something useful. I added this line to check_jvm:
Code: Select all
strace -f java -jar "${JVMINSPECTOR}" "${PID}" 2>&1 >> /tmp/NAGIOSTEST.txtWhen i run the check from the Nagios server, no /tmp/NAGIOSTEST.txt gets created on the client. I think that is because Systemd tries to isolate daemon's temporary files from each other with PrivateTmp=yes set by default. But, despite no /tmp file being created, some output makes it back to the server where i ran the command:
Code: Select all
# /usr/local/nagios/libexec/check_nrpe -H lnx-b9ssb-devl -u -t 30 -c tomcat_heap
execve("/usr/bin/java", ["java", "-jar", "/usr/local/libexec/JvmInspector."..., "1322856"], 0x7ffffa9b6600 /* 19 vars */) = 0
brk(NULL) = 0x556d925c0000
arch_prctl(0x3001 /* ARCH_??? */, 0x7fffc6e9b220) = -1 EINVAL (Invalid argument)
readlink("/proc/self/exe", "/usr/lib/jvm/java-1.8.0-openjdk-"..., 4096) = 73
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2fb6eda000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.275.b01-1.el8_3.x86_64/jre/bin/../lib/amd64/jli/tls/haswell/avx512_1/x86_64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.275.b01-1.el8_3.x86_64/jre/bin/../lib/amd64/jli/tls/haswell/avx512_1/x86_64", 0x7fffc6e9a460) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.275.b01-1.el8_3.x86_64/jre/bin/../lib/amd64/jli/tls/haswell/avx512_1I tried adding the same strace command on the Debian 10 client. Similar to RHEL 8, no /tmp/NAGIOSTEST.txt was created on the client system. But the server got back considerably more output than it did from the RHEL client; so much so that i'll attach it as a file rather than pasting it here.