Code: Select all
$USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c clean_drive -a '$SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$'Code: Select all
$USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c clean_drive -a '$SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$'Code: Select all
tail -f /var/log/messagesCode: Select all
Aug 23 18:14:25 gent nrpe[29338]: Host address is in allowed_hosts
Aug 23 18:14:25 gent nrpe[29338]: Handling the connection...
Aug 23 18:14:25 gent nrpe[29338]: Error: Request contained illegal metachars!
Aug 23 18:14:25 gent nrpe[29338]: Client request was invalid, bailing out...Code: Select all
$USER1$/encode_script.sh '$HOSTADDRESS' '/path/to/clean_drive.sh "$SERVICESTATE$" "$SERVICESTATETYPE$" "$SERVICEATTEMPT$" 'Code: Select all
#!/bin/bash
HOST=$1
UNCODED=$2
ENCODED=$(echo '$UNCODED' | base64)
/usr/local/nagios/libexec/check_nrpe -h $HOST -c decode_script "$ENCODED"Code: Select all
command[decode_script]=/usr/local/nagios/libexec/decode_script.sh $ARG1$Code: Select all
#!/bin/bash
ENCODED=$1
DECODED=`echo $ENCODED | base64 -d`
eval $DECODED
Code: Select all
./check_nrpe -H 192.168.1.50 -t 30 -c clean_drive -a 'WARNING PROBLEM 2'Because they are needed so as to differentiate between the arguments passed to command and other arguments used for the check_nrpe plugin.BanditBBS wrote:......why was I thinking I needed to wrap the -a stuff in '
Code: Select all
check_nrpe -H <host> -c <command> -a '-w 5 -c 10'Code: Select all
check_nrpe -H <host> -c <command> -w 5 -c 10Code: Select all
check_nrpe -H <host> -c <command> -a -w 5 -c 10Code: Select all
echo "$1 $2 $3" > /tmp/event_testThat's a good idea. I'll add that to my script. The only way to make the eventhandler run though, would be to submit a passive check that changes the state, right?abrist wrote:For now, add a line to your event handler script to echo the arguments passed to it to a file in /tmp, run the handler, and then check the temp file.Code: Select all
echo "$1 $2 $3" > /tmp/event_test
Code: Select all
WARNING SOFT 2Code: Select all
echo "$1 $2 $3" > /tmp/event_test
echo -n "Cleaning the drive...\n"
/usr/local/nagios/libexec/clean_wlan_arc.sh
Code: Select all
echo "Searching and removing older files"
/usr/bin/find /var/bu/wlanadmin/*.gpg -mtime +5 -exec sudo /bin/rm {} \;
/usr/bin/find /var/bu/wlanadmin/*.cfg -mtime +5 -exec sudo /bin/rm {} \;
exit
Code: Select all
[clarkj@svwdcnetmg02 log]$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
272853152 243700152 15069316 95% /
/dev/sda1 101086 26965 68902 29% /boot
tmpfs 4074116 0 4074116 0% /dev/shm
[clarkj@svwdcnetmg02 log]$ sudo su nagios
bash-3.2$ cd /usr/local/nagios/libexec
bash-3.2$ ./clean_drive WARNING SOFT 2
Cleaning the drive...\nSearching and removing older files
bash-3.2$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
272853152 230906332 27863136 90% /
/dev/sda1 101086 26965 68902 29% /boot
tmpfs 4074116 0 4074116 0% /dev/shm
bash-3.2$