3 # Check_by_ssh proxy - use the nrpe.cfg to perform check_by_ssh checks
5 # Author: Thomas Guyot-Sionnest <thomas@gmail.com>
7 # Usage: Call this script usign an an ssh key (command="..." <public_key>)
8 # Then on the nagios server, run check_by_ssh with the command set
9 # to your check_nrpe command.
11 # Bugs: - Arguments not yet supported
12 # - RE metachars in $SSH_ORIGINAL_COMMAND should be escaped
14 # This script is released in the public domain.
19 NRPE_CONF
="/usr/local/nagios/etc/nrpe.cfg"
25 [[ $line =~ ^
[[:space
:]]*command\
[$SSH_ORIGINAL_COMMAND\
][[:space
:]]*=[[:space
:]]*(.
+)$
]] ||
continue
27 exec ${BASH_REMATCH[1]}
30 echo "UNKNOWN: Command '$SSH_ORIGINAL_COMMAND' not found."