diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 16:28:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 16:28:20 +0000 |
commit | dcc721a95bef6f0d8e6d8775b8efe33e5aecd562 (patch) | |
tree | 66a2774cd0ee294d019efd71d2544c70f42b2842 /tests/sndrcv_omsnmpv1_udp.sh | |
parent | Initial commit. (diff) | |
download | rsyslog-dcc721a95bef6f0d8e6d8775b8efe33e5aecd562.tar.xz rsyslog-dcc721a95bef6f0d8e6d8775b8efe33e5aecd562.zip |
Adding upstream version 8.2402.0.upstream/8.2402.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | tests/sndrcv_omsnmpv1_udp.sh | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/sndrcv_omsnmpv1_udp.sh b/tests/sndrcv_omsnmpv1_udp.sh new file mode 100755 index 0000000..a259e96 --- /dev/null +++ b/tests/sndrcv_omsnmpv1_udp.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# alorbach, 2019-11-27 +# Required Packages +# pip install pysnmp +# +# Ubuntu 18 Packages needed +# apt install snmp libsnmp-dev snmp-mibs-downloader +# +# This file is part of the rsyslog project, released under ASL 2.0 +. ${srcdir:=.}/diag.sh init +export TESTMESSAGES=10 + +generate_conf +export PORT_SNMP="$(get_free_port)" +# Start SNMP Trap Receiver +snmp_start_trapreceiver ${PORT_SNMP} ${RSYSLOG_OUT_LOG} + +add_conf ' +module( load="../plugins/imtcp/.libs/imtcp") +input( type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port" ) + +module( load="../plugins/omsnmp/.libs/omsnmp" ) + +# set up the action +template(name="outfmt" type="string" string="%msg:F,58:2%\n") +:msg, contains, "msgnum:" action( type="omsnmp" + name="name" + server="127.0.0.1" + port="'${PORT_SNMP}'" + version="0" + community="public" + enterpriseOID="1.3.6.1.2.1.192.0.1" + messageOID="1.3.6.1.2.1.192.1.2.1.11" + TrapType="6" + specificType="0" + ) +' +startup +tcpflood -p$TCPFLOOD_PORT -m${TESTMESSAGES} +netstat -l + +shutdown_when_empty +wait_shutdown +snmp_stop_trapreceiver +content_count_check "msgnum:" ${TESTMESSAGES} +exit_test |