Operating System - HP-UX
1834007 Members
1843 Online
110063 Solutions
New Discussion

monitoring file system capacity

 
Jdamian
Respected Contributor

monitoring file system capacity

Sometimes my /var file system becomes full.

I need to get warnings in system log when a file system is nearly full.

Is there any program to get that ?

Thanx in advans.

P.D: monitoring system tables as "nproc" and "nfile" is also desired
5 REPLIES 5
Victor BERRIDGE
Honored Contributor

Re: monitoring file system capacity

Hi,
What about using Big brother, its a freeware (I think) that does just the job and can do much more, look at:
http://bb4.com/

I use it and am happy about it...

All the best
Victor
Patrick Wallek
Honored Contributor

Re: monitoring file system capacity

Here is a little shell script that uses awk to check for any filesystem that is at 99% or above and then e-mails the appropriate info.

#!/bin/ksh
H=`hostname`
fs=`bdf -l | awk '
/%/ && ($6 !~ /cdrom/ ) && ($1 !~ /Filesystem/ ){
if ( $1 > 0 )
{ split($4,perc,"%"); if (perc[1]>=99) {print h": " $5 " at " $4} }
else
{ split($5,perc,"%"); if (perc[1]>=99) {print h": " $6 " at "$5} }
}
' h=$H`
if [[ ! -z $fs ]]
then
# echo $fs
/usr/bin/mailx -s "Disk problem" your_eamail@address.com < $fs
fi
Robert Smith_1
New Member

Re: monitoring file system capacity

How about this script?
bdf | grep -iv filesystem | awk '{print $6 " "$5}' | while
read LINE; do
PERC=`echo $LINE | cut -d "%" -f1 | awk '{ print $2 }'`
if [[ $PERC -gt 95 ]]; then
echo "${PERC}% ALERT!" | mailx -s "${LINE} on `hostname` is almost full" root
fi
done

exit

Hope This Helps!

Rob


But it was working 5 minutes ago!!!!!
Chris B
Occasional Advisor

Re: monitoring file system capacity

If you want to monitor nproc and nfile in real time, you may use glance in char mode, hit 't' will show you what is configured and what is current usage.
If you keep running glance, you may get alarm history if your hitting limits.
I hope this helps you.
Chance happens to all but turn it to account is gift of few.
Tom Danzig
Honored Contributor

Re: monitoring file system capacity

Here's an snippit from a script I run daily. After the function, list the mounts you want to check and the percentage above which you want it to warn at:

#!/usr/bin/sh

# Disk utilization function
disk_utilization()
{
echo $1 | awk '{x=sprintf("Checking size of %s ............................. ",$0);printf("%18s ",substr(x,1,45))}'
sz=`bdf | awk -v var=$1 '{if($NF == var){x=sprintf("%d",substr($5,1,(index($5,"%")-1)))}}END{printf("%d",x)}' `
if [[ $sz -ge $2 ]] then
echo "[NG] - ${sz}% Limit = ${2}%"
else
echo "[OK] - ${sz}% Limit = ${2}%"
fi
}

# List disks to check here - disk_utilization <% full threshold>
disk_utilization /var 85
disk_utilization /usr 80
disk_utilization /home 50