Re: SNMP Trap not working
On Tue, 8 Aug 2017 20:42:39 + Michael wrote: MS> This is my first time working with SNMP, but after reading the MS> SNMP pages I'm still having trouble getting a simple shell MS> script to run when receiving a trap. Did you resolve this issue? MS> Now it seems that the trap does get logged, because the system MS> log file (/var/log/messages) has the following entry: MS> MS> Aug 8 15:46:10 snmptrapd[29477]: 2017-08-08 MS> 15:46:10 localhost [UDP: MS> [127.0.0.1]:44928->[127.0.0.1]]:#012DISMAN-EVENT-MIB::sysUpTimeInstance MS> = Timeticks: (1338382434) 154 days, MS> 21:43:44.34#011SNMPv2-MIB::snmpTrapOID.0 = OID: MS> NET-SNMP-EXAMPLES-MIB::netSnmpExampleHeartbeatNotification#011NET-SNMP-EXAMPLES-MIB::netSnmpExampleHeartbeatRate MS> = INTEGER: 123456 There are a few things that can prevent the trap handler from running: - permissions. make sure the script has execute permissions - SELinux. If enabled, make sure that the script has the right context. Check /var/log/audit/audit.log for AVC errors. Hope that helps. Robert -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
Re: SNMP Trap not working
On Tue, Aug 08, 2017 at 08:42:39PM +, Michael Stein wrote: > This is my first time working with SNMP, but after reading the SNMP pages I'm > still having trouble getting a simple shell script to run when receiving a > trap. > > My /etc/snmp/snmptrapd.conf file looks like this: > > # Example configuration file for snmptrapd > # > # No traps are handled by default, you must edit this file! > # > disableAuthorization yes > authCommunity log,execute,net public > # the generic traps > traphandle default /usr/local/bin/snmptrapd.sh > > The snmptrapd.sh script just says "hello". > > #!/bin/sh > > echo "hello" > > The script is executable and runs when executed independently: > > > /usr/local/bin/snmptrapd.sh > Hello This obviously isn't the output from a run of your script, but I would still suggest that you modify it to read --- #! /bin/sh echo "hello" >> /tmp/my-log-file --- With that change it seems to work for me. /MF -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
Re: SNMP trap not working correctly for 64-bit varbinds
On 1 April 2011 21:25, Singh, Vinay wrote: > Any suggestions on how to send trap based upon 64-bit varbinds comparison. Not really, no. The only 64-bit type in SNMP is Counter64, and individual counter values have no meaning. So it doesn't really make sense to make comparisons using them. Dave -- Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf ___ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
RE: SNMP trap not working correctly for 64-bit varbinds
Thanks a lot Dave for clarification. Any suggestions on how to send trap based upon 64-bit varbinds comparison. Thanks, Vinay -Original Message- From: dave.shi...@googlemail.com [mailto:dave.shi...@googlemail.com] On Behalf Of Dave Shield Sent: Friday, April 01, 2011 2:40 PM To: Singh, Vinay Cc: net-snmp-coders@lists.sourceforge.net Subject: Re: SNMP trap not working correctly for 64-bit varbinds On 1 April 2011 16:40, Singh, Vinay wrote: > #This trap dpes not work correctly ( 64 bit varbinds) - triggers if > the value is 0 > > notificationEvent HaveRMSources6 DISMAN-EVENT-MIB::mteTriggerFalling > -o TNW-MIB::tnwSourceLbtrmAggNaksRcved > > monitor -e HaveRMSources6 -r 10 RMSource6 > TNW-MIB::tnwSourceLbtrmAggNaksRcved 0 10 As far as I can tell, the DisMan Event MIB was designed for use with 32-bit values only. I don't believe it's possible to monitor 64-bit counters using this MIB. Note that the value objects - mteTriggerBooleanValue, mteTriggerThresholdRising, etc are defined using the syntax Integer32 so it's not really possible to compare these against 64-bit counter objects. Dave -- Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf ___ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
Re: SNMP trap not working correctly for 64-bit varbinds
On 1 April 2011 16:40, Singh, Vinay wrote: > #This trap dpes not work correctly ( 64 bit varbinds) - triggers if the > value is 0 > > notificationEvent HaveRMSources6 DISMAN-EVENT-MIB::mteTriggerFalling -o > TNW-MIB::tnwSourceLbtrmAggNaksRcved > > monitor -e HaveRMSources6 -r 10 RMSource6 > TNW-MIB::tnwSourceLbtrmAggNaksRcved 0 10 As far as I can tell, the DisMan Event MIB was designed for use with 32-bit values only. I don't believe it's possible to monitor 64-bit counters using this MIB. Note that the value objects - mteTriggerBooleanValue, mteTriggerThresholdRising, etc are defined using the syntax Integer32 so it's not really possible to compare these against 64-bit counter objects. Dave -- Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf ___ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
RE: SNMP trap not working correctly for 64-bit varbinds
I am testing using standard snmptrapd and in snmpd.conf file, I have used trap2sink localhost public. How do I make sure that it is v2 trap sink and not v1 as it appreas ? Thanks, Vinay From: Fulko Hew [mailto:fulko@gmail.com] Sent: Friday, April 01, 2011 12:27 PM To: David Chappelle Cc: Singh, Vinay; net-snmp-coders@lists.sourceforge.net Subject: Re: SNMP trap not working correctly for 64-bit varbinds On Fri, Apr 1, 2011 at 1:23 PM, David Chappelle wrote: I have the same issue and still confused with its appearance. Previously we were running a 4yr old version of net-snmp. After recently upgrading to 5.6 I started getting this error message in /var/log/snmp.log. Was it suppressed before and now being reported? I don't know. How do I go about tracking down and fixing the underlying problem? a) only target v2 trap sinks b) do not send traps that contain Counter64s (to non-v2 trap sinks, the protocol doesn't allow it.) -- Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf ___ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
Re: SNMP trap not working correctly for 64-bit varbinds
On Fri, Apr 1, 2011 at 1:23 PM, David Chappelle wrote: > I have the same issue and still confused with its appearance. Previously we > were running a 4yr old version of net-snmp. After recently upgrading to 5.6 > I started getting this error message in /var/log/snmp.log. Was it suppressed > before and now being reported? > I don't know. > How do I go about tracking down and fixing the underlying problem? > a) only target v2 trap sinks b) do not send traps that contain Counter64s (to non-v2 trap sinks, the protocol doesn't allow it.) -- Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf ___ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
RE: SNMP trap not working correctly for 64-bit varbinds
I have the same issue and still confused with its appearance. Previously we were running a 4yr old version of net-snmp. After recently upgrading to 5.6 I started getting this error message in /var/log/snmp.log. Was it suppressed before and now being reported? How do I go about tracking down and fixing the underlying problem? From: Fulko Hew [mailto:fulko@gmail.com] Sent: Friday, April 01, 2011 1:13 PM To: Singh, Vinay Cc: net-snmp-coders@lists.sourceforge.net Subject: Re: SNMP trap not working correctly for 64-bit varbinds On Fri, Apr 1, 2011 at 11:40 AM, Singh, Vinay mailto:vsi...@informatica.com>> wrote: Hi, I am testing snmpd with subagent. Any trap for 64-bit varbind does not get delivered to snmptrapd. No Problem with 32-bit varbinds. I get error in snmpd.log # cat snmpd.log registered debug token Disman, 1 Turning on AgentX master support. NET-SNMP version 5.6 send_trap: v1 traps can't carry Counter64 varbinds send_trap: failed to convert v2->v1 template PDU ... snip ... That is because Counter64 was added in SNMP v2, and is therefore also supported in V2 traps. But since Counter64 did not exist in SNMP v1, it therefore cannot be encoded into V1 traps. ie. Counter64 is forwards compatible, but not backwards compatible. -- Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf ___ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
Re: SNMP trap not working correctly for 64-bit varbinds
On Fri, Apr 1, 2011 at 11:40 AM, Singh, Vinay wrote: > Hi, > > I am testing snmpd with subagent. Any trap for 64-bit varbind does > not get delivered to snmptrapd. No Problem with 32-bit varbinds. I get error > in > > snmpd.log > > > > # cat snmpd.log > > registered debug token Disman, 1 > > Turning on AgentX master support. > > NET-SNMP version 5.6 > > send_trap: v1 traps can't carry Counter64 varbinds > > send_trap: failed to convert v2->v1 template PDU > ... snip ... That is because Counter64 was added in SNMP v2, and is therefore also supported in V2 traps. But since Counter64 did not exist in SNMP v1, it therefore cannot be encoded into V1 traps. ie. Counter64 is forwards compatible, but not backwards compatible. -- Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf ___ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
Re: snmp trap not working.
On 18/03/2008, Siva Prakash Reddy G <[EMAIL PROTECTED]> wrote: > I have generated SNMP trap code using mib2c.notify.conf file. > Generated code compiled perfectly and executing perfectly but it is not > sending trap I don't Understood why? Because you are using an agent-only API call in a non-agent application. > I have shown sample code below, please go thru it and help me out > where I'm doing wrong. > send_v2trap (var_list); You can *not* use this call to send the trap. You must use 'snmp_send'. See the code for snmptrap.c for details. > I just won't know How SNMP trap will be sent and how he will get > the > manager ipAddress and port no before sending a trap. Exactly - your application doesn't know where to send the trap. It's trying to use an agent-only call, but without the accompanying modules that provide this information. This is the wrong approach for a client-side application. > When I restart the agent I'm receiving the trap because I have written my > IPAddress in /etc/snmp/snmpd.conf file. How this is working. There is a separate MIB module which handles details of trap destinations for notifications sent by the agent. But this *ONLY* works for the agent. It doesn't work for client-side applications. Dave - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders