PLugin for checking file size

Kenneth.ray kenneth.ray at travelersla.com
Mon Aug 19 19:56:45 CEST 2002


Well, I dont know about file sizes but we use fcheck to monitor if a
file has changed and if so it produces a warning in the Messages file,
which is reported to netsaint. but Im sure there is a program out there
that can do it on a command line, Im sure also if you had the time and
the inclination  your could write a simple program that would do that.
something that would check if a certain threshold was reached on the
file size.
here is some sudo code to start helping you if that is what you want to
do..

filename=$1
filemaxwarn= $2
filemaxcritical=$3
currentsize= `ls -al $filename |sed 's/  */!/g'|cut -d! -f5`
case in  $currentsize
      (currentsize > critical )
      tell user its critical
     ;;
       (currentsize >warning)
      tell user
     ;;
      *)
      all is cool

;;
esac

but that doesnt take into affect that the file does not and the case
statement really doesnt work cause you have to put it in the right
syntax.. but.. if you spit out an exit 2 on the firs statement and a
exit 1 on the second, you should light up coreseponding critical and
warning. if you dont give an exit code at the end, if the check doesn't
work it will give an error..
but again this is sudo code just to show you it can be done..


HTH,
Kenneth Ray


Message: 2
Date: Mon, 19 Aug 2002 14:37:52 +0800
From: "Halim Saleh - IT" <halim at bankislam.com.my>
To: <nagios-users at lists.sourceforge.net>
Subject: [Nagios-users] RE:Plugin for checking file size

Hi, do anybody know how to monitor spesific file size. I need to monitor
=
*.dat file on remote NT server. Curently, I manage to monitor the HDD =
space using ./check_disk_smb . Do anybody have a good solution on this?
=
tq






-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390




More information about the Users mailing list