“NRPE: Command ‘X’ not defined” Caused By Command Name Length
Jan 18th, 2006 by Alex
NRPE commands must be less than 32 characters, else NRPE will fail with the “NRPE: Command ‘X’ not defined” message. This is another reason why NRPE checks can fail inexplicably.
Note: As of January 19, 2004 the author “removed length restrictions for command names and command lines” in the 2.1 release. However, many legacy systems aren’t easily upgraded due to strict configuration management and security policy, resulting in earlier versions still being in production.
The undocumented way that NRPE parses its configuration file seems to be the source of several problems. For example, files specified by the include parameter must exist. Amidst numerous checks, it was discovered at some point that the command names have to be less than 32 characters.
Not everyone will run into this limitation. Most command names are relatively succint, but some can get rather verbose:
check_active_mirrors_via_sshis 28 characters.check_passive_mirrors_via_rsycis 30 characters.
To reproduce this problem, simply define a few NRPE commands in nrpe.cfg with long command names. Below, the first command name is 30 characters, the second 31 characters, etc.
command[123456789012345678901234567890]=/bin/echo "test" command[1234567890123456789012345678901]=/bin/echo "test" command[12345678901234567890123456789012]=/bin/echo "test"
Then run check_nrpe on the host you just configured.
[client/gnu ] ./check_nrpe -H server -c 123456789012345678901234567890 test [client/gnu ] ./check_nrpe -H server -c 1234567890123456789012345678901 test [client/gnu ] ./check_nrpe -H server -c 12345678901234567890123456789012 NRPE: Command '12345678901234567890123456789012' not defined
The problem is avoided altogether by using command names 31 characters or less.
(Update): The problem can also be avoided by running NRPE 2.1 or higher.