/usr/local/nagios/libexec/check_by_ssh -H 192.168.100.7 -C 'df /' | awk '{ print $5 }' | tail -n 1
I get:
70%
I want to strip out the "%" here is what happens when I try to run my script "./park_check_by_ssh_df_percent.sh" and below that is my uber beginner attempt at a script
Yes I haven't included any logic for "if" or different exit codes yet, but I just want to get my command/wrapper to work at all
[nagios@log_book libexec]$ ./park_check_by_ssh_df_percent.sh 192.168.100.7 /
./park_check_by_ssh_df_percent.sh: line 8: awk: command not found
./park_check_by_ssh_df_percent.sh: line 8: tail: command not found
./park_check_by_ssh_df_percent.sh: line 10: ${$REMOTE/%/''}: bad substitution
Code: Select all
!/bin/bash
HOSTADDRESS=$1
PATH=$2
MAXWARN=$3
MAXCRIT=$4
REMOTE=`/usr/local/nagios/libexec/check_by_ssh -H $HOSTADDRESS -C df $PATH | awk '{ print $5 }' | tail -n 1`
PERCENT="${$REMOTE/%/''}"
echo $PERCENT
exit 0