NRPE troubleshooting

 Hi,

 To make nrpe daemon log plugins output, add this to the command definition: 2>&1

 

Example:

 

 # 'check_local_mailq' command definition
define command{
        command_name    check_local_mailq
        command_line    /usr/bin/sudo /usr/lib64/nagios/plugins/check_mailq -w 1 -c 2 > /tmp/nagiosdebug 2>&1
        }

Of course, make sure the user running nrpe or the plugin can write to the file (/tmp/nagiosdebug in this case).

Then:

# tail -f /tmp/nagiosdebug
sudo: sorry, you must have a tty to run sudo


I just added this in my sudo configuration

# Required for check_mailq
Defaults:nagios !requiretty
 

And now it works!

Important: once you're done debugging, remove the redirection, so that Nagios can get access to the output. Otherwise, you'll see "null" in the output instead of something like: OK: mailq is empty

Comments

Popular posts from this blog

General linux performance troubleshooting

Asterisk works under OpenVZ (no zaptel)