How to pass SNMP Trap information to Email
Posted: Mon Mar 04, 2019 4:04 am
Hey Guys,
1) I have configured SNMP Agent (snmpd) on sender and SNMP Trap (snmptrapd) on receiver which is on same server Nagios is running.
2) I have also configured NSTI to display and view traps which is working fine
Questions:
1) I see some 5 Traps gets delivered on every SNMP Authentication Failure. Is there a way to restrict trap to only 1 on failure?
2) I would also like to send mail on receiving SNMP Trap. I have added traphandle in snmptrapd.conf and mail are also getting triggered upon Trap reception. I would like to know how to pass information of traps into this email.
#traphandle default /usr/bin/mail /usr/bin/printf "%b" "Nagios Environment: Test\n\nType: Trap Alert\n\n" | mail -s "**Nagios Environment: Test Type: Trap Alert Agent Address: %A Agent Hostname: %B **" -r "FROM_ADDRESS" RECIPIENT_ADDRESS
1) I have configured SNMP Agent (snmpd) on sender and SNMP Trap (snmptrapd) on receiver which is on same server Nagios is running.
2) I have also configured NSTI to display and view traps which is working fine
Questions:
1) I see some 5 Traps gets delivered on every SNMP Authentication Failure. Is there a way to restrict trap to only 1 on failure?
2) I would also like to send mail on receiving SNMP Trap. I have added traphandle in snmptrapd.conf and mail are also getting triggered upon Trap reception. I would like to know how to pass information of traps into this email.
#traphandle default /usr/bin/mail /usr/bin/printf "%b" "Nagios Environment: Test\n\nType: Trap Alert\n\n" | mail -s "**Nagios Environment: Test Type: Trap Alert Agent Address: %A Agent Hostname: %B **" -r "FROM_ADDRESS" RECIPIENT_ADDRESS