[hobbit] BBWin - Monitoring size of Exchange database files
Thomas Leavitt
thomleavitt at gmail.com
Sat Aug 29 04:41:01 CEST 2009
Note (half an hour of frustration later):
First, I forget that you need to specify the script in the <externals>
</externals> section of BBWin.cfg. Doh. Suggest that Ray put a note to
that effect in the comments section of his script to help remind folks
who haven't done this in a while (me) or are first timers.
Then, it seems that simply calling cscript fsize.vbs (filename I gave
it) does not work. The full path to the program appears to need to be
specified, i.e. "cscript C:\Program Files\BBWin\ext\fsize.vbs". I
suspect that this is because simply invoking "cscript filename.vbs"
causes cscript to be executed in a working directory other than the
"ext" directory. Is this a bug? Saw someone else say that full pathing
a call to the cluster.exe script fixed their problem.
Trying cscript on the command line, it appears to gack on there being
a space in "Program Files" unless you enclose the supplied path in
quotes... which I'm not sure how to do inside the BBWin.cfg file.
So I had to create a "C:\BBWin\ext" directory and drop the script in
there, and it works. ... any way to get around this?
Thomas
On Mon, Aug 24, 2009 at 7:23 AM, Storer, Raymond<storerr at nibco.com> wrote:
> Thomas, you can try the code someone else pointed to at deadcat and you can also try this:
>
> Ray
>
> 'Author: Ray Storer
> 'Date: 2009-08-24
> 'Purpose: Check file size and existence
>
> Option Explicit
>
> 'If you want to use the registry to find this, feel free to change this.
> Const BBWIN_TMP_DIR = "C:\Program Files\BBWin\tmp\" 'change to meet your environment, but leave the trailing backslash
> Const BBWIN_TEST_NAME = "fsize" 'change to meet your requirements
>
> 'If you want to use the environment variables feel free to change this.
> Const HOST_NAME = "YOUR_MACHINE_NAME" 'change to meet your environment
>
> '16 gigabytes
> Const MAX_TOTAL_FILE_SIZE = 17179869184 'change to meet your requirements
> Dim RED_FILE_SIZE
> RED_FILE_SIZE = MAX_TOTAL_FILE_SIZE * 0.85 'change to meet your requirements
> Dim YELLOW_FILE_SIZE
> YELLOW_FILE_SIZE = MAX_TOTAL_FILE_SIZE * 0.70 'change to meet your requirements
>
> 'change the arrFiles(1) to the number of elements (files) you need minus 1.
> Dim oFso, arrFiles(1), strStatus, oFile, iSumFileSize, strRedGreen, strFileInfo
> iSumFileSize = 0
> strRedGreen = "GREEN"
> Set oFso = CreateObject("Scripting.FileSystemObject")
>
> 'change to meet your environment
> arrFiles(0) = "C:\Program Files\BBWin\bin\cpu.dll"
> arrFiles(1) = "C:\Program Files\BBWin\bin\disk.dll"
> 'keep adding arrFiles(...) here if you need more
> strStatus = ""
> strFileInfo = ""
>
> 'get the file sizes and set red if they do not exist
> Dim sFile
> for each sFile in arrFiles
> if (oFso.FileExists(sFile)) then
> Set oFile = oFso.GetFile(sFile)
> strFileInfo = strFileInfo & vbcrlf & sFile & vbtab & CStr(oFile.Size)
> iSumFileSize = iSumFileSize + oFile.Size
> else
> strRedGreen = "RED"
> if (len(strStatus) = 0) then
> strStatus = strRedGreen & " " & HOST_NAME & " " & CStr(Now())
> strStatus = strStatus & VbCrLf
> strStatus = strStatus & " " & sFile & " file does not exist."
> else
> strStatus = strStatus & " " & sFile & " file does not exist."
> end if 'check len of strStatus
> end if 'check for file existence
> next 'iterate over the files
>
> 'set red,yellow,green based on file sizes
> if (iSumFileSize >= RED_FILE_SIZE) then
> strRedGreen = "RED"
> else
> if (iSumFileSize >= YELLOW_FILE_SIZE) then
> if (strRedGreen <> "RED") then
> strRedGreen = "YELLOW"
> end if
> else
> if (strRedGreen <> "RED") then
> strRedGreen = "GREEN"
> end if
> end if
> end if
>
> if (len(strStatus) = 0) then
> strStatus = strRedGreen & " " & HOST_NAME & " " & CStr(Now())
> strStatus = strStatus & vbcrlf
> strStatus = strStatus & strFileInfo
> strStatus = strStatus & vbcrlf
> strStatus = strStatus & "Total File Size: " & CStr(iSumFileSize)
> else
> strStatus = strStatus & vbcrlf
> strStatus = strStatus & strFileInfo
> strStatus = strStatus & vbcrlf
> strStatus = strStatus & "Total File Size: " & CStr(iSumFileSize)
> end if
>
> Set oFile = ofso.CreateTextFile(BBWIN_TMP_DIR & BBWIN_TEST_NAME, true)
> oFile.WriteLine(strStatus)
> oFile.Close
>
> Set oFile = Nothing
> Set oFso = Nothing
>
> CONFIDENTIALITY NOTICE: This email and any attachments are for the
> exclusive and confidential use of the intended recipient. If you are not
> the intended recipient, please do not read, distribute or take action in
> reliance upon this message. If you have received this in error, please
> notify us immediately by return email and promptly delete this message
> and its attachments from your computer system. We do not waive
> attorney-client or work product privilege by the transmission of this
> message.
>
>
> To unsubscribe from the hobbit list, send an e-mail to
> hobbit-unsubscribe at hswn.dk
>
>
>
More information about the Xymon
mailing list