Updated runtrap to log, diskstats to handle default action
This commit is contained in:
parent
3e40157c11
commit
698f8fd539
2 changed files with 11 additions and 6 deletions
14
runtrap
14
runtrap
|
@ -8,12 +8,16 @@ trapdir="$(dirname $(readlink -f $0))/trap.d/${state}"
|
|||
errors=0
|
||||
debug=false
|
||||
|
||||
log() {
|
||||
echo "$(date +"%x %T") $*"
|
||||
}
|
||||
|
||||
if [[ "$0" == *".debug" ]]; then
|
||||
debug=true
|
||||
fi
|
||||
|
||||
if [[ ! -d "$trapdir" ]]; then
|
||||
echo "ERROR: Trap directory doesn't exist: $trapdir "
|
||||
log "ERROR: Trap directory doesn't exist: $trapdir "
|
||||
exit 5
|
||||
fi
|
||||
|
||||
|
@ -23,7 +27,7 @@ if [[ -r "${lockfile}" ]]; then
|
|||
if [[ $runs -ge 3 ]]; then
|
||||
for s in ${trapdir}/*
|
||||
do
|
||||
echo "Kill: $s "
|
||||
log "Kill: $s "
|
||||
pkill -9 -f $s
|
||||
done
|
||||
rm -f ${lockfile}
|
||||
|
@ -56,12 +60,12 @@ if $debug; then
|
|||
else
|
||||
zsend=$(zabbix_sender -c ${agentconf} -i ${tempfile})
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR"
|
||||
log "ERROR"
|
||||
else
|
||||
if [[ $errors -gt 0 ]]; then
|
||||
echo "WARN"
|
||||
log "WARN"
|
||||
else
|
||||
echo "OK"
|
||||
log "OK"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
mode=${1,,}
|
||||
mode=${1-trap}
|
||||
mountpath=${2-all}
|
||||
stat=${3,,}
|
||||
|
||||
mode=${mode,,}
|
||||
|
||||
#echo "mode: $mode"
|
||||
#echo "path: $mountpath"
|
||||
|
|
Loading…
Reference in a new issue