-
Notifications
You must be signed in to change notification settings - Fork 1
/
diskalert
executable file
·38 lines (32 loc) · 1.25 KB
/
diskalert
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/local/bin/bash
getdiskutilz=$(df -h | grep -i \/dev\/.d | cut -b 39-41)
getinodeutilz=$(df -hi | grep -i \/dev\/.d | cut -b 61-63)
typeset -i warning=80
typeset -i critical=90
for diskpercentage in $getdiskutilz;
do
typeset -i diskpercentage
if [ $diskpercentage -gt $critical ];
then
df -h | mail -s "$(hostname) - More then ONE partition DISK is above the $critical% !!! it means very CRITICAL !!! SEE BELOW" $recipient;
else
if [ $diskpercentage -gt $warning ];
then
df -h | mail -s "$(hostname) - More then ONE partition DISK is above the $warning% threshold! See below" $recipient;
fi
fi
done
for inodepercentage in $getinodeutilz;
do
typeset -i inodepercentage
if [ $inodepercentage -gt $critical ];
then
df -hi | mail -s "$(hostname) - More then ONE partition INODES is above the $critical% !!! it means very CRITICAL !!! SEE BELOW" $recipient;
else
if [ $inodepercentage -gt $warning ];
then
df -hi | mail -s "$(hostname) - More then ONE partition INODES is above the $warning% threshold! See below" $recipient;
fi
fi
done