I wrote the following script which when called as script partition
will give you the percent free space. By adjusting $warn and $alarm you can adjust what it considers a warning or alarm number. I expect I'll add $warn and $alarm as additional parameters $2 and $3 in the future, but this gets me started at least tracking usage.
I have named it /var/prtg/scripts/drivespace. In PRTG you must fill in the arguments field with a value like var. No leading /. You can also put the filesystem instead of the moint point like dev/hd4 to get the / partition. I know that's a bit messy, but gets the job done. If you make improvements please post. :-)
#!/bin/ksh
# Determine percent free space on an AIX partition
# based on PRTG example script
# https://kb.paessler.com/en/topic/39513-is-there-a-shell-script-example-for-prtg-s-ssh-script-sensor
# The first and only argument should be the partition starting without a /
warn=85
alarm=90
part=""
one=$1
get_part(){
if [ "$one" ]; then
part="/"$one
else
echo "4:0:No partition argument found for script"
exit
fi
}
check_drivespace(){
#Find percentage used of partitions $part on AIX
percent=`df -v $part | grep "/"|awk '{print $6}'|cut -f 1 -d %`
if [ "$percent" -gt "$alarm" ] ; then #Alarm
echo "2:$percent:$part Space Very Low"
elif [ "$percent" -gt "$warn" ] ; then #Warning
echo "1:$percent:$part Space Low"
else #We're all good, nothing to see here.
echo "0:$percent:$part Normal"
fi
}
get_part
check_drivespace
[February 3rd 2016] Notes from Paessler Support
PRTGs SSH framework doesn't play well with AIX and might lead to crashes of the sshd process because AIX doesn't close the sessions properly. Please use any SSH sensor with caution on AIX boxes. We're currently implementing a new framework that might work better with it and will be available in the stable version. But AIX remains unsupported.
Add comment