I have issues on redirecting snmp traps to zabbix. I have followed the tutorials I've found on the forum but it doesn't help me out.
Here is how my snmptrapd.conf reads:
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
authCommunity log,execute,net public
traphandle default /bin/bash /home/zabbix/bin/snmptrap.sh
#outputOption efnQs
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
and here is how my snmptrap.sh reads:
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$
# CONFIGURATION
ZABBIX_SERVER="10.18.2.90";
ZABBIX_PORT="10051";
ZABBIX_SENDER="/usr/local/bin/zabbix_sender";
KEY="snmptraps";
DEFAULTHOST="dummyTrapper";
NODATASTRING="NO_NEW_DATA"
# END OF CONFIGURATION
read hostname
read ip
read uptime
read oid
read address
read community
read enterprise
hostname=`echo $hostname|cut -f2' '`
oid=`echo $oid|cut -f2 -d' '`
address=`echo $address|cut -f2 -d' '`
community=`echo $community|cut -f2 -d' '`
enterprise=`echo $enterprise|cut -f2 -d' '`
oid=`echo $oid|cut -f11 -d'.'`
community=`echo $community|cut -f2 -d'"'`
str="$hostname $address $community $enterprise $oid"
result=`$ZABBIX_SENDER $ZABBIX_SERVER $ZABBIX_PORT $hostname $KEY "$str"`
echo result is: $result
if [ "$result" = "OK" ]; then
$ZABBIX_SENDER $ZABBIX_SERVER $ZABBIX_PORT $hostname $KEY "$NODATASTRING"
else
$ZABBIX_SENDER $ZABBIX_SERVER $ZABBIX_PORT $DEFAULTHOST $KEY "$str"
$ZABBIX_SENDER $ZABBIX_SERVER $ZABBIX_PORT $DEFAULTHOST $KEY "$NODATASTRING"
fi
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$
where: - 10.18.2.90 is my zabbix server's IP address
- dummyTrapper is a dummy host I've configured to receive all the traps
- snmptraps is the key of an item of type Zabbix Trapper i've created for host dummyTrapper.
I receive the traps, they go to my snmptrapd log but nothing in zabbix.
Can anybody help me please!
Here is how my snmptrapd.conf reads:
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
authCommunity log,execute,net public
traphandle default /bin/bash /home/zabbix/bin/snmptrap.sh
#outputOption efnQs
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
and here is how my snmptrap.sh reads:
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$
# CONFIGURATION
ZABBIX_SERVER="10.18.2.90";
ZABBIX_PORT="10051";
ZABBIX_SENDER="/usr/local/bin/zabbix_sender";
KEY="snmptraps";
DEFAULTHOST="dummyTrapper";
NODATASTRING="NO_NEW_DATA"
# END OF CONFIGURATION
read hostname
read ip
read uptime
read oid
read address
read community
read enterprise
hostname=`echo $hostname|cut -f2' '`
oid=`echo $oid|cut -f2 -d' '`
address=`echo $address|cut -f2 -d' '`
community=`echo $community|cut -f2 -d' '`
enterprise=`echo $enterprise|cut -f2 -d' '`
oid=`echo $oid|cut -f11 -d'.'`
community=`echo $community|cut -f2 -d'"'`
str="$hostname $address $community $enterprise $oid"
result=`$ZABBIX_SENDER $ZABBIX_SERVER $ZABBIX_PORT $hostname $KEY "$str"`
echo result is: $result
if [ "$result" = "OK" ]; then
$ZABBIX_SENDER $ZABBIX_SERVER $ZABBIX_PORT $hostname $KEY "$NODATASTRING"
else
$ZABBIX_SENDER $ZABBIX_SERVER $ZABBIX_PORT $DEFAULTHOST $KEY "$str"
$ZABBIX_SENDER $ZABBIX_SERVER $ZABBIX_PORT $DEFAULTHOST $KEY "$NODATASTRING"
fi
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$
where: - 10.18.2.90 is my zabbix server's IP address
- dummyTrapper is a dummy host I've configured to receive all the traps
- snmptraps is the key of an item of type Zabbix Trapper i've created for host dummyTrapper.
I receive the traps, they go to my snmptrapd log but nothing in zabbix.
Can anybody help me please!
Comment