Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

So I've just started configuring Nagios in my environment and I'm getting the above error when trying to user the NRPE plugin.

The host file is as follows:

define {

    host_name   servername    
    alias       servername
    address     xxx.xxx.xxx.xxx
    use         generic-host    
}

define service {    
    use                     generic-service    
    host_name               servername   
    service_description CPU load    
    check_command           check_nrpe!alias_cpu    
}

This is the check_nrpe.cfg file that is located in /etc/nagios-plugins/config

NOTE: this command runs a program $ARG1$ with arguments $ARG2$

define command {   
        command_name    check_nrpe    
        command_line    /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$    
}

NOTE: this command runs a program $ARG1$ with no arguments

define command {    
        command_name    check_nrpe_1arg    
        command_line    /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$    
}

Any ideas what is wrong or where to start to solve this?

share|improve this question
    
what happens if you execute /usr/lib/nagios/plugins/check_nrpe with the respective arguments as the user nagios is running as? –  RSchulze Nov 1 '13 at 14:02
    
it works fine , example : ./check_nrpe - H xxx.xxx.xxx.xxx -c alias_cpu returns " OK CPU Load ok . | some stats..... " –  user118074 Nov 1 '13 at 14:12
    
Yah, see the answer to serverfault.com/questions/549882/… –  Keith Nov 1 '13 at 16:11
    
Well you didn't run it as nagios would have run it without a second argument. nagios would have run it as "check_nrpe -H host -c ARG -a". Probably giving the -a without any parameter causes an error. But you seem to have found a solution that fits your needs. –  Marki Nov 1 '13 at 16:52
add comment

2 Answers

I always run these commands from a terminal first to see what's going on instead of trying to debug them in Nagios. It's just easier and you can typically provide switches to the plugins that make them more verbose. I'll usually become the nagios user, whatever that username is, when doing this.

$ /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$

You'll have to determine the variable values for $HOSTADDRESS$, $ARG1$ and $ARG2$ but this should be straightforward.

share|improve this answer
    
i run the command in the format above (directly) and it worked without an issue. NAgios just does not seem to like it.... –  user118074 Nov 1 '13 at 15:09
add comment

so heres what fixed my issue By running from inside the config gile the check_nrpe_1arg . Seems the default check_nrpe is waiting for 2 arguments which is not always the case!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.