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
SNMP Trap not working
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 The snmptrapd is running as a background process: > ps -ef | grep snmp root 29477 1 0 14:49 ?00:00:00 /usr/sbin/snmptrapd -Lsd -p /var/run/snmptrapd.pid -Cc /etc/snmp/snmptrapd.conf And yet when I send a trap locally using snmptrap nothing happens: > snmptrap -v 2c -c public localhost "" > NET-SNMP-EXAMPLES-MIB::netSnmpExampleHeartbeatNotification > netSnmpExampleHeartbeatRate i 123456 > Now it seems that the trap does get logged, because the system log file (/var/log/messages) has the following entry: Aug 8 15:46:10 snmptrapd[29477]: 2017-08-08 15:46:10 localhost [UDP: [127.0.0.1]:44928->[127.0.0.1]]:#012DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (1338382434) 154 days, 21:43:44.34#011SNMPv2-MIB::snmpTrapOID.0 = OID: NET-SNMP-EXAMPLES-MIB::netSnmpExampleHeartbeatNotification#011NET-SNMP-EXAMPLES-MIB::netSnmpExampleHeartbeatRate = INTEGER: 123456 When I added the -Ci option to the snmptrapd command line options I got the following error: No log handling enabled - turning on stderr logging : Unknown Object Identifier (Sub-id not found: (top) -> ) As far as I can see everything is set up correctly. If so, why is the trap handle not working and how can one check why the trap doesn't trigger the script? Thanks in advance. -- 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
SNMP trap not working correctly for 64-bit varbinds
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 My snmpd.conf # cat snmpd.conf syslocation "Vinay's desktop" syscontact vsi...@informatica.com sysservices 12 createUser gfro MD5 "vinaysingh" DES rwuser vinay rocommunity public com2sec vinaydefault privvyr group vinayv2c gfro # access for the two read only groups to their individual views access vinay"" any noauth exact fullnonenone # master agentx agentgroup daemon AgentXSocket tcp:localhost:705 trap2sink localhost public iquerySecName vinay agentSecName vinay # No Problem with this trap proc wireshark 1 proc xterm 1 0 linkUpDownNotifications yes # No Problem with this trap monitor -r 10 -o UCD-SNMP-MIB::prNames -o UCD-SNMP-MIB::prErrMessage "process table" UCD-SNMP-MIB::prErrorFlag != 0 #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 #This trap dpes not work correctly ( 64 bit varbinds) - Never triggers even if TNW-MIB::tnwSourceLbtrmAggNaksRcved is more than 10 notificationEvent HaveRMSources7 DISMAN-EVENT-MIB::mteTriggerRising -o TNW-MIB::tnwSourceLbtrmAggNaksRcved monitor -e HaveRMSources7 -r 10 RMSource7 TNW-MIB::tnwSourceLbtrmAggNaksRcved > 10 # No Problem with this trap ( 32-bit varbinds) notificationEvent HaveRMSources DISMAN-EVENT-MIB::mteTriggerFired -o TNW-MIB::tnwSourceLbtrmNumberOfEntries TNW-MIB::tnwReceiverLbtrmNumberOfEntries monitor -e HaveRMSources -r 10 RMSource TNW-MIB::tnwSourceLbtrmNumberOfEntries > 0 # # No Problem with this trap ( 32-bit varbinds) notificationEvent HaveRMSources2 DISMAN-EVENT-MIB::mteTriggerFalling -o TNW-MIB::tnwSourceLbtrmNumberOfEntries monitor -e HaveRMSources2 -r 10 RMSource2 TNW-MIB::tnwSourceLbtrmNumberOfEntries == 0 -- 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
snmp trap not working.
Hi! 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?. I have shown sample code below, please go thru it and help me out where I'm doing wrong. #include #include #include #include #include "Trap.h" int send_ampTempHighMark_trap (size_t ampTempHighVal) { netsnmp_variable_list *var_list = NULL; Oid ampTempHighMarkTrap_oid [] = {1, 3, 6, 1, 4, 1, 13995, 4, 5}; Oid ampTempHighMark_oid [] = {1, 3, 6, 1, 4, 1, 13995, 2, 1, 1, 0}; snmp_varlist_add_variable (&var_list, snmptrap_oid, OID_LENGTH (snmptrap_oid), ASN_OBJECT_ID, (u_char *) ampTempHighMarkTrap_oid, sizeof (ampTempHighMarkTrap_oid) ); snmp_varlist_add_variable (&var_list, ampTempHighMark_oid, OID_LENGTH (ampTempHighMark_oid), ASN_INTEGER, (u_char *) &TempHighVal, sizeof (ampTempHighVal) ); /* Send the trap to the list of configured destinations * and clean up */ send_v2trap (var_list); snmp_free_varbind (var_list); return SNMP_ERR_NOERROR; } main () { int tempVal = 50; init_traps (); While (1) { #ifndef DISABLE_TEMPHIGMARK_TRAP if( tempVal > THRESHOLD_VALUE ) { send_ampTempHighMark_trap( tempVal ); tempVal = 50; } #endif } 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. 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. I guess I'm missing out some points. Please any body implemented traps or anybody faced the same problem please help me out. With Regards, G. Siva Prakash Reddy. This email message and its attachments may contain CONFIDENTIAL AND PRIVILEGED INFORMATION intended for the sole use of the addressee(s). If you have received it in error, please contact the sender by return email, notify your system manager and destroy the original message and any copies thereof. Any review, use, disclosure or distribution is unlawful. Please check this email and any attachments for the presence of viruses. The Company accepts no liability for any damage caused by any virus transmitted by this email. The views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of the company. The Company reserves the right to monitor, review and store the content of all messages sent to or from this e-mail address. www.aztecsoft.com- 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