Dim oBag
Dim oArgs
Dim oArg1
Dim LoopCount
Dim Iterator
Dim DescData
Dim strDetails
Dim oAPI
Dim tmpArr1(50)
Dim tmpArr2(25)
Dim tmpArr3(25)
Dim intT1, intT2, intT3, strT1, intT4, strT2
Dim intT5, intT6
Function DebugMsg(TextMsg)
Dim strText
Dim systemDrive
Dim tempFilePath
Dim wshShell
Dim CurrentDateTime
Dim NumArgs
Dim severity
Dim sevDesc
Set objShell = CreateObject("Wscript.Shell")
Const PROGRAM_FILES = &H26&
strSystemDrive = objShell.ExpandEnvironmentStrings("%SystemDrive%")
strtestFilePath = strSystemDrive & "\Program Files (x86)\"
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(strtestFilePath) Then
win64 = false
test = "32bit"
Else
win64 = true
test = "64bit"
End If
if win64 then
strRegistryKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Hewlett-Packard\HP Storage Management Pack for System Center\InstallPath"
else
strRegistryKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Hewlett-Packard\HP Storage Management Pack for System Center\InstallPath"
end if
Set WSHShell = CreateObject("WScript.Shell")
strInstallDir = WSHShell.RegRead( strRegistryKey )
CurrentDate = Now
strText = "DebugMsg: " & FormatDateTime(CurrentDate, 0) & ":" & TextMsg
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Shell.Application")
Set wshshell = CreateObject("WScript.Shell")
systemDrive = wshshell.ExpandEnvironmentStrings("%SystemDrive%")
tempFilePath = strInstallDir + "\HPE3ParStoreServ.log"
Set objTextFile = objFSO.OpenTextFile(tempFilePath, 8, True)
objTextFile.WriteLine(strText)
objTextFile.Close
End Function
Function HexStrToAscii(var_hex, format)
Dim k, v
HexStrToAscii = ""
For k = 1 To Len(var_hex) Step 2
v = CInt("&H" & Mid(var_hex, k, 2))
If ((v>31) And (v<128)) Then
HexStrToAscii = HexStrToAscii & (chr(v))
Else
If (format) Then
Select Case v
Case 8
HexStrToAscii = HexStrToAscii & vbTab
Case 10
HexStrToAscii = HexStrToAscii & vbCrLf
Case 13
Case Else
HexStrToAscii = HexStrToAscii & "."
End Select
Else
HexStrToAscii = HexStrToAscii & "."
End If
End If
Next
End Function
For intT2 = 0 to intT1
If(tmpArr2(intT2) = "") Then
t = 0
Else
if(tmpArr2(intT2) = "Details") then
strDet = HexStrToAscii(tmpArr3(intT2),true)
desc = desc & vbLf & tmpArr2(intT2) & ": " & strDet
Call oBag.AddValue(tmpArr2(intT2), strDet)
else
desc = desc & vbLf & tmpArr2(intT2) & ": " & tmpArr3(intT2)
Call oBag.AddValue(tmpArr2(intT2), tmpArr3(intT2))
end if
End If
Next
For i = 0 To oArgs.Count
if oArgs(i) = "key:Severity" then
j = i
j = j + 1
sevDesc = oArgs(j)
exit for
end if
Next
If sevDesc = "critical" Then
severity = EVENT_TYPE_ERROR
ElseIf sevDesc = "major" Then
severity = EVENT_TYPE_WARNING
ElseIf sevDesc = "degraded" Then
severity = EVENT_TYPE_ERROR
ElseIf sevDesc = "info" Then
severity = EVENT_TYPE_INFORMATION
ElseIf sevDesc = "fatal" Then
severity = EVENT_TYPE_ERROR
ElseIf sevDesc = "minor" Then
severity = EVENT_TYPE_WARNING
End If
DebugMsg(desc)
if(severity = EVENT_TYPE_WARNING) then
Call oAPI.LogScriptEvent("", 102, severity, desc)
end if
if(severity = EVENT_TYPE_ERROR) then
Call oAPI.LogScriptEvent("", 102, severity, desc)
end if
Call oBag.AddValue("EventLevel", severity)
Call oAPI.AddItem(oBag)
set oBag = nothing
Call oAPI.ReturnItems() </Script></ScriptBody>
<TimeoutSeconds>60</TimeoutSeconds>
</ProbeAction>
<ConditionDetection ID="AlertNotifyMapper" TypeID="SystemLibrary!System.Event.GenericDataMapper">
<EventOriginId>$Target/Id$</EventOriginId>
<PublisherId>$MPElement$</PublisherId>
<PublisherName>HPE 3PAR & Primera Storage</PublisherName>
<Channel>Operation Manager</Channel>
<LoggingComputer>$Target/Property[Type="HPEnterpriseStorage3PARMP.SNMPTrap"]/Name$</LoggingComputer>
<EventNumber>52000</EventNumber>
<EventCategory>0</EventCategory>
<EventLevel>$Data/Property[@Name='EventLevel']$</EventLevel>
<UserName>Administrator</UserName>
<Description>A System event generated.</Description>
<Params/>
</ConditionDetection>
</MemberModules>
<Composition>
<Node ID="AlertNotifyMapper">
<Node ID="3PARAlertNotifyPropertyBagProbe">
<Node ID="3PARNotify"/>
</Node>
</Node>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>SystemLibrary!System.Event.Data</OutputType>
</DataSourceModuleType>