Add dark theme and dedicated index page
[thomas_code.git] / nagios / eventhandlers / check_by_ssh_proxy
blob2e38796ba5eebc13053bf493ecf2a631a4fc1884
1 #!/bin/bash
3 # Check_by_ssh proxy - use the nrpe.cfg to perform check_by_ssh checks
4 # Version: 0.9
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.
17 ## CONFIG
19 NRPE_CONF="/usr/local/nagios/etc/nrpe.cfg"
23 while read line
25 [[ $line =~ ^[[:space:]]*command\[$SSH_ORIGINAL_COMMAND\][[:space:]]*=[[:space:]]*(.+)$ ]] || continue
27 exec ${BASH_REMATCH[1]}
28 done <"$NRPE_CONF"
30 echo "UNKNOWN: Command '$SSH_ORIGINAL_COMMAND' not found."
31 exit 3