Monitoring SMB shares?

Andreas Ericsson ae at op5.se
Tue Oct 5 09:14:02 CEST 2004


Stanley Hopcroft wrote:
> Dear Sir,
> 
> I am writing to thank you for your letter and say,
> 
> On Mon, Oct 04, 2004 at 08:46:05PM -0700, nagios-users-request at lists.sourceforge.net wrote:
> 
>>Message: 1
>>Date: Tue, 5 Oct 2004 10:57:52 +0800
>>From: nagios at mm.quex.org
>>To: nagios-users at lists.sourceforge.net
>>Subject: Re: [Nagios-users] Monitoring SMB shares?
>>
>>On Mon, Oct 04, 2004 at 10:24:45AM +0200, Xavier wrote:
>>
>>
>>>After a undetected incident this weekend, our management asked to
>>>monitor something special:
>>>
>>>A windows client copies files to a SMB share (W2K server).
>>>Once processed by another application, files are removed.
>>>The client is a "blackbox" for us, so we would like to be notified
>>>when no new files are stored on the share.
>>>
>>>Question: how? Possible?
>>
> 
>  .. snip ...
> 
>  Yes this is possible and even easy with the caveats noted below.
> 
> Prob the way to go is via a language that supports access to 
> libsmbclient (such as Perl via a CPAN module whose name escapes me; 
> other languages such as Python prob have bindings too). This lets you 
> perform the SMB equivalent of a stat() (it may even be called that in 
> the Perl module) on an exported  file or directory.
> 

I'd say the easiest way to go is to simply mount the disk read-only from 
the monitoring server. Then write the 30 or so lines of C-code to parse 
the directory, read the filemtime and check if none of the files is 
fresh enough. Return warning or critical accordingly. It's simplicity 
itself when done in C, so there's really no need to involve any slower 
language.

> That said, I am not sure if there is a libsmbclient shared object that 
> handles the extra requirements of 2kn or XP.
> 
> 
>>bit of scripting.  The only issue I think you're likely to run
>>into is if the server requires encrypted connections.  Our 2k3
>>domain controllers require this so I can't connect to them from
>>the Linux machines, but the 2k3 workstations are fine.  I did
>>read somewhere about the CIFS driver supporting this stuff.
>>
> 
> 
> You need support for kerberos authentication in your client for this to 
> work (plus you need all the parephenalia [machine accounts] set up).
> 
> smbclient from Samba 3.0 has this, but I haven't got it going. There is 
> quite a bit of Kerb stuff to get ones head around.
> 
> 
>>You could also mount the share using smbfs or cifs, and then
>>just check the files with ls or expand a shell glob.
>>
>>
> 
> 
> Provided these file systems support 2k3 etc.
> 
> 
>>--__--__--
>>
>>_______________________________________________
>>Nagios-users mailing list
>>Nagios-users at lists.sourceforge.net
>>https://lists.sourceforge.net/lists/listinfo/nagios-users
>>
>>
>>End of Nagios-users Digest
> 
> 
> Yours sincerely.
> 

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Lead Developer


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list