This week I’m having a MP Authoring Workshop from Brian Wren in the UK and one of the modules of this workshop is Discovery.

And to my surprise Kevin Holman published a blog post on Basic troubleshooting of discovery script yesterday. It’s a good start but I’ve some more help on troubleshooting a Discovery script.

Here are mine (with some help of Brian):

  1. Verify that MP has been committed on agent
  2. Check agent for eventlog errors
  3. Check management server for errors
  4. Verify that discovery is running
  5. Enable debug events in script
  6. Debug script on agent

 

Step 1. Verify that MP has been committed on agent.
How?
There are several ways. One of them is looking in the OpsMgr eventlog for EventId 1201.

Step 2. Check for agent errors.
How?
Check for OpsMgr EventId’s like 31876 or 21405 or other Health Service Module source errors.

Step 3. Check for management server errors
How?
Check for OpsMgr EventId’s 10801

Step 4. Verify that discovery is running

How?
You can look for your discovery script in the C:\Program Files\System Center Operations Manager 2007\Health Service State\ subdirectories with the next command:
dir /B /S mycooldiscovery.vbs

Did you found it? I hope so;-) More info here. Now you can use Process Monitor from SystInternals to monitor your cscript vb discovery script. For more info on how to use Process Monitor go to Jeevan Bish’s blog.

Step 5. Enable debug events in script.
How?
You can add a debug function to you discovery script that writes info the eventlog using oAPI.LogScriptEvent in your discovery script. For more info on using oAPI.LogScriptEvent take a look at MSDN.

Step 6. Debug script on Agent.
How?
See Kevin’s post on how to do this. You can alslo take a look at Brian Wren’s Demo Store App Management on OpsManJam for an LogDebugEvent Function.

'

'==================================================================================
' Sub:        LogDebugEvent
' Purpose:    Logs an informational event to the Operations Manager event log
'            only if Debug argument is true
'==================================================================================
Sub LogDebugEvent(EventNo,Message)

    Message = VbCrLf & Message
    If bDebug = True Then
        Call oAPI.LogScriptEvent(SCRIPT_NAME,EventNo,EVENT_LEVEL_INFO,Message)
    End If
End Sub


More blogposts on MP Authoring after this week of MP Authoring training.