[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [hobbit] BBWin - Monitoring size of Exchange database files
- To: "hobbit (at) hswn.dk" <hobbit (at) hswn.dk>
- Subject: RE: [hobbit] BBWin - Monitoring size of Exchange database files
- From: "Storer, Raymond" <storerr (at) nibco.com>
- Date: Mon, 24 Aug 2009 10:23:02 -0400
- Accept-language: en-US
- Acceptlanguage: en-US
- References: <5db4a99a0908211417i55528c78v60d8293f464a8e12 (at) mail.gmail.com> <EBDBC7B4393B6C4F9DDADE295309C9F2039B93 (at) EX1.nibco.com> <5db4a99a0908211726j59c94759t44494ba8672bd8c2 (at) mail.gmail.com>
- Thread-index: Acoiv0r3ZMRuaJXVQU6M5RF1bn+QoACBt3UQ
- Thread-topic: [hobbit] BBWin - Monitoring size of Exchange database files
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.