Data ONTAP: Controller SNMP Trap Rule

DataONTAP.Monitoring.Controller.SnmpTrap.Rule (Rule)

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.

Knowledge Base article:

Summary

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.

Resolutions

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.

Additional

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

Element properties:

TargetDataONTAP.Controller
CategoryEventCollection
EnabledTrue
Alert GenerateFalse
RemotableTrue

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource System.SnmpTrapProvider DataONTAP.SecureReference.RunAsProfile
WA WriteAction Microsoft.Windows.ScriptWriteAction DataONTAP.SecureReference.RunAsProfile

Source Code:

<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" RunAs="DS!DataONTAP.SecureReference.RunAsProfile">
<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" RunAs="DS!DataONTAP.SecureReference.RunAsProfile">
<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>
'**********************************************************************************
' Script Name - LogSnmpTrap
' Authors: Clinton Knight
'
' Description:
' Log events representing SNMP traps
'
' (c) Copyright NetApp Inc. 2011 - All rights reserved
'**********************************************************************************

Option Explicit
SetLocale("en-us")

Dim oAPI
Set oAPI = CreateObject("MOM.ScriptAPI")

Dim oArgs
Set oArgs = WScript.Arguments

Dim errorMessage
if oArgs.Count &lt; 4 Then

errorMessage = "LogSnmpTrap.vbs was called with the incorrect # of parameters (param count = " &amp; oArgs.Count &amp; ")."

'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 = " &amp; ipAddress)

Dim oNetAppSCOMAPI
Set oNetAppSCOMAPI = CreateObject("NetApp.OM.Server.Monitoring.StorageMonitoring")

If Err Then

errorMessage = "Failed to create NetAppSCOM object" &amp; vbNewLine &amp; _
"Err.description = """ &amp; Err.description &amp; """" &amp; vbNewLine &amp; _
"Err.helpcontext = """ &amp; Err.helpcontext &amp; """" &amp; vbNewLine &amp; _
"Err.helpfile = """ &amp; Err.helpfile &amp; """" &amp; vbNewLine &amp; _
"Err.number = """ &amp; Err &amp; """ (&amp;H" &amp; hex(Err) &amp; ")" &amp; vbNewLine &amp; _
"Err.source = """ &amp; Err.source &amp; """" &amp; 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" &amp; vbNewLine &amp; _
"Err.description = """ &amp; Err.description &amp; """" &amp; vbNewLine &amp; _
"Err.helpcontext = """ &amp; Err.helpcontext &amp; """" &amp; vbNewLine &amp; _
"Err.helpfile = """ &amp; Err.helpfile &amp; """" &amp; vbNewLine &amp; _
"Err.number = """ &amp; Err &amp; """ (&amp;H" &amp; hex(Err) &amp; ")" &amp; vbNewLine &amp; _
"Err.source = """ &amp; Err.source &amp; """" &amp; 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 " &amp; ipAddress &amp; ".")

Set oNetAppSCOMAPI = Nothing
Set oAPI = Nothing
</Script></ScriptBody>
<TimeoutSeconds>300</TimeoutSeconds>
</WriteAction>
</WriteActions>
</Rule>