Dear All,
I need notification mail from server while device size crossed 80% approximately.I tried following shell .its working fine when the device name like /dev/sdc1 etc.Its not working in LVM name.For example
Script:
#!/bin/sh
echo "Storage server space details";
df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output;
do
echo $output
usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
partition=$(echo $output | awk '{ print $2 }' )
if [ $usep -ge 80 ]; then
echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)" |
mail -s "Alert: Almost out of disk space $usep%" user1@domainname.com
fi
done
----
>>Its working fine while following device name available
[root@Server1 test]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 95G 8.2G 82G 10% /
/dev/sda12 9.5G 3.5G 5.6G 39% /home
>> Its not working for like below mention name
#df -h
Filesystem Size Used Avail Use% Mounted on
/dev/device1/LVM_LGroup1
6.8G 791M 5.7G 13% /
/dev/sda1 996M 53M 892M 6% /boot
tmpfs 1006M 0 1006M 0% /dev/shm
/dev/device2/LVM_LGroup2
6.8G 163M 6.3G 3% /home
How to filter with entire LVM_LVGrou1.please reply