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

Re: [hobbit] MS SQL Monitoring on Windows 2003 64-bit



On Fri, Mar 26, 2010 at 00:55, doctor (at) makelofine.org
<doctor (at) makelofine.org> wrote:
> On Thu, 25 Mar 2010 11:38:07 +0100, "Gillis Bart" <Bart.Gillis (at) cegeka.be>
> wrote:
>> Hi,
>>
>> I've adapter the bbsql-server script from deadcat.net so that it is
>> working with the BBWin agent.
[snip]
>> I still have to implement some alerting on those statistics but the
> script
>> works fine on MSSQL 2000 and up.
>> It works on both 32 and 64 bit architecture.
>>
>> I will paste it on xymonton

Ah, I should probably send this publicly...

There was an error when I ran this. Each server I've run this on claim
to have no jobs, so the file for CheckJobStats was never created.

The following code, around line 122, "fixes" it. You can see that it
only opens the file if it exists, then deletes immediately after
reading instead of after the variable assignment. It could be
simplified by always setting tmpStr to No Job History, then replace it
with f.ReadAll as needed.

There are a few other minor improvements that could be made (e.g.
change <td> to <th> in table head; maybe remove <br> from within
tables since it doesn't seem to serve any purpose).

Loop
if fso.FileExists(strFilePath & "\" & tempfilename) then
       Set f = fso.OpenTextFile(strFilePath & "\" & tempfilename ,1 )
               If Not f.AtEndOfLine Then
                       tmpStr = f.ReadAll
               Else
                       tmpStr = "              No Job History. " & vbcrlf
               End If
       f.Close
       fso.DeleteFile strFilePath & "\" & tempfilename
else
       tmpStr = "              No Job History. " & vbcrlf
end if