Does anyone know of any tool that would monitor my filesystems and send a mail when it is getting full.I want to get some kinda network and system monitoring tool too. Is anyone aware of any freeware ??
I had the same problem, but had no money to throw at it - so I scripted it.
Using a central server, I used the rsh command to get information using df (amongst other things). The relevant information was stripped out and held in a logfile. An hour or so later the same is done, but this time the current values are compared against the previously held values. The output from this compare is then mailed to user on the [central] server.
If you're interested I could forward you some code that you could amend to suit your own setup?
This is what I use, running at set times from the cron:
#!/bin/ksh
# ========================================================
#
# Check file system for disk full and sends messages
#
# Parameters : $1 = Message Header (Node identification)
# $2 = level 1 message (in %)
# $3 = level 2 message (in %)
# $4 = reset level (in %)
# $5 = file system (tmp, var etc.)
#
# ========================================================
df | grep $5 > $5.z
sed '/tmp/q' $5.z > $5.x
sed -e 's/%//' $5.x > $5.y
XXX=`awk '{print $4}' $5.y`
LAST=`awk '{print $1}' tmp/$5.last`
################################################
# send message level 1 #
################################################
if [ "$XXX" -ge "$2" ] && [ "$LAST" -lt "$2" ]
then
MSG="$1: /$5 File System $2% Full!"
echo $MSG > tmp/msg.txt
mail -s HOSTNAME me@domain.com < tmp/msg.txt
echo $MSG
echo $2 > tmp/$5.last
fi
#################################################
# send message level 2 #
#################################################
if [ "$XXX" -ge "$3" ] && [ "$LAST" -eq "$2" ]
then
MSG="$1: /$5 File System $3% Full!!"
echo $MSG > tmp/msg1.txt
mail -s HOSTNAME me@domain.com < tmp/msg1.txt
echo $MSG
echo $3 > tmp/$5.last
fi
#################################################
# reset last #
#################################################
if [ "$XXX" -lt "$4" ]
then
echo $XXX > tmp/$5.last
fi
This is what my cron entries looks like to monitor the usr.var and tmp file systems:
# Check file systems and send email when 80% & 90% full
10,40 * * * * diskchk.sh HOSTNAME 80 90 79 usr
11,41 * * * * diskchk.sh HOSTNAME 80 90 79 var
12,42 * * * * diskchk.sh HOSTNAME 80 90 79 tmp
HOSTNAME = your machine host name
me@domain.com = your email address
This is the script that I mentioned - it runs from a central server so that there is only ever one copy of the files irrespective of how many hosts are being checked.
Also this script only mails changes to filesystem size, and only filesystems over 80% full are monitored.
Amend the values of the HOSTS and OUTPUT_FILE variables to suit your setup. Include the pathname in OUTPUT_FILE.
#!/usr/bin/ksh
############################################################
# FILE: df_check.sh
# VERSION: 2.1
# WRITTEN BY: D Vickers
############################################################
# REQUIRES: rsh access to remote nodes
############################################################
# OTHER FILES:
# creates config file to keep date of previous check.
# creates file ddmmyy.df to maintain df information.
############################################################
# MODIFICATIONS:
# DATE AUTHOR CHANGE
# ===== ====== ======
# 11/06 DV Amended script to mail root user.
# 11/06 DV Added better mail message when no change.
############################################################
## BUG-TRAQ:
## DATE REPORTED BY DESCRIPTION
## ===== =========== ===========
## 11/06 DV Does not mail relevant hostname
## with filesystem, which is a hassle
## if filesystem is /home or something.
## 11/06 DV COMPLETED. (amended awk statement).
##
## 12/06 DV Under certain scenarios the old
## dfout.PID file does not get removed.
############################################################
############################################################
# Set variables.
############################################################
# You may change these values to reflect hosts checked.
############################################################
############################################################
# Do not change anything below this line.
############################################################
DFCHK_CFG="dfchk.cfg"
OUTPUT_FILE="/tmp/dfout.$$"
MAIL_FILE="df.mail"
SUBJECT="Usage checks: "`date`
############################################################
# Loop through hosts to get df values.
############################################################
for host in `echo ${HOSTS}`
do
echo "HOSTNAME: ${host}"
rsh ${host} df -k|tr -d "%"| awk 'BEGIN{getline} $4 > 80 {print $4,hostnm,$7}' hostnm=${host} | sort +0 -r -n 2> /dev/null
echo "\n"
done > ${OUTPUT_FILE}
############################################################
# Check against previous findings.
############################################################
############################################################
# Ensure that previous findings are available...
# ...get value from $DFCHK_CFG file.
############################################################
if [ ! -f ${DFCHK_CFG} ]
then
touch ${DFCHK_CFG}
fi
PREVIOUS_OUTPUT=`head -1 $DFCHK_CFG`
if [ -z "${PREVIOUS_OUTPUT}" ]
then
echo "ERROR: previous value does not exist"
echo ${OUTPUT_FILE} > ${DFCHK_CFG}
exit 1
fi
############################################################
# Check for differences in current log against previous log.
############################################################
diff -ct ${PREVIOUS_OUTPUT} ${OUTPUT_FILE} | grep -v "\---" | egrep "^\-|^\+|^!"
> ${MAIL_FILE}
############################################################
# If mail file is empty then no filesystem usage has changed.
############################################################
NUM_LINES=`wc -l ${MAIL_FILE}|awk '{print $1}'`
if [ ${NUM_LINES} -eq 0 ]
then
# File is empty
echo "There has been no change to %used" > ${MAIL_FILE}
fi
mail -s "${SUBJECT}" root < ${MAIL_FILE}
rm ${MAIL_FILE}
############################################################
# Put current information in the config file.
# delete old information.
############################################################
echo ${OUTPUT_FILE} > ${DFCHK_CFG}
rm $PREVIOUS_OUTPUT
############################################################
# END OF SCRIPT
############################################################
If you want to go for some high end tools there is BMC Patrol which will do most of the things for you. I dunno if a downloadable version for that is available. Thief................
(In a confrontation between a rock and stream, the stream always wins, not because of strength but persistence.)
We have a big file into / FS part, and this partition are in 100%, i´d like to know, how can I remove this uname file?
Please see the following FS list
-rw-r--r-- 1 root system 24395776 Nov 22 16:10
drwxr-xr-x 19 bin bin 1024 Nov 23 11:42 .
drwxr-xr-x 19 bin bin 1024 Nov 23 11:42 ..
-rw------- 1 root system 0 Nov 09 18:42 .Xauthority
-rw------- 1 root system 11054 Nov 23 12:12 .sh_history
-rw-r--r-- 1 root system 105 Nov 09 18:38 .xerrors
-rw------- 1 root system 65 Nov 09 18:38 .xsession-errors
-rw-r--r-- 1 root system 0 Dec 21 1999 0
-rw-r--r-- 1 root system 0 Nov 23 11:40 1
drwxr-xr-x 2 root system 512 Jul 11 2000 Patch_H
drwxr-xr-x 2 root system 512 Jul 12 2000 Patch_Hold
drwxr-xr-x 2 root system 512 Jun 29 1999 SMSRUN
drwxr-xr-x 2 root system 512 Aug 18 1999 TT_DB
lrwxrwxrwx 1 bin bin 8 Jun 29 1999 bin -> /usr/bin
-rw-rw-r-- 1 root system 0 Jun 21 01:16 bootrec
-rw-r--r-- 1 root system 4626 Aug 20 1999 bosinst.data
drwxr-xr-x 2 root system 512 Jun 29 1999 cdrom
drwxrwxr-x 4 root system 2560 Nov 23 10:12 dev
-rw-r--r-- 1 root system 0 Nov 23 11:24 esto
drwxr-xr-x 13 root system 3584 Aug 10 16:11 etc
drwxr-xr-x 27 bin bin 512 Sep 19 19:29 home
-rw-r--r-- 1 root system 7203 Jun 21 01:16 image.data
lrwxrwxrwx 1 bin bin 8 Jun 29 1999 lib -> /usr/lib
drwx------ 2 root system 512 Jun 29 1999 lost+found
drwxr-xr-x 26 bin bin 1024 Jun 29 1999 lpp
-rw------- 1 root system 401408 Nov 23 10:30 mbox
-rw-r--r-- 1 root system 655 Jun 29 1999 mex_cnf
-rwxrwxrwx 1 root system 2384 Jun 29 1999 mex_lic
drwxr-xr-x 2 bin bin 512 Jun 29 1999 mnt
drwxr-xr-x 2 root system 512 Jun 29 1999 opt
-rw-r--r-- 1 root system 0 Oct 12 2000 pepe.txt
drwxr-xr-x 3 bin bin 512 Jun 29 1999 sbin
-rw-rw-rw- 1 root system 2245405 Nov 09 18:42 smit.log
-rw-rw-rw- 1 root system 161249 Nov 09 18:42 smit.script
lrwxrwxrwx 1 root system 18 Jun 29 1999 tftpboot -> /usr/ncd/termi
nals
drwxr-xr-x 2 root system 512 Jun 29 1999 tftpboot_O
drwxrwxrwt 6 bin bin 2560 Nov 23 12:12 tmp
lrwxrwxrwx 1 bin bin 5 Jun 29 1999 u -> /home
lrwxrwxrwx 1 root system 21 Jun 29 1999 unix -> /usr/lib/boot/unix
_up
drwxrwxrwx 23 bin bin 512 Dec 15 2000 usr
drwxr-xr-x 16 bin bin 512 May 31 2000 var
#
# df -k
Filesystem 1024-blocks Free %Used Iused %Iused Mounted on
/dev/hd4 32768 24 100% 1003 7% /
/dev/hd2 1015808 400664 61% 15619 7% /usr
/dev/hd9var 114688 22284 81% 207 1% /var
/dev/hd3 114688 53568 54% 139 1% /tmp
/dev/hd1 16384 15024 9% 149 4% /home
/dev/SMSRUN 6389760 3135484 51% 14251 1% /usr/EBS/SMS/3.3.0/RUN
#
Thanks
Francisco A. Altamirano
SWITCHING NETWORK
NEXTEL Argentina
Palestina 977 - Tel. +54 11 49982620
Why don't you simply try PDT. Is a standard software package... It can monitor your volumes, filesystems, paging spaces, directories, ram usage, etc...
I hope it works...
Unix was made by and for smart people.
This should do an interactive remove of everything in the directory, and it will start with the 'no-name' file. Once you have said 'y' to delete the first file, type CTRL-C to cancel the command. It won't delete anything else.
HTH, LHLTech
IBM Certified Specialist - AIX System Support
Halfway through CATE exams!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.