Maybe you could wrap the snmptrap executable in a shell script.

ie. Make a shell script called snmptrap that reads in the commandline variables 
and then calls the “real” snmptrap with the additional port information added. 
Put the snmptrap shell script somewhere in the path ahead of the real net-snmp 
executable.

Alan

From: Hemanth Kumar [mailto:hemanthn...@gmail.com]
Sent: Tuesday, July 19, 2016 5:20 AM
To: net-snmp-users@lists.sourceforge.net
Subject: Need help with snmptrapd command

HI,
I am trying to figure out a way by which I can send following trap command 
without adding/mentioning the port number. The receiver is receiving the trap 
when the custom port number is mentioned
snmptrap -v 2c -c rscommunity <DEST-IP-ADDRESS>:166 "" TRAP-TEST-MIB::demotraps 
 SNMPv2-MIB::sysLocation.0 s "some message"
By default, the following command does not require the port number to be 
mentioned when the snmptrapd is using the default port-161.
snmptrap -v 2c -c rscommunity <DEST-IP-ADDRESS> "" TRAP-TEST-MIB::demotraps  
SNMPv2-MIB::sysLocation.0 s "some message"
Additional info:
firewall opened for the above mentioned custom port
SELINUX
/etc/sysconfig/selinux has the following edit  "SELINUX=disabled" (essentially 
SELINUX is off)

So far, I have been following the 
http://www.net-snmp.org/tutorial/tutorial-5/commands/snmptrap.html<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.net-2Dsnmp.org_tutorial_tutorial-2D5_commands_snmptrap.html&d=CwMFaQ&c=jcv3orpCsv7C4ly8-ubDob57ycZ4jvhoYZNDBA06fPk&r=xN9AnMDZvO_QvUZQZcoply6WFqSJuNcpv-dDu2fA4Ac&m=syhCJx6f_QiHrEJ_3yynUp8lWw1ZVzUv30Y88ft2daM&s=TzXSUtOIyBeBB7JwGqpM1HwKyI5SA6cYhZ5As2wG8kc&e=>
 to understand/test

Test Bed
2xservers with NET-SNMP version:  5.7.2 on CentOS 7.2
Thanks in advance
-Hemanth
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to