Active IQ Unified Manager Discussions
Active IQ Unified Manager Discussions
Hello,
IHAC who wants to send snmp trap in some points of a workflow.
I'm trying to find the best way to integrate that.
Suggestions and examples are very welcome.
Thank you in advance!!!
Solved! See The Solution
Luciano,
This is one of the more tricky requirements I've dealt with. I believe you'll have a WFA command which will send SNMP traps on certain conditions if occure. The code to send SNMP trap is given here. Rest you should figure out yourself. Had a lot of headache to get this working.
You need the following:
1. You need an SNMP Assembly DLL for .NET. You can get it from http://sharpsnmplib.codeplex.com/releases . Extract it in some location. It has many files bundled as a complete package, but for SNMP you only need SharpSnmpLib.dll . Thre are others options too, but I'm not looking to list them all.
2. You need Powershell 3.0. for my code to work. WFA is supported on Powershell 3.0 and I suggest you get it if you haven't. Win 2012 onwadrs have it by default. Posh3.0 beats 2.0 just in terms of sheer strenght of what it can do. Upgrade if you havn't.
3. To verify the Trap received, you can use some trap receiver like : Trap Receiver GUI : http://www.trapreceiver.com/downloads/TrapReceiver810.zip . Or there are multiuple other ways too. I leave this choice to you.
4. Below is the code. Modify the SNMP Destination $Dhost and DLL locations as per yours. Also attaching the code in .TXT file format.
5. Some documentation is available here: http://sharpsnmplib.codeplex.com/wikipage?title=An%20introduction&referringTitle=Documentation .
----
##Begin Code
[reflection.assembly]::LoadFrom("C:\Users\sinhaa\Downloads\tritonmate_8.0_bin\SharpSnmpLib.dll")
$DHost="10.226.179.161"
$manager = [system.Net.Dns]::Resolve( $DHost ).AddressList[0]
$TrapDest = New-Object Net.IPEndPoint( $manager, 162 )
[IPAddress]$Sender = (gwmi Win32_NetworkAdapterConfiguration | ? { $_.IPAddress -ne $null }).ipaddress[0]
#Send SNMP V1 Trap
$v1GenObj = New-Object "System.Collections.Generic.List``1[Lextm.SharpSnmpLib.Variable]"
[Lextm.SharpSnmpLib.Messaging.Messenger]::SendTrapV1( $TrapDest,$Sender,[Lextm.SharpSnmpLib.OctetString]"public",[Lextm.SharpSnmpLib.ObjectIdentifier]".1.3.6.1.2.1.1.5.0",[Lextm.SharpSnmpLib.GenericCode]::ColdStart,0,0,$v1GenObj)
#Send SNMP V2 Trap
$v2GenObj = New-Object "System.Collections.Generic.List``1[Lextm.SharpSnmpLib.Variable]"
[Lextm.SharpSnmpLib.Messaging.Messenger]::SendTrapV2( 0, [Lextm.SharpSnmpLib.VersionCode]"v2", $TrapDest,[Lextm.SharpSnmpLib.OctetString]"public",[Lextm.SharpSnmpLib.ObjectIdentifier]"1.3.6.2.9.8",0,$v2GenObj)
##End Code
sinhaa
You have written opposite requirements in your Topic heading and in the content. Send SNMP in heading and then receive SNMP in the content. What is the actual requirement? WFA can send SNMP traps on workflow execution events like workflow execution started, Waiting for Approval, Execution failed, execution completed.
If you want your workflow to send SNMP traps as a part of command execution, you can create a PoSH/Perl command to generate this trap and send it.
If you want your workflow to execute based on a SNMP trap received, you can create a command of type: wait for condition which will wait in execution stage till the configured SNMP trap is received or the time-out occures.
I can give you a code, but first please clarify your requirement.
I just updated content.
I want my workflow to send snmp trap.
Luciano,
This is one of the more tricky requirements I've dealt with. I believe you'll have a WFA command which will send SNMP traps on certain conditions if occure. The code to send SNMP trap is given here. Rest you should figure out yourself. Had a lot of headache to get this working.
You need the following:
1. You need an SNMP Assembly DLL for .NET. You can get it from http://sharpsnmplib.codeplex.com/releases . Extract it in some location. It has many files bundled as a complete package, but for SNMP you only need SharpSnmpLib.dll . Thre are others options too, but I'm not looking to list them all.
2. You need Powershell 3.0. for my code to work. WFA is supported on Powershell 3.0 and I suggest you get it if you haven't. Win 2012 onwadrs have it by default. Posh3.0 beats 2.0 just in terms of sheer strenght of what it can do. Upgrade if you havn't.
3. To verify the Trap received, you can use some trap receiver like : Trap Receiver GUI : http://www.trapreceiver.com/downloads/TrapReceiver810.zip . Or there are multiuple other ways too. I leave this choice to you.
4. Below is the code. Modify the SNMP Destination $Dhost and DLL locations as per yours. Also attaching the code in .TXT file format.
5. Some documentation is available here: http://sharpsnmplib.codeplex.com/wikipage?title=An%20introduction&referringTitle=Documentation .
----
##Begin Code
[reflection.assembly]::LoadFrom("C:\Users\sinhaa\Downloads\tritonmate_8.0_bin\SharpSnmpLib.dll")
$DHost="10.226.179.161"
$manager = [system.Net.Dns]::Resolve( $DHost ).AddressList[0]
$TrapDest = New-Object Net.IPEndPoint( $manager, 162 )
[IPAddress]$Sender = (gwmi Win32_NetworkAdapterConfiguration | ? { $_.IPAddress -ne $null }).ipaddress[0]
#Send SNMP V1 Trap
$v1GenObj = New-Object "System.Collections.Generic.List``1[Lextm.SharpSnmpLib.Variable]"
[Lextm.SharpSnmpLib.Messaging.Messenger]::SendTrapV1( $TrapDest,$Sender,[Lextm.SharpSnmpLib.OctetString]"public",[Lextm.SharpSnmpLib.ObjectIdentifier]".1.3.6.1.2.1.1.5.0",[Lextm.SharpSnmpLib.GenericCode]::ColdStart,0,0,$v1GenObj)
#Send SNMP V2 Trap
$v2GenObj = New-Object "System.Collections.Generic.List``1[Lextm.SharpSnmpLib.Variable]"
[Lextm.SharpSnmpLib.Messaging.Messenger]::SendTrapV2( 0, [Lextm.SharpSnmpLib.VersionCode]"v2", $TrapDest,[Lextm.SharpSnmpLib.OctetString]"public",[Lextm.SharpSnmpLib.ObjectIdentifier]"1.3.6.2.9.8",0,$v2GenObj)
##End Code
sinhaa