While debugging a randomly failing check on some of our hypervisors, we came across a tip that makes debugging the failed NRPE checks so much easier. Simply add ‘2>&1’ to the end of the check definition in your nrpe.cfg and restart the service. This will send all the stderr to NRPE as well.
command[check_kvm_memory]=/usr/lib64/nagios/plugins/check_kvm_memstats -c 95 -w 90
command[check_kvm_memory]=/usr/lib64/nagios/plugins/check_kvm_memstats -c 95 -w 90 2>&1
It took the output of the command from..
NRPE: Unable to read output
to
error: failed to connect to the hypervisor error: no valid connection error: Failed to connect socket to '/var/run/nrpe/.cache/libvirt/libvirt-sock': No such file or directory
Thanks to ufk at stack exchange for the tip.