Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Sending custom traps or informs from a device with net-snmp
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
baz606
n00b
n00b


Joined: 06 Aug 2020
Posts: 4

PostPosted: Thu Aug 06, 2020 5:42 pm    Post subject: Sending custom traps or informs from a device with net-snmp Reply with quote

I have installed the net-snmp 5.8 package on one of my devices running gentoo. I was able to successfully poll the data from the device but I cannot figure out how to send traps or if it is even possible to do so.
The only two snmp commands I am getting on the device is snmpd and snmptrapd. I know that snmptrapd can be used to receive and log trap messages but I would like to send trap messages to another system where it will be logged.
Back to top
View user's profile Send private message
pietinger
Guru
Guru


Joined: 17 Oct 2006
Posts: 394
Location: Bavaria

PostPosted: Thu Aug 06, 2020 6:58 pm    Post subject: Reply with quote

Does this helps you ?
https://stackoverflow.com/questions/37119903/send-a-notification-trap-snmp-with-snmptrap-command-linux
Back to top
View user's profile Send private message
baz606
n00b
n00b


Joined: 06 Aug 2020
Posts: 4

PostPosted: Thu Aug 06, 2020 7:59 pm    Post subject: Reply with quote

Quote:

Does this helps you ?
https://stackoverflow.com/questions/37119903/send-a-notification-trap-snmp-with-snmptrap-command-linux

Yea, that would help if I had snmptrap command enabled on my gentoo device. When I installed the net-snmp package, the only two terminal snmp commands which were available to me were snmpd and snmptrapd
Back to top
View user's profile Send private message
pietinger
Guru
Guru


Joined: 17 Oct 2006
Posts: 394
Location: Bavaria

PostPosted: Thu Aug 06, 2020 8:28 pm    Post subject: Reply with quote

baz606 wrote:
[...] the only two terminal snmp commands which were available to me were snmpd and snmptrapd

You dont have "snmpwalk" for testing ?
(https://wiki.gentoo.org/wiki/Net-SNMP)
Back to top
View user's profile Send private message
pietinger
Guru
Guru


Joined: 17 Oct 2006
Posts: 394
Location: Bavaria

PostPosted: Thu Aug 06, 2020 8:34 pm    Post subject: Reply with quote

I checked it. "snmptrap" will be installed also. How did you emerge "net-snmp" ?

This is from my installation:
Code:
[...]
--- /usr/bin/
>>> /usr/bin/net-snmp-config
>>> /usr/bin/net-snmp-create-v3-user
>>> /usr/bin/checkbandwidth
>>> /usr/bin/mib2c-update
>>> /usr/bin/agentxtrap
>>> /usr/bin/snmpvacm
>>> /usr/bin/snmpgetnext
>>> /usr/bin/snmpbulkwalk
>>> /usr/bin/snmpping
>>> /usr/bin/snmpps
>>> /usr/bin/snmpnetstat
>>> /usr/bin/snmpusm
>>> /usr/bin/encode_keychange
>>> /usr/bin/snmpget
>>> /usr/bin/snmpwalk
>>> /usr/bin/snmpset
>>> /usr/bin/snmptest
>>> /usr/bin/snmptable
>>> /usr/bin/snmptrap
>>> /usr/bin/snmpbulkget
>>> /usr/bin/snmptranslate
>>> /usr/bin/snmpstatus
>>> /usr/bin/snmpdelta
>>> /usr/bin/snmpdf
--- /usr/sbin/
>>> /usr/sbin/snmpd
>>> /usr/sbin/snmptrapd
--- /usr/share/
[...]
Back to top
View user's profile Send private message
baz606
n00b
n00b


Joined: 06 Aug 2020
Posts: 4

PostPosted: Thu Aug 06, 2020 8:43 pm    Post subject: Reply with quote

pietinger wrote:
You dont have "snmpwalk" for testing ?

I do not have that command on my agent/device where net-snmp is installed but I am able to poll data on it from my Linux Mint laptop. It correctly displays all the OIDs data but instead of polling all the time, I want to try to sending traps/notifications from it.

pietinger wrote:
I checked it. "snmptrap" will be installed also. How did you emerge "net-snmp" ?

I used
Code:
emerge net-snmp


I think I may be missing something
Back to top
View user's profile Send private message
pietinger
Guru
Guru


Joined: 17 Oct 2006
Posts: 394
Location: Bavaria

PostPosted: Thu Aug 06, 2020 9:21 pm    Post subject: Reply with quote

What is the output of "emerge -pvD net-snmp" ?
Back to top
View user's profile Send private message
baz606
n00b
n00b


Joined: 06 Aug 2020
Posts: 4

PostPosted: Fri Aug 07, 2020 7:32 pm    Post subject: Reply with quote

pietinger wrote:
I checked it. "snmptrap" will be installed also. How did you emerge "net-snmp" ?

I found out why it was not installing the additional command line tools. I had the 'minimal' USE flag enabled. Checking the ebuild for net-snmp, it says that it ONLY installs snmpd and snmptrapd if 'minimal' flag is enabled which makes sense.
When I removed that flag, everything installed correctly. I should be able to send traps and informs from the device now.

Any idea how can I trigger the sending of traps/informs automatically when something goes wrong with the device or when one of the OID values are not valid or out of range. Maybe some set of rules I can add/edit that will trigger a trap?

Thanks for the help so far!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum