I had this error on nagios for the longest time. “NRPE: Command ‘check_disk_root’ not defined” This problem server, called derp is running NRPE under xinetd. Today I solved the issue!
BAM, that was my issue; old nrpe daemons were running in the background. I identified this with a quick
netstat -a | grep nrpe which returned
tcp 0 0 *:nrpe *:* LISTEN updating the nrpe config file and restarting xinetd had no effect on the check_disk_root command being recognized, because the nrpe daemon never actually restarted. I thought for sure the NRPE daemon was not sourcing the correct config file, but this was not the case.
There was a big clue I didn’t pick up on that would have identified the issue:
On derp I ran,
service xinetd stop then on the nagios server I ran,
/usr/local/nagios/libexec/check_nrpe -c check_disk_root -H derp and NRPE on derp returned,
NRPE: Command 'check_disk_root' not defined Hello! NRPE should not have returned anything at all because we shut it down moments ago with
service xinetd stop! I pkilled the stubborn daemon with
Back on the nagios server ran,
/usr/local/nagios/libexec/check_nrpe -c check_disk_root -H derp.
Connection refused by host. There we go! Is it really dead? I have to see the NRPE daemon’s lifeless, mutilated body, I must see it after all the grief it’s put me through!
netstat -a | grep nrpe returns nothing. MWAHAHAHAHAaa! I killed it! It’s dead!
Now all that was left to do was bring it back to life with a
service xinetd start and try running again
/usr/local/nagios/libexec/check_nrpe -c check_disk_root -H derp on the nagios server.
DISK OK - free space: / 18392 MB (59% inode=93%);| /=12309MB;22400;28800;0;32001 is returned. Cool beans!