BB Unix Network Monitor - Message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: {bb} Monitoring folder size/no. of files on a Win2000 box



Oliver,

Thanks. I'll give it a try and let you know how it works out.

Mike

-----Original Message-----
From: Oliver Bassett [mailto:oliver.bassett@gen-i.co.nz]
Sent: Tuesday, April 05, 2005 10:26 PM
To: 'bb@bb4.com'
Subject: RE: {bb} Monitoring folder size/no. of files on a Win2000 box


Mike,

I thought I would quickly slap something together. Chuck the below into a
vbs script and it should do what you want.

You might need to modify the path to the reg key so it can find the folder
you are trying to check. Also this doesn't handle sub-folders and is a quick
and dirty.

Hope this helps.

Regards
Oliver Bassett


'--- Script Begins here ---
' Quick Script to check number of files
strTestName = "FileCount"
strAlarmState = "green"
strOutput   = ""
Set ws = WScript.CreateObject("WScript.Shell")
extPath = ws.RegRead("HKLM\SOFTWARE\Quest
Software\BigBrother\bbnt\ExternalPath\")

FolderToCheck = "C:\temp"
NumberOfFilesWarn = 2
NumberOfFilesAlarm = 3

set oFso = CreateObject("Scripting.FilesystemObject")

set folder = oFso.getfolder(FolderToCheck)
fc = 0
for each file in folder.files
	fc = fc + 1
next

If fc > NumberOfFilesAlarm then
	SetAlarmStatus "red"
	strOutput = strOutput & "Number of files in folder " & FolderToCheck
& " is " & fc
Elseif fc > NumberOfFilesWarn then
	SetAlarmStatus "yellow"
	strOutput = strOutput & "Number of files in folder " & FolderToCheck
& " is " & fc
Else
	SetAlarmStatus "green"
	strOutput = strOutput & "Number of files in folder " & FolderToCheck
& " is " & fc
End If

' Write the file for BB
WriteFile extPath, strTestName, strAlarmState, strOutput

 ''===========================================================
' FUNCTIONS and SUBS start here

' This is called to set the overall alarm status.
SUB SetAlarmStatus(strnewAlarmState)
    IF strnewAlarmState = "red" THEN
        strAlarmState = strnewAlarmState
    ELSEIF strnewAlarmState = "yellow" THEN
        IF strAlarmState <> "red" THEN
            strAlarmState = strnewAlarmState
        END IF
    END IF
END SUB

' This SUB is used for outputting the file to the external's directory in bb
Sub WriteFile(strExtPath, strTestName, strAlarmState, strOutput)
	Dim fso, f
    Set fso = CreateObject("Scripting.FileSystemObject")	
    strOutput = strAlarmState & " " & Date & " " & Time & vbcrlf & vbcrlf &
strOutput & vbcrlf
    Set f = fso.OpenTextFile(strExtPath & "\" & strTestName , 8 , True)
    f.Write strOutput
    f.Close
    Set fso = Nothing
End Sub 

'--- Script Ends ---

> -----Original Message-----
> From: owner-bb@bb4.com [mailto:owner-bb@bb4.com]On Behalf Of 
> Mike Morgan
> Sent: Tuesday, 5 April 2005 4:58 a.m.
> To: 'bb@bb4.com'
> Subject: RE: {bb} Monitoring folder size/no. of files on a Win2000 box
> 
> 
> Jeff,
> 
> Interesting idea. The problem is that the system "sees" the 
> newly created
> virtual drive as having the same free space as the c:drive - 
> in this case 15
> GB. I would like to be alerted when the folder/virtual drive 
> reaches 100 KB.
> Obviously it's not possible to set the red threshold so low. 
> 
> Is anybody aware of some way to assign a virtual size to a 
> virtual drive?
> 
> Mike
> 
> -----Original Message-----
> From: Jeff Stoner [mailto:leapfrog@freeshell.org]
> Sent: Sunday, April 03, 2005 3:19 PM
> To: bb@bb4.com
> Subject: Re: {bb} Monitoring folder size/no. of files on a Win2000 box
> 
> 
> On Thu, 31 Mar 2005, Mike Morgan wrote:
> 
> > I have a requirement to monitor a particular folder on one 
> of our Win2K
> > servers and to get alerts sent if the number of files in that folder
> exceeds
> > a certain threshold. Folder size in KB could also work. Can 
> someone point
> me
> 
> If folder size is sufficient then just make that folder a drive:
> 
> c:\> subst c:\program\data g:
> 
> And monitor it like any other drive.
> 
> --Jeff
> 
> "I am not available for comment"
> 
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=
> To unsubscribe from this list, or to subscribe to the bb-digest list
> send e-mail to mailto:majordomo@bb4.com with unsubscribe bb -and/or-
> subscribe bb-digest in the BODY of the message.
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=
> To unsubscribe from this list, or to subscribe to the bb-digest list
> send e-mail to mailto:majordomo@bb4.com with unsubscribe bb -and/or-
> subscribe bb-digest in the BODY of the message.
> 
> ##############################################################
> ################################################
> This e-mail message has been scanned for Viruses and content 
> and cleared by NetIQ MailMarshal at Gen-i Limited 
> ##############################################################
> ################################################
> 

****************************************************************************
*
This communication, including any attachments, is confidential.
If you are not the intended recipient, you should not read it
- please contact me immediately, destroy it, and do not copy
or use any part of this communication or disclose anything about it,
Thank you.
Please note that this communication does not designate an information system
for the purposes of the Electronic Transactions Act 2002
****************************************************************************
**
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=
To unsubscribe from this list, or to subscribe to the bb-digest list
send e-mail to mailto:majordomo@bb4.com with unsubscribe bb -and/or-
subscribe bb-digest in the BODY of the message.
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=
To unsubscribe from this list, or to subscribe to the bb-digest list
send e-mail to mailto:majordomo@bb4.com with unsubscribe bb -and/or-
subscribe bb-digest in the BODY of the message.


Home | Main Index | Thread Index