I am in the process of developing a custom Nagios plugin to monitor the absolute path of a few running processes.
As a root user I have always used the command 'ls -l /proc/$pid/exe to find the path but when I get Nagios to run this command(as user nagios) it doesn't have permission to access the file in /proc/.
As a workaround I gave sudo access to user nagios to run the command pwdx and this seems to be working fine, but it is a pain to do this on all our servers. Without this sudo access the plugin would fail.
I was wondering if there is a cleaner way to do this? I basically need a way to provide user nagios read access to everything under /proc.
mount -o remount,hidepid=0,gid=${pgid} /proc
pgid being the primary group id of the nrpe agent or nagios user. Obviously doing this to all your servers would also be a global change, but it might be worth testing.