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.
I have a server and host both running CentOS 6. I wrote a plugin to monitor a directory and notify if any files appear. When I run the plugin directly on the host I get the correct response. When I run it from the server I get something different. See below for code.
Host returns the correct response of CRITICAL: 2 files
When you test running the plugin locally, what user are you using? I suspect that the NRPE user doesn't have the correct permissions to be able to execute ls -l /home/user1/ directory.
You'll want to adjust the permissions on the folder, and test running as the nagios user (or whatever user NRPE is set to run as).
rkennedy, that was indeed the issue. I had been banging my head against the wall and never thought to check permissions and the fact that the command would be running as the nrpe user when issued remotely. What is the norm when giving permissions to the nrpe user on the agent? Is it common practice to add a secondary group to the nrpe user to allow access to system files? Thanks for the help!
It is not unusual to add a command to the sudoers that needs to be executed by the nagios (or nrpe) user, and to prepend the command in the nrpe.cfg with "sudo" (if needed).
Be sure to check out our Knowledgebase for helpful articles and solutions!