Created
December 1, 2025 12:55
-
-
Save indigo423/42cb314dcaa1b3b948357c8791e6c684 to your computer and use it in GitHub Desktop.
SNMP Trap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #/usr/bin/env bash | |
| VERSION="2c" | |
| COMMUNITY="s3cur17y" | |
| TARGET="192.168.11.77" | |
| PORT="10162" | |
| iptables -t nat -A POSTROUTING -d $TARGET -p udp --dport $PORT -j SNAT --to 10.42.255.1 | |
| snmptrap -v ${VERSION} -c ${COMMUNITY} ${TARGET}:${PORT} "" \ | |
| .1.3.6.1.4.1.61509.1.999 \ | |
| .1.3.6.1.4.1.61509.1.999.1.0 i 1 \ | |
| .1.3.6.1.4.1.61509.1.999.2.0 s "node-active" \ | |
| .1.3.6.1.4.1.61509.1.999.3.0 s "active" \ | |
| .1.3.6.1.4.1.61509.1.999.4.0 s "failure" \ | |
| .1.3.6.1.4.1.61509.1.999.5.0 s "health check failed" \ | |
| .1.3.6.1.4.1.61509.1.999.6.0 s "node-active" \ | |
| .1.3.6.1.4.1.61509.1.999.7.0 s "node-passive" | |
| iptables -t nat -D POSTROUTING -d $TARGET -p udp --dport $PORT -j SNAT --to 10.42.255.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment