Build precise queries to find exactly what you need
Press ESC to close
Nagios World Conference 2026: Sept. 14-17 in St. Paul, MN | Learn More
Hi, i have probe this plugin, and it works only with root user, i have added the config in /etc/sudoers but mi execution with user nagios is the following:
-bash-4.1$ cd /srv/nagios/libexec/ -bash-4.1$ ./check_jstat.sh -s tomcat6 Could not attach to 11922 CRITICAL: Can’t get GC statistics
I think that the problem is in jstat, which don´t have permissions to see all java process (all users).
I add permisions to /etc/sudoers:
nagios ALL=(root) NOPASSWD: /usr/bin/jstat
And modify the plugin included “sudo” in calls to jstat lines:
gc=$(sudo jstat -gc $pid | tail -1 | sed -e ‘s/[ ][ ]*/ /g’)
gccapacity=$(sudo jstat -gccapacity $pid | tail -1 | sed -e ‘s/[ ][ ]*/ /g’)
And works perfectly!
If there is any alternative solution may be welcome 🙂
Good work!