我在使用 SCOM 时遇到了一些问题。我创建了下面的脚本来监控应用程序。当脚本运行时,它会在事件日志中创建一个条目,并且我已经为运行监视器的特定组配置了警报。
我没有正确创建脚本是我的问题吗?
这是我更改为时遇到的oAPI.Return(oBag)
错误oAPI.ReturnItems
下午 2:24:23 开始的进程未能创建 System.PropertyBagData。在输出中发现错误:
C:\Program Files\System Center Operations Manager\Agent\Health Service State\Monitoring Host Temporary Files 84\29451\voxwareMonitor.vbs(33, 2) Microsoft VBScript 运行时错误:无效的过程调用或参数
Dim proc, serv, oArgs, oAPI, oBag
sComputerName = "."
Set objWMIService = GetObject("winmgmts:\\" & sComputerName & "\root\cimv2")
sQueryPro = "SELECT * FROM Win32_Process"
sQuerySer = "SELECT * FROM Win32_Service"
Set objProcs = objWMIService.ExecQuery(sQueryPro)
Set objServ = objWMIService.ExecQuery(sQuerySer)
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()
For Each objItem In objProcs
If objItem.Name = "javaw.exe" Then
proc = True
End If
Next
For Each objS In objServ
If objS.Name = "vlsoperatorconsole_voxwarevls" Then
serv = True
End If
Next
If proc = True And serv = True Then
Call oBag.AddValue("Service", "Running")
Call oBag.AddValue("Process", "Running")
oAPI.LogScriptEvent "Voxware Monitor", 411, 0, "Application and Services are running"
Call oAPI.Return(oBag)
Else
If proc = False Then
Call oBag.AddValue("Process", "Stopped")
oAPI.LogScriptEvent "Voxware Monitor", 911, 1, "Process has stopped"
Call oAPI.Return(oBag)
End If
If serv = False Then
Call oBag.AddValue("Service", "Stopped")
oAPI.LogScriptEvent "Voxware Monitor", 911, 1, "Service has stopped"
Call oAPI.Return(oBag)
End If
End If