NFS mount point monitoring script | Unix Linux Forums | AIX

  Go Back    


AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

NFS mount point monitoring script

AIX


Tags
aix, unix

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-30-2009
elmesy elmesy is offline
Registered User
 
Join Date: Jan 2009
Last Activity: 20 April 2014, 4:47 AM EDT
Posts: 28
Thanks: 1
Thanked 0 Times in 0 Posts
NFS mount point monitoring script

Hi,

I'm looking to create a NFS mount point monitoring shell script not sure if im going the right way about it so could do with some help. What i was thinking of doing was using the below command but am unsure how to handle the output. So if the filesyetem is active it will return "1" but if is not active It will return "0" how do I then handle the output from the below command in a shell script?


df -k | grep test | grep -v grep | wc -l

Thanks,
Sponsored Links
    #2  
Old 06-30-2009
DukeNuke2's Avatar
DukeNuke2 DukeNuke2 is offline Forum Staff  
Soulman
 
Join Date: Jul 2006
Last Activity: 21 August 2014, 4:38 PM EDT
Location: Berlin, Germany
Posts: 5,390
Thanks: 54
Thanked 229 Times in 222 Posts
forward the output of the df -k command to /dev/null and ask for the exit status of the command...


Code:
df -k | grep test | grep -v grep > /dev/null
echo $?

the output should be a "1" or "0" depending if "test" is present!
Sponsored Links
    #3  
Old 06-30-2009
funksen funksen is offline Forum Advisor  
Registered User
 
Join Date: Nov 2006
Last Activity: 30 April 2014, 10:11 AM EDT
Location: Austria/Vienna
Posts: 675
Thanks: 21
Thanked 31 Times in 30 Posts
we monitor nfs-filesystems simply with a file nfs.txt on each share

if the file is readable the share must be ok
    #4  
Old 06-30-2009
DukeNuke2's Avatar
DukeNuke2 DukeNuke2 is offline Forum Staff  
Soulman
 
Join Date: Jul 2006
Last Activity: 21 August 2014, 4:38 PM EDT
Location: Berlin, Germany
Posts: 5,390
Thanks: 54
Thanked 229 Times in 222 Posts
something like this is a good practice... create a file on a share, check the file (write to it...) and delete it afterwards... if all of this works, the share should be good.
Sponsored Links
    #5  
Old 06-30-2009
elmesy elmesy is offline
Registered User
 
Join Date: Jan 2009
Last Activity: 20 April 2014, 4:47 AM EDT
Posts: 28
Thanks: 1
Thanked 0 Times in 0 Posts
Thanks for the replies, I have just gone with this for now.

HOSTNM=`hostname`
DATE=$(date +"%d-%b-%y %H:%M")
SHORTNAME="FileSystem Mount"
LONGNAME="Filesystem Test"

#Checking Filesytem Test

df -k | grep Test
if [ $? == "1" ]
then

echo $LONGNAME is not running on $HOSTNM please investigate. Sent by myscript $DATE | mail -s "$SHORTNAME is not accessible" you@domain.com"

fi
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Mount point options Sunguy222 UNIX for Advanced & Expert Users 1 04-24-2008 06:23 PM
ssh with shared mount point devjxh Solaris 4 11-30-2007 07:54 AM
auto mount point legato UNIX for Dummies Questions & Answers 1 02-15-2005 03:11 PM
mount point colesy UNIX for Dummies Questions & Answers 1 01-06-2004 06:03 AM
sdX to mount point mapping marist89 UNIX for Dummies Questions & Answers 2 10-24-2001 07:06 PM



All times are GMT -4. The time now is 01:54 AM.