Ahhhhhh... not passing warning and critical values on the client still works, so therefore I assumed not passing on then on the host would work too! I thought it woud run the same command. I didn't think it would pass empty -w -c. I couldn't find the commands in any logs to see it not being passed to realise this was happening.
Secondly, when I did pass values on the host I included the -w -c as part of the arguments. I thought the -a flag was the entire argument string to pass, so '-w 20 -c 10'
As for sudo in the config file, I read someone where online to do this, I've tried quite a lot of different things!
So running the command from the host is now working and fetching the data! Thank you!!
But the Nagios web interface is still showing the errors I was getting on the command line, but armed with the above info I am better equipped to investigate!
Thanks a lot, this is a huge step forward for me.
Edit: The command line passed by the host is:
Code: Select all
/usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c check_cpu -a 20
and it states
So it seems $ARG1% is check_cpu and $ARG2$ is 20, and so my -c value is not being passed as $ARG3$ is not used.
This is my service definition
Code: Select all
define service{
use generic-service ; Name of service template to use
hostgroup_name servers
service_description CPU
check_command check_nrpe!check_cpu!85!95
}
Edit: I think I have done it... based on your explanations I tried putting a space not an exclamation to pass the warning and critical values, as both of these would be considered $ARG2$, which I guess in turn would then be considered as $ARG1$ and $ARG2$ on the remote machine. I think its working now.
Code: Select all
define service{
use generic-service ; Name of service template to use
hostgroup_name servers
service_description CPU
check_command check_nrpe!check_cpu!20 10
}
So the command being executed is:
Code: Select all
/usr/lib/nagios/plugins/check_nrpe -H mail.amitywebsolutions.co.uk -c check_cpu -a 20 10
Edit: One last question... surely this has to be very very common, monitoring remote machines, but why can't I find this documented anywhere? Or is there another way that is documented, and the above is not correct?