Discussion:
[opennms-discuss] SNMP trap forwarding question
Me Me
2008-05-08 14:04:10 UTC
Permalink
Hello group-

Per the following link, OpenNMS can forward SNMP traps to a third party server.

http://www.opennms.org/index.php/Configuring_notifications
OpenNMS uses notifications to make users aware of an event. Common
notification methods are email and paging, but notification mechanisms
also exist for
XMPP (Jabber, an instant messaging protocol),
arbitrary external programs
SNMP traps can be sent, and
arbitrary HTTP GETs/POSTs can be made to a web site.

The link below doesn't explain how to configure this. Can anyone point me in the correct direction on how to proceed? The link references four files; destinationPaths.xml notifd-configuration.xml notificationCommands.xml notifications.xml

but I don't see anything obvious as to how to configure SNMP trap forwarding in those files. Any help would be greatly appreciated.

http://www.opennms.org/index.php/Configuring_notifications

Thanks in advance,

Chris

_________________________________________________________________
Stay in touch when you're away with Windows Live Messenger.
http://www.windowslive.com/messenger/overview.html?ocid=TXT_TAGLM_WL_Refresh_messenger_052008
Me Me
2008-05-09 14:59:53 UTC
Permalink
Anyone do this in OpenNMS? I'm having no luck and getting desperate. :) Any help or direction would be greatly appreciated.

Chris



From: ***@hotmail.com
To: opennms-***@lists.sourceforge.net
Date: Thu, 8 May 2008 09:04:10 -0500
Subject: [opennms-discuss] SNMP trap forwarding question







Hello group-

Per the following link, OpenNMS can forward SNMP traps to a third party server.

http://www.opennms.org/index.php/Configuring_notifications
OpenNMS uses notifications to make users aware of an event. Common
notification methods are email and paging, but notification mechanisms
also exist for

XMPP (Jabber, an instant messaging protocol),
arbitrary external programs
SNMP traps can be sent, and
arbitrary HTTP GETs/POSTs can be made to a web site.

The link below doesn't explain how to configure this. Can anyone point me in the correct direction on how to proceed? The link references four files; destinationPaths.xml notifd-configuration.xml notificationCommands.xml notifications.xml

but I don't see anything obvious as to how to configure SNMP trap forwarding in those files. Any help would be greatly appreciated.

http://www.opennms.org/index.php/Configuring_notifications

Thanks in advance,

Chris

Stay in touch when you're away with Windows Live Messenger. IM anytime you're online.

_________________________________________________________________
Stay in touch when you're away with Windows Live Messenger.
http://www.windowslive.com/messenger/overview.html?ocid=TXT_TAGLM_WL_Refresh_messenger_052008
Jeff Gehlbach
2008-05-09 15:56:19 UTC
Permalink
Post by Me Me
Anyone do this in OpenNMS? I'm having no luck and getting desperate.
Try this article:

http://www.opennms.org/index.php/Notification_Configuration_How-To

-jeff
David Hustace
2008-05-11 02:22:27 UTC
Permalink
Post by Me Me
Anyone do this in OpenNMS? I'm having no luck and getting
desperate. :) Any help or direction would be greatly appreciated.
Did the link Jeff provided help you at all? The SNMP Trap
notification is rev 1 and a bit hacky because no one has asked to
improve it. Most Traps are forwarded from OpenNMS by using the
Scriptd process.


David Hustace
The OpenNMS Group, Inc.
Me Me
2008-05-11 02:41:53 UTC
Permalink
Hi David-

I haven't implemented the link Jeff provided yet. If you think forwarding traps via scriptd is a better approach, I would definately appreciate any documentation you may have.

Thanks to all,

Chris



From: ***@opennms.org
To: opennms-***@lists.sourceforge.net
Date: Sun, 11 May 2008 03:22:27 +0100
Subject: Re: [opennms-discuss] SNMP trap forwarding question


On May 9, 2008, at 3:59 PM, Me Me wrote:Anyone do this in OpenNMS? I'm having no luck and getting desperate. :) Any help or direction would be greatly appreciated.

Did the link Jeff provided help you at all? The SNMP Trap notification is rev 1 and a bit hacky because no one has asked to improve it. Most Traps are forwarded from OpenNMS by using the Scriptd process.

David HustaceThe OpenNMS Group, Inc.

_________________________________________________________________
With Windows Live for mobile, your contacts travel with you.
http://www.windowslive.com/mobile/overview.html?ocid=TXT_TAGLM_WL_Refresh_mobile_052008
David Hustace
2008-05-11 08:52:47 UTC
Permalink
Post by Me Me
I haven't implemented the link Jeff provided yet. If you think
forwarding traps via scriptd is a better approach
It is a better approach if it better matches your use case. It
depends on whether or not if you want the Traps to be sent as part of
the notification workflow.
Post by Me Me
, I would definately appreciate any documentation you may have.
Have you search the wiki? Have you looked in /opt/opennnms/etc/
examples ?


David Hustace
The OpenNMS Group, Inc.
Me Me
2008-05-12 13:38:44 UTC
Permalink
For now I would like all traps OpenNMS receives to be forwarded to a 3rd party server.

Here's the only thing I have in scriptd-configuration.xml :

<?xml version="1.0"?>
<scriptd-configuration>
<engine language="beanshell" className="bsh.util.BeanShellBSFEngine" extensions="bsh"/>
<event-script language="beanshell">
event = bsf.lookupBean("event");
if (event.snmp != null) {
log.debug("forwarding a trap");
snmpTrapHelper.forwardTrap(event, "209.170.174.201", 162);
}
</event-script>
</scriptd-configuration>

Here's the error message I get in scriptd.log :

2008-05-12 08:35:25,073 ERROR [Scriptd-Executor] Executor: Non-UEI-specific event handler script [0] execution failed
com.ibm.bsf.BSFException: BeanShell script error: Sourced file: <Inline eval of:
event = bsf.lookupBean("event");
if (event.snmp != null) {
log.debug("forwarding a trap");
snmpTrapHelper.forwardTrap(event, "209.170.174.201", 162);
}
; > : Attempt to invoke method: debug() on undefined variable or class name: log : at Line: 3 : in file: <Inline eval of:
event = bsf.lookupBean("event");
if (event.snmp != null) {
log.debug("forwarding a trap");
snmpTrapHelper.forwardTrap(event, "209.170.174.201", 162);
}
; > : if ( event .snmp != null ) { BSF info: at line: 0 column: columnNo
at bsh.util.BeanShellBSFEngine.eval(Unknown Source)
at bsh.util.BeanShellBSFEngine.exec(Unknown Source)
at com.ibm.bsf.BSFManager.exec(BSFManager.java:479)
at org.opennms.netmgt.scriptd.Executor.run(Executor.java:302)
at java.lang.Thread.run(Thread.java:595)
2008-05-12 08:35:25,073 DEBUG [Scriptd-Executor] Executor: Finished executing scripts for: uei.opennms.org/generic/traps/EnterpriseDefault
2008-05-12 08:35:25,157 DEBUG [Scriptd:BroadcastEventProcessor] EventIpcManagerDefaultImpl$ListenerThread: run: calling onEvent on Scriptd:BroadcastEventProcessor for event uei.opennms.org/generic/traps/EnterpriseDefault
2008-05-12 08:35:25,157 DEBUG [Scriptd:BroadcastEventProcessor] BroadcastEventProcessor: Added event 'uei.opennms.org/generic/traps/EnterpriseDefault' to scriptd execution queue.
2008-05-12 08:35:25,157 DEBUG [Scriptd-Executor] Executor: Executing scripts for: uei.opennms.org/generic/traps/EnterpriseDefault
2008-05-12 08:35:25,159 ERROR [Scriptd-Executor] Executor: Non-UEI-specific event handler script [0] execution failed
com.ibm.bsf.BSFException: BeanShell script error: Sourced file: <Inline eval of:
event = bsf.lookupBean("event");
if (event.snmp != null) {
log.debug("forwarding a trap");
snmpTrapHelper.forwardTrap(event, "209.170.174.201", 162);
}
; > : Attempt to invoke method: debug() on undefined variable or class name: log : at Line: 3 : in file: <Inline eval of:
event = bsf.lookupBean("event");
if (event.snmp != null) {
log.debug("forwarding a trap");
snmpTrapHelper.forwardTrap(event, "209.170.174.201", 162);
}
; > : if ( event .snmp != null ) { BSF info: at line: 0 column: columnNo
at bsh.util.BeanShellBSFEngine.eval(Unknown Source)
at bsh.util.BeanShellBSFEngine.exec(Unknown Source)
at com.ibm.bsf.BSFManager.exec(BSFManager.java:479)
at org.opennms.netmgt.scriptd.Executor.run(Executor.java:302)
at java.lang.Thread.run(Thread.java:595)
2008-05-12 08:35:25,159 DEBUG [Scriptd-Executor] Executor: Finished executing scripts for: uei.opennms.org/generic/traps/EnterpriseDefault
#

Any thoughts/suggestions?

Thank you much in advance,

Chris


From: ***@opennms.org
To: opennms-***@lists.sourceforge.net
Date: Sun, 11 May 2008 09:52:47 +0100
Subject: Re: [opennms-discuss] SNMP trap forwarding question


On May 11, 2008, at 3:41 AM, Me Me wrote:I haven't implemented the link Jeff provided yet. If you think forwarding traps via scriptd is a better approach
It is a better approach if it better matches your use case. It depends on whether or not if you want the Traps to be sent as part of the notification workflow.

, I would definately appreciate any documentation you may have.

Have you search the wiki? Have you looked in /opt/opennnms/etc/examples ?

David HustaceThe OpenNMS Group, Inc.

_________________________________________________________________
Get Free (PRODUCT) RED™ Emoticons, Winks and Display Pics.
http://joinred.spaces.live.com?ocid=TXT_HMTG_prodredemoticons_052008
Jeff Gehlbach
2008-05-12 15:16:41 UTC
Permalink
Post by Me Me
For now I would like all traps OpenNMS receives to be forwarded to a 3rd party server.
<?xml version="1.0"?>
<scriptd-configuration>
<engine language="beanshell"
className="bsh.util.BeanShellBSFEngine" extensions="bsh"/>
<event-script language="beanshell">
event = bsf.lookupBean("event");
if (event.snmp != null) {
log.debug("forwarding a trap");
Your "log" object is undefined. You need to use bsf.lookupBean("log")
to get this object, just as you've done with "event".
Post by Me Me
snmpTrapHelper.forwardTrap(event,
"209.170.174.201", 162);
}
</event-script>
</scriptd-configuration>
2008-05-12 08:35:25,073 ERROR [Scriptd-Executor] Executor: Non-UEI-
specific event handler script [0] execution failed
event = bsf.lookupBean("event");
if (event.snmp != null) {
log.debug("forwarding a trap");
snmpTrapHelper.forwardTrap(event,
"209.170.174.201", 162);
}
; > : Attempt to invoke method: debug() on undefined variable or
The debug messages above provide the information to lead you to this
conclusion.

-jeff
Post by Me Me
event = bsf.lookupBean("event");
if (event.snmp != null) {
log.debug("forwarding a trap");
snmpTrapHelper.forwardTrap(event,
"209.170.174.201", 162);
}
; > : if ( event .snmp != null ) { BSF info: at line: 0 column: columnNo
at bsh.util.BeanShellBSFEngine.eval(Unknown Source)
at bsh.util.BeanShellBSFEngine.exec(Unknown Source)
at com.ibm.bsf.BSFManager.exec(BSFManager.java:479)
at org.opennms.netmgt.scriptd.Executor.run(Executor.java:302)
at java.lang.Thread.run(Thread.java:595)
2008-05-12 08:35:25,073 DEBUG [Scriptd-Executor] Executor: Finished
executing scripts for: uei.opennms.org/generic/traps/EnterpriseDefault
2008-05-12 08:35:25,157 DEBUG [Scriptd:BroadcastEventProcessor]
EventIpcManagerDefaultImpl$ListenerThread: run: calling onEvent on
Scriptd:BroadcastEventProcessor for event uei.opennms.org/generic/
traps/EnterpriseDefault
2008-05-12 08:35:25,157 DEBUG [Scriptd:BroadcastEventProcessor]
BroadcastEventProcessor: Added event 'uei.opennms.org/generic/traps/
EnterpriseDefault' to scriptd execution queue.
2008-05-12 08:35:25,157 DEBUG [Scriptd-Executor] Executor: Executing
scripts for: uei.opennms.org/generic/traps/EnterpriseDefault
2008-05-12 08:35:25,159 ERROR [Scriptd-Executor] Executor: Non-UEI-
specific event handler script [0] execution failed
event = bsf.lookupBean("event");
if (event.snmp != null) {
log.debug("forwarding a trap");
snmpTrapHelper.forwardTrap(event,
"209.170.174.201", 162);
}
; > : Attempt to invoke method: debug() on undefined variable or
event = bsf.lookupBean("event");
if (event.snmp != null) {
log.debug("forwarding a trap");
snmpTrapHelper.forwardTrap(event,
"209.170.174.201", 162);
}
; > : if ( event .snmp != null ) { BSF info: at line: 0 column: columnNo
at bsh.util.BeanShellBSFEngine.eval(Unknown Source)
at bsh.util.BeanShellBSFEngine.exec(Unknown Source)
at com.ibm.bsf.BSFManager.exec(BSFManager.java:479)
at org.opennms.netmgt.scriptd.Executor.run(Executor.java:302)
at java.lang.Thread.run(Thread.java:595)
2008-05-12 08:35:25,159 DEBUG [Scriptd-Executor] Executor: Finished
executing scripts for: uei.opennms.org/generic/traps/EnterpriseDefault
#
Any thoughts/suggestions?
Thank you much in advance,
Chris
Date: Sun, 11 May 2008 09:52:47 +0100
Subject: Re: [opennms-discuss] SNMP trap forwarding question
I haven't implemented the link Jeff provided yet. If you think
forwarding traps via scriptd is a better approach
It is a better approach if it better matches your use case. It
depends on whether or not if you want the Traps to be sent as part
of the notification workflow.
, I would definately appreciate any documentation you may have.
Have you search the wiki? Have you looked in /opt/opennnms/etc/
examples ?
David Hustace
The OpenNMS Group, Inc.
Get Free (PRODUCT) RED™ Emoticons, Winks and Display Pics. Check it
out!
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save
$100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone_______________________________________________
http://www.opennms.org/index.php/Mailing_List_FAQ
opennms-discuss mailing list
To *unsubscribe* or change your subscription options, see the bottom
https://lists.sourceforge.net/lists/listinfo/opennms-discuss
Me Me
2008-05-12 15:22:07 UTC
Permalink
Jeff-

Thank you very much for the feedback. I copied this script from a google search, I didn't write it myself. Can you point me in the right direction as to how to define the log.debug object? This is very much greek to me, and I'm not getting a ton off the web.

I sincerely apologize for my ignorance, this is my first time dealing with trap forwarding within OpenNMS.... I'm as green as grass.

Thanks again to everyone,

Chris
Date: Mon, 12 May 2008 11:16:41 -0400
Subject: Re: [opennms-discuss] SNMP trap forwarding question
Post by Me Me
For now I would like all traps OpenNMS receives to be forwarded to a 3rd party server.
<?xml version="1.0"?>
<scriptd-configuration>
<engine language="beanshell"
className="bsh.util.BeanShellBSFEngine" extensions="bsh"/>
<event-script language="beanshell">
event = bsf.lookupBean("event");
if (event.snmp != null) {
log.debug("forwarding a trap");
Your "log" object is undefined. You need to use bsf.lookupBean("log")
to get this object, just as you've done with "event".
Post by Me Me
snmpTrapHelper.forwardTrap(event,
"209.170.174.201", 162);
}
</event-script>
</scriptd-configuration>
2008-05-12 08:35:25,073 ERROR [Scriptd-Executor] Executor: Non-UEI-
specific event handler script [0] execution failed
event = bsf.lookupBean("event");
if (event.snmp != null) {
log.debug("forwarding a trap");
snmpTrapHelper.forwardTrap(event,
"209.170.174.201", 162);
}
; > : Attempt to invoke method: debug() on undefined variable or
The debug messages above provide the information to lead you to this
conclusion.
-jeff
Post by Me Me
event = bsf.lookupBean("event");
if (event.snmp != null) {
log.debug("forwarding a trap");
snmpTrapHelper.forwardTrap(event,
"209.170.174.201", 162);
}
; > : if ( event .snmp != null ) { BSF info: at line: 0 column: columnNo
at bsh.util.BeanShellBSFEngine.eval(Unknown Source)
at bsh.util.BeanShellBSFEngine.exec(Unknown Source)
at com.ibm.bsf.BSFManager.exec(BSFManager.java:479)
at org.opennms.netmgt.scriptd.Executor.run(Executor.java:302)
at java.lang.Thread.run(Thread.java:595)
2008-05-12 08:35:25,073 DEBUG [Scriptd-Executor] Executor: Finished
executing scripts for: uei.opennms.org/generic/traps/EnterpriseDefault
2008-05-12 08:35:25,157 DEBUG [Scriptd:BroadcastEventProcessor]
EventIpcManagerDefaultImpl$ListenerThread: run: calling onEvent on
Scriptd:BroadcastEventProcessor for event uei.opennms.org/generic/
traps/EnterpriseDefault
2008-05-12 08:35:25,157 DEBUG [Scriptd:BroadcastEventProcessor]
BroadcastEventProcessor: Added event 'uei.opennms.org/generic/traps/
EnterpriseDefault' to scriptd execution queue.
2008-05-12 08:35:25,157 DEBUG [Scriptd-Executor] Executor: Executing
scripts for: uei.opennms.org/generic/traps/EnterpriseDefault
2008-05-12 08:35:25,159 ERROR [Scriptd-Executor] Executor: Non-UEI-
specific event handler script [0] execution failed
event = bsf.lookupBean("event");
if (event.snmp != null) {
log.debug("forwarding a trap");
snmpTrapHelper.forwardTrap(event,
"209.170.174.201", 162);
}
; > : Attempt to invoke method: debug() on undefined variable or
event = bsf.lookupBean("event");
if (event.snmp != null) {
log.debug("forwarding a trap");
snmpTrapHelper.forwardTrap(event,
"209.170.174.201", 162);
}
; > : if ( event .snmp != null ) { BSF info: at line: 0 column: columnNo
at bsh.util.BeanShellBSFEngine.eval(Unknown Source)
at bsh.util.BeanShellBSFEngine.exec(Unknown Source)
at com.ibm.bsf.BSFManager.exec(BSFManager.java:479)
at org.opennms.netmgt.scriptd.Executor.run(Executor.java:302)
at java.lang.Thread.run(Thread.java:595)
2008-05-12 08:35:25,159 DEBUG [Scriptd-Executor] Executor: Finished
executing scripts for: uei.opennms.org/generic/traps/EnterpriseDefault
#
Any thoughts/suggestions?
Thank you much in advance,
Chris
Date: Sun, 11 May 2008 09:52:47 +0100
Subject: Re: [opennms-discuss] SNMP trap forwarding question
I haven't implemented the link Jeff provided yet. If you think
forwarding traps via scriptd is a better approach
It is a better approach if it better matches your use case. It
depends on whether or not if you want the Traps to be sent as part
of the notification workflow.
, I would definately appreciate any documentation you may have.
Have you search the wiki? Have you looked in /opt/opennnms/etc/
examples ?
David Hustace
The OpenNMS Group, Inc.
Get Free (PRODUCT) RED™ Emoticons, Winks and Display Pics. Check it
out!
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save
$100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone_______________________________________________
http://www.opennms.org/index.php/Mailing_List_FAQ
opennms-discuss mailing list
To *unsubscribe* or change your subscription options, see the bottom
https://lists.sourceforge.net/lists/listinfo/opennms-discuss
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
http://www.opennms.org/index.php/Mailing_List_FAQ
opennms-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/opennms-discuss
_________________________________________________________________
Windows Live SkyDrive lets you share files with faraway friends.
http://www.windowslive.com/skydrive/overview.html?ocid=TXT_TAGLM_WL_Refresh_skydrive_052008
Jeff Gehlbach
2008-05-12 15:57:52 UTC
Permalink
Post by Me Me
Thank you very much for the feedback. I copied this script from a
google search, I didn't write it myself. Can you point me in the
right direction as to how to define the log.debug object? This is
very much greek to me, and I'm not getting a ton off the web.
I already told you how to get the log object, please read my previous
reply. It's almost identical to the way you obtain your event
object. "debug" is a method that you call on the log object.

-jeff
Me Me
2008-05-12 16:41:56 UTC
Permalink
Jeff, I apologize... I am screwing up the syntax... I tried both

log = bsf.lookupBean("log");
and
log.debug = bsf.lookupBean("log");

wth the cooresponding errors below. What is the correct syntax?

Chris

2008-05-12 11:27:06,002 ERROR [Scriptd-Executor] Executor: Non-UEI-specific event handler script [0] execution failed
com.ibm.bsf.BSFException: BeanShell script error: Sourced file: <Inline eval of:
event = bsf.lookupBean("event");
if (event.snmp != null) {
log = bsf.lookupBean("log");
snmpTrapHelper.forwardTrap(event, "209.170.174.201", 162);
}
; > : Attempt to invoke method: forwardTrap() on undefined variable or class name: snmpTrapHelper : at Line: 3 : in file: <Inline eval of:
event = bsf.lookupBean("event");
if (event.snmp != null) {
log = bsf.lookupBean("log");
snmpTrapHelper.forwardTrap(event, "209.170.174.201", 162);
}
; > : if ( event .snmp != null ) { BSF info: at line: 0 column: columnNo
at bsh.util.BeanShellBSFEngine.eval(Unknown Source)
at bsh.util.BeanShellBSFEngine.exec(Unknown Source)
at com.ibm.bsf.BSFManager.exec(BSFManager.java:479)
at org.opennms.netmgt.scriptd.Executor.run(Executor.java:302)
at java.lang.Thread.run(Thread.java:595)
2008-05-12 11:27:06,002 DEBUG [Scriptd-Executor] Executor: Finished executing scripts for: uei.opennms.org/generic/traps/EnterpriseDefault
#

2008-05-12 11:35:57,279 ERROR [Scriptd-Executor] Executor: Non-UEI-specific event handler script [0] execution failed
com.ibm.bsf.BSFException: BeanShell script error: Sourced file: <Inline eval of:
event = bsf.lookupBean("event");
if (event.snmp != null) {
log.debug = bsf.lookupBean("log");
snmpTrapHelper.forwardTrap(event, "209.170.174.201", 162);
}
; > : LHS evaluation: Class or variable not found:log.debug: <at unknown location> : at Line: 3 : in file: <Inline eval of:
event = bsf.lookupBean("event");
if (event.snmp != null) {
log.debug = bsf.lookupBean("log");
snmpTrapHelper.forwardTrap(event, "209.170.174.201", 162);
}
; > : if ( event .snmp != null ) { BSF info: at line: 0 column: columnNo
at bsh.util.BeanShellBSFEngine.eval(Unknown Source)
at bsh.util.BeanShellBSFEngine.exec(Unknown Source)
at com.ibm.bsf.BSFManager.exec(BSFManager.java:479)
at org.opennms.netmgt.scriptd.Executor.run(Executor.java:302)
at java.lang.Thread.run(Thread.java:595)
2008-05-12 11:35:57,279 DEBUG [Scriptd-Executor] Executor: Finished executing scripts for: uei.opennms.org/generic/traps/EnterpriseDefault
#
Date: Mon, 12 May 2008 11:57:52 -0400
Subject: Re: [opennms-discuss] SNMP trap forwarding question
Post by Me Me
Thank you very much for the feedback. I copied this script from a
google search, I didn't write it myself. Can you point me in the
right direction as to how to define the log.debug object? This is
very much greek to me, and I'm not getting a ton off the web.
I already told you how to get the log object, please read my previous
reply. It's almost identical to the way you obtain your event
object. "debug" is a method that you call on the log object.
-jeff
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
http://www.opennms.org/index.php/Mailing_List_FAQ
opennms-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/opennms-discuss
_________________________________________________________________
Get Free (PRODUCT) RED™ Emoticons, Winks and Display Pics.
http://joinred.spaces.live.com?ocid=TXT_HMTG_prodredemoticons_052008
Jeff Gehlbach
2008-05-12 18:27:42 UTC
Permalink
Post by Me Me
Jeff, I apologize... I am screwing up the syntax... I tried both
log = bsf.lookupBean("log");
and
log.debug = bsf.lookupBean("log");
wth the cooresponding errors below. What is the correct syntax?
The first one.
Post by Me Me
Chris
2008-05-12 11:27:06,002 ERROR [Scriptd-Executor] Executor: Non-UEI-
specific event handler script [0] execution failed
event = bsf.lookupBean("event");
if (event.snmp != null) {
log = bsf.lookupBean("log");
Don't you think you should declare your log object in a wider scope?
The top of your start script would be the most logical place, that way
you don't have to re-lookup the bean every time you want to use it.
Post by Me Me
snmpTrapHelper.forwardTrap(event,
"209.170.174.201", 162);
}
; > : Attempt to invoke method: forwardTrap() on undefined variable
event = bsf.lookupBean("event");
Now it's complaining that your snmpTrapHelper object is undefined. If
I were you, I would declare and instantiate this object at the top of
the start-script as well.

For an example, see /opt/opennms/etc/examples/scriptd-configuration.xml.

-jeff
Me Me
2008-05-12 20:23:03 UTC
Permalink
Jeff- Thanks for being so patient with me... I think I'm getting closer, but I still have something wrong. I see right off the bat I need proper syntax for log.debug. It also seems to be complaining about the SNMP version. Below is my latest scritpd-config.xml and the related log...

Thanks again,

Chris

# more scriptd-configuration.xml
<?xml version="1.0"?>
<scriptd-configuration>
<engine language="beanshell" className="bsh.util.BeanShellBSFEngine" extensions="bsh"/>

<start-script language="beanshell">

import org.opennms.protocols.snmp.SnmpPduTrap;

log = bsf.lookupBean("log");
snmpTrapHelper = new org.opennms.netmgt.scriptd.helper.SnmpTrapHelper();

</start-script>

<stop-script language="beanshell">

snmpTrapHelper.stop();

log.debug("executing a stop script");

</stop-script>

<event-script language="beanshell">

event = bsf.lookupBean("event");
if (event.snmp != null) {
log = bsf.lookupBean("log");
snmpTrapHelper.forwardTrap(event, "209.170.174.201", 162);
}
</event-script>
</scriptd-configuration>
#

*** LOG ***

2008-05-12 15:02:36,378 ERROR [Scriptd-Executor] Executor: Non-UEI-specific event handler script [0] execution failed
com.ibm.bsf.BSFException: The application script threw an exception: org.opennms.netmgt.scriptd.helper.SnmpTrapHelperException: Failed to send trap the problem resulted from:
org.opennms.protocols.snmp.SnmpPduEncodingException: Cannot send pdu, invalid SNMP version BSF info: at line: 0 column: columnNo
at bsh.util.BeanShellBSFEngine.eval(Unknown Source)
at bsh.util.BeanShellBSFEngine.exec(Unknown Source)
at com.ibm.bsf.BSFManager.exec(BSFManager.java:479)
at org.opennms.netmgt.scriptd.Executor.run(Executor.java:302)
at java.lang.Thread.run(Thread.java:595)
2008-05-12 15:02:36,378 DEBUG [Scriptd-Executor] Executor: Finished executing scripts for: uei.opennms.org/generic/traps/EnterpriseDefault
#
Date: Mon, 12 May 2008 14:27:42 -0400
Subject: Re: [opennms-discuss] SNMP trap forwarding question
Post by Me Me
Jeff, I apologize... I am screwing up the syntax... I tried both
log = bsf.lookupBean("log");
and
log.debug = bsf.lookupBean("log");
wth the cooresponding errors below. What is the correct syntax?
The first one.
Post by Me Me
Chris
2008-05-12 11:27:06,002 ERROR [Scriptd-Executor] Executor: Non-UEI-
specific event handler script [0] execution failed
event = bsf.lookupBean("event");
if (event.snmp != null) {
log = bsf.lookupBean("log");
Don't you think you should declare your log object in a wider scope?
The top of your start script would be the most logical place, that way
you don't have to re-lookup the bean every time you want to use it.
Post by Me Me
snmpTrapHelper.forwardTrap(event,
"209.170.174.201", 162);
}
; > : Attempt to invoke method: forwardTrap() on undefined variable
event = bsf.lookupBean("event");
Now it's complaining that your snmpTrapHelper object is undefined. If
I were you, I would declare and instantiate this object at the top of
the start-script as well.
For an example, see /opt/opennms/etc/examples/scriptd-configuration.xml.
-jeff
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
http://www.opennms.org/index.php/Mailing_List_FAQ
opennms-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/opennms-discuss
_________________________________________________________________
Windows Live SkyDrive lets you share files with faraway friends.
http://www.windowslive.com/skydrive/overview.html?ocid=TXT_TAGLM_WL_Refresh_skydrive_052008
Jeff Gehlbach
2008-05-12 20:39:32 UTC
Permalink
Post by Me Me
Jeff- Thanks for being so patient with me... I think I'm getting
closer, but I still have something wrong. I see right off the bat I
need proper syntax for log.debug. It also seems to be complaining
about the SNMP version. Below is my latest scritpd-config.xml and
the related log...
What SNMP version are these traps coming in as? The SnmpTrapHelper
can forward only V1 or V2C traps. And what version of OpenNMS are you
using?

-jeff
Me Me
2008-05-12 20:57:38 UTC
Permalink
Jeff-

You have been wonderful. I just verified with the admin of the 3rd party server which the traps are being sent, and he's receiving them. I must have equipment that's spitting out non v1 or v2. I need to investigate that on my end obviously.

THANK YOU again!!!!!

Best regards,

Chris
Date: Mon, 12 May 2008 16:39:32 -0400
Subject: Re: [opennms-discuss] SNMP trap forwarding question
Post by Me Me
Jeff- Thanks for being so patient with me... I think I'm getting
closer, but I still have something wrong. I see right off the bat I
need proper syntax for log.debug. It also seems to be complaining
about the SNMP version. Below is my latest scritpd-config.xml and
the related log...
What SNMP version are these traps coming in as? The SnmpTrapHelper
can forward only V1 or V2C traps. And what version of OpenNMS are you
using?
-jeff
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
http://www.opennms.org/index.php/Mailing_List_FAQ
opennms-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/opennms-discuss
_________________________________________________________________
Make Windows Vista more reliable and secure with Windows Vista Service Pack 1.
http://www.windowsvista.com/SP1?WT.mc_id=hotmailvistasp1banner

Loading...