checking Win2k file shares

Tom DE BLENDE tdeblend at gcc.dhl.com
Fri Sep 20 09:51:48 CEST 2002


This is what I use to check a clustered file system that very rarely
crashes. It's still available then, and everything in the root is
visible, but nothing is in the subdirectories. You can use the same
script for your checks, I guess. Provide the sharename as argument.

**************************************************************************************************************

#!/bin/bash

share=$1

sudo /bin/umount /mnt/$share -f &>/dev/null
/bin/mount /mnt/$share &>/dev/null

count=`ls /mnt/$share/subdir | wc -l`

if [ ! "$count" -eq "0" ]; then
                exit="0" && stdio="OK - directory listing succeeded.";
else
        exit="2" && stdio="Could not list directory contents. $share
is not available."
fi

sudo /bin/umount /mnt/$share/ -f &>/dev/null

echo $stdio
exit $exit

**************************************************************************************************************

Make sure your nagios account is in the sudoers file for umount. I did
the umounts with the netsaint account at first, but in rare occasions
the umount failed and could only be done with root previliges. Also
mak sure that the fileshares are in your /etc/fstab like this:

//server/share            /mnt/mountpoint            smbfs  
noauto,user,username=<username>,password=<password>,workgroup=<workgroup
or damain>   0 0

If I'm making no sense to you, then just tell me :-)

Good luck,
Tom

Greg Vickers wrote:
> 
> Hi all,
> I was wondering what mechanisms people out there may have implemented to
> check the existence of file shares on win2k servers?
> I want to check that the share is still available from our Lab servers.
> This directory is the same across 10 servers, with the same access permissions.
> It's a logon directory, accessible from the lab machines with the default
> logon user, which doesn't have a password (we use a secondary mechanism for
> allowing access, not NT authentication.)
> 
> I'm having a play with smbclient, but can't seem to connect to the share
> from my nagios server.
> 
> How could I check for the existence of this share?
> 
> TIA,
> 
> =================================
> Greg Vickers
> Computer Systems Officer
> Student Support and Systems
> Teaching and Learning Support Systems, QUT
> Kelvin Grove Campus, CRICOS No 00213J
> 
> Ph: 07 3864 8276 Fax: 07 3864 5425
> Mob: 0416 001 674 SD: x6147
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users

-- 
Tom De Blende
Senior NT Infrastructure Analyst (Frango)
DHL Global Coordination Center - IT Department
Tel +32 2 713 42 62        
Fax +32 2 713 52 00


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf




More information about the Users mailing list