This rule accepts all SNMP traps received from Data ONTAP storage systems and logs them to the OnCommand event log for the benefit of the various trap monitors.
This rule accepts all SNMP traps received from Data ONTAP storage systems and logs them to the OnCommand event log for the benefit of the various trap monitors.
If you suspect a problem with this rule, check the OnCommand and System Center Operations Manager event logs on the management server running the rule.
Event ID | Severity | Description |
20000 | INFO | Unknown |
20001 | ERR | Emergency |
20002 | ERR | Alert |
20003 | ERR | Critical |
20004 | ERR | Error |
20005 | WARN | Warning |
20006 | INFO | Notification |
20007 | INFO | Information |
20008 | INFO | Debug |
Target | DataONTAP.Controller |
Category | EventCollection |
Enabled | True |
Alert Generate | False |
Remotable | True |
ID | Module Type | TypeId | RunAs |
---|---|---|---|
DS | DataSource | System.SnmpTrapProvider | Default |
WA | WriteAction | Microsoft.Windows.ScriptWriteAction | Default |
<Rule ID="DataONTAP.Monitoring.Controller.SnmpTrap.Rule" Enabled="true" Target="DataONTAP.Controller" ConfirmDelivery="true" Remotable="true" Priority="Normal" DiscardLevel="100">
<Category>EventCollection</Category>
<DataSources>
<DataSource ID="DS" TypeID="Snmp!System.SnmpTrapProvider">
<IP>$Target/Property[Type="DataONTAP.Controller"]/ipAddress$</IP>
<CommunityString>$Target/Property[Type="DataONTAP.Controller"]/snmpCommunity$</CommunityString>
<AllTraps>true</AllTraps>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="WA" TypeID="Windows!Microsoft.Windows.ScriptWriteAction">
<ScriptName>LogSnmpTrap.vbs</ScriptName>
<Arguments>$Target/Property[Type="DataONTAP.Controller"]/ipAddress$ $Target/Property[Type="DataONTAP.Controller"]/name$ $Data/SnmpVarBinds/SnmpVarBind[OID='1.3.6.1.6.3.1.1.4.1.0'][1]/Value$ "$Data/SnmpVarBinds/SnmpVarBind[OID='1.3.6.1.4.1.789.1.1.12.0'][1]/Value$"</Arguments>
<ScriptBody> '**********************************************************************************
' Script Name - LogSnmpTrap
' Authors: Clinton Knight
'
' Description:
' Log events representing SNMP traps
'
' (c) Copyright NetApp Inc. 2011 - All rights reserved
'**********************************************************************************
Option Explicit
Dim oAPI
Set oAPI = CreateObject("MOM.ScriptAPI")
Dim oArgs
Set oArgs = WScript.Arguments
Dim errorMessage
if oArgs.Count < 4 Then
errorMessage = "LogSnmpTrap.vbs was called with the incorrect # of parameters (param count = " & oArgs.Count & ")."
'WScript.Echo(errorMessage)
Call oAPI.LogScriptEvent("LogSnmpTrap.vbs",1201,0,errorMessage)
Wscript.Quit -1
End If
Dim ipAddress, filerName, trapOID, trapMessage
ipAddress = oArgs(0)
filerName = oArgs(1)
trapOID = oArgs(2)
trapMessage = oArgs(3)
' Echo the parameters so we can see what has been passed in
'WScript.Echo("Address = " & ipAddress)
Dim oNetAppSCOMAPI
Set oNetAppSCOMAPI = CreateObject("NetApp.OM.Server.Monitoring.StorageMonitoring")
If Err Then
errorMessage = "Failed to create NetAppSCOM object" & vbNewLine & _
"Err.description = """ & Err.description & """" & vbNewLine & _
"Err.helpcontext = """ & Err.helpcontext & """" & vbNewLine & _
"Err.helpfile = """ & Err.helpfile & """" & vbNewLine & _
"Err.number = """ & Err & """ (&H" & hex(Err) & ")" & vbNewLine & _
"Err.source = """ & Err.source & """" & vbNewLine
'WScript.Echo(errorMessage)
Call oAPI.LogScriptEvent("LogSnmpTrap.vbs",1202,0,errorMessage)
WScript.Quit -1
End If
Dim boolSucceeded
boolSucceeded = oNetAppSCOMAPI.LogControllerTrap(ipAddress, filerName, trapOID, trapMessage)
If Err Then
errorMessage = "Failed to log trap" & vbNewLine & _
"Err.description = """ & Err.description & """" & vbNewLine & _
"Err.helpcontext = """ & Err.helpcontext & """" & vbNewLine & _
"Err.helpfile = """ & Err.helpfile & """" & vbNewLine & _
"Err.number = """ & Err & """ (&H" & hex(Err) & ")" & vbNewLine & _
"Err.source = """ & Err.source & """" & vbNewLine
'WScript.Echo(errorMessage)
Call oAPI.LogScriptEvent("LogSnmpTrap.vbs",1203,0,errorMessage)
WScript.Quit -1
End If
Call oAPI.LogScriptEvent("LogSnmpTrap.vbs",1204,0,"Trap successfully logged for " & ipAddress & ".")
Set oNetAppSCOMAPI = Nothing
Set oAPI = Nothing </ScriptBody>
<TimeoutSeconds>300</TimeoutSeconds>
</WriteAction>
</WriteActions>
</Rule>