jaapar
June 14, 2017, 2:28am
1
Hi Scripters, good day.
bash-4.2# df -g /apps/prd
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/xxx 64.00 4.35 94% 1269284 8% /xxx
bash-4.2#
I was wondering if there is a script when the usage of the mountpoint above hit 98%, email would be sent to a specific mailbox? Thanks in advance.
RudiC
June 14, 2017, 2:35am
2
Almost certainly, yes. Look into the links at the lower left of this page, under "More UNIX and Linux Forum Topics You Might Find Helpful", or search these forums for "almost full".
1 Like
jaapar:
Hi Scripters, good day.
bash-4.2# df -g /apps/prd
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/xxx 64.00 4.35 94% 1269284 8% /xxx
bash-4.2#
I was wondering if there is a script when the usage of the mountpoint above hit 98%, email would be sent to a specific mailbox? Thanks in advance.
I think you can just set a cronjob to run at your preferred interval.
mine is running on solaris 10 hence command might varies.
20 * * * * df -h | tail +2 | awk '{if ((length($5) > 3) || ((length($5) > 2) && ($5 > 98))) print $0}' | mailx -s "Email Subject" <email address>
1 Like
lightman66:
I think you can just set a cronjob to run at your preferred interval.
mine is running on solaris 10 hence command might varies.
20 * * * * df -h | tail +2 | awk '{if ((length($5) > 3) || ((length($5) > 2) && ($5 > 98))) print $0}' | mailx -s "Email Subject" <email address>
You should be able to simplify that awk
code a little bit to just:
20 * * * * df -h | tail +2 | awk '($5 + 0) > 98' | mailx -s "Email Subject" <email address>
but on a Solaris/SunOS system, that would be:
20 * * * * df -h | tail +2 | nawk '($5 + 0) > 98' | mailx -s "Email Subject" <email address>
1 Like