sql server 2005 database health script noise…

out of the box, the sql server 2005 db health script is amazingly noisy.  here’s a description of a sample event that you don’t need to see (unless you report on them).

The database myDatabase in instance myInstance is in a healthy state.

 

aside from reporting on the value, you probably don’t care.  if you want to make this events stop for normal database state, you’ll need to modify the script sql server 2005 database health.

 

to begin with, look for this line:

Public Function CheckDBHealth(sInstance, sHighSevDatabases)

 

if you search far enough down (around line 2400), you’ll see a block of code that looks like the following:

Set objEvent = ScriptContext.CreateEvent()
objEvent.EventSource = SCRIPT_NAME
objEvent.EventNumber = iEventId
objEvent.EventType = iEventType
objEvent.Message = message
objEvent.SetEventParameter(sInstance)
objEvent.SetEventParameter(oDatabase.Name)        
objEvent.SetEventParameter(sState)
ScriptContext.Submit objEvent

 

to quiet down the script, we just need to put some logic around the block.  in order to do this, we’ll add a simple if/then that checks against the already defined boolean variable bDatabaseHealthy.  If it’s false, then we’ll write the event.  If not, we’ll just quietly let it ride… here’s the how the new block should look:

If Not bDatabaseHealthy Then
    Set objEvent = ScriptContext.CreateEvent()
    objEvent.EventSource = SCRIPT_NAME
    objEvent.EventNumber = iEventId
    objEvent.EventType = iEventType
    objEvent.Message = message
    objEvent.SetEventParameter(sInstance)
    objEvent.SetEventParameter(oDatabase.Name)        
    objEvent.SetEventParameter(sState)
    ScriptContext.Submit objEvent
End If

 

wow, at some point, i need to start blogging on opsmgr.  :/

Comments

  1. I kept getting these "10510" events when I ran "Most Common Event" queries, and finally found the source. I had just disabled the rule rather than attempt to decode the script, but it cut the number of events in half for us. I've added your change to the VBScript. Thanks for a great catch.

    ReplyDelete

Post a Comment