Greetings all,
I have setup and have snmp trapping working correcting for several devices on my network. However, I have one vendor of devices that I cannot seem to trap correctly.
Here is a sample of the trap data:
June 8 09:20:30 zabbix snmptrapd[1041]: 10.100.5.109: Enterprise Specific Trap (AIDU-MIB::alarmTrap) Uptime: 118 days, 19:27:45.46, AIDU-MIB::genEquipCurrentAlarmCounter = INTEGER: 589246043, AIDU-MIB::genEquipCurrentAlarmRaisedTimeT = INTEGER: 1305902292, AIDU-MIB::genEquipCurrentAlarmId = INTEGER: 306, AIDU-MIB::genEquipCurrentAlarmSlotId = INTEGER: 1, AIDU-MIB::genEquipCurrentAlarmInstance = INTEGER: 1, AIDU-MIB::genEquipCurrentAlarmSeverity = INTEGER: warning(4), AIDU-MIB::genEquipCurrentAlarmIfIndex = INTEGER: 407, AIDU-MIB::genEquipCurrentAlarmModule = STRING: "IDU", AIDU-MIB::genEquipCurrentAlarmDesc = STRING: "E1/DS1 unexpected signal on port #7", AIDU-MIB::genEquipMostSevereAlarm = INTEGER: major(2), AIDU-MIB::genEquipNetworkAgentIp = IpAddress: 10.100.5.109, AIDU-MIB::genEquipCurrentAlarmState = INTEGER: cleared(0), AIDU-MIB::genEquipTrapCfgMgrCLLI = ""
I can verify that the above trap was received by Zabbix as it is recorded in the syslog. However when I check the latest data for the device that should receive the trap, the history is empty. I can confirm the device is working if I pass direct zabbix_sender commands to be processed.
I'm guessing the problem has something to do with the nature of the structure of the trap. Here is my snmptrap.sh (taken from the Zabbix book):
- - - -
# CONFIGURATION
ZABBIX_SERVER="localhost";
ZABBIX_PORT="10051";
ZABBIX_SENDER="/usr/bin/zabbix_sender";
KEY="snmptraps";
HOST="snmptraps";
# END OF CONFIGURATION
read hostname
read ip
read uptime
read oid
read address
read community
read enterprise
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'"'`
export HOME=/root
ZABBIXHOSTID=$(echo "select hostid,host from zabbix.hosts where ip=\"$hostname\" order by 'hostid' limit 1;" | mysql -N 2> /dev/null)
ZABBIXID=$(echo $ZABBIXHOSTID | cut -d" " -f1)
ZABBIXHOST=$(echo $ZABBIXHOSTID | cut -d" " -f2-)
[[ "$ZABBIXHOST" ]] && {
TRAPOID=$(echo $oid | cut -d: -f3)
if [ "$TRAPOID" ]; then
ZABBIXITEM=$(echo "select key_ from zabbix.items where key_=\"$TRAPOID\" and hostid=\"$ZABBIXID\";" | mysql -N 2> /dev/null)
if [ "$ZABBIXITEM" ]; then
KEY=$ZABBIXITEM
HOST=$ZABBIXHOST
elif [ "$(echo "select key_ from zabbix.items where key_='snmptraps' and hostid=\"$ZABBIXID\";" | mysql -N 2> /dev/null)" ]; then
HOST=$ZABBIXHOST
fi
elif [ "$(echo "select key_ from zabbix.items where key_='snmptraps' and hostid=\"$ZABBIXID\";" | mysql -N 2> /dev/null)" ]; then
HOST=$ZABBIXHOST
fi
}
str="$hostname $address $community $enterprise $oid"
$ZABBIX_SENDER -z $ZABBIX_SERVER -p $ZABBIX_PORT -s "$HOST" -k "$KEY" -o "$str"
- - - -
I'm unsure how to interrupt what data is being pulled from the trap and processed by the script. At first I thought it was because the trap message ended in ("") which might indicate there is no data to pass to Zabbix but even using Zabbix_sender commands with empty data I at last have a blank history entry.
Would anyone be able to give me a few hints please as to how to begin working this problem?
Thank you kindly,
Stephen
I have setup and have snmp trapping working correcting for several devices on my network. However, I have one vendor of devices that I cannot seem to trap correctly.
Here is a sample of the trap data:
June 8 09:20:30 zabbix snmptrapd[1041]: 10.100.5.109: Enterprise Specific Trap (AIDU-MIB::alarmTrap) Uptime: 118 days, 19:27:45.46, AIDU-MIB::genEquipCurrentAlarmCounter = INTEGER: 589246043, AIDU-MIB::genEquipCurrentAlarmRaisedTimeT = INTEGER: 1305902292, AIDU-MIB::genEquipCurrentAlarmId = INTEGER: 306, AIDU-MIB::genEquipCurrentAlarmSlotId = INTEGER: 1, AIDU-MIB::genEquipCurrentAlarmInstance = INTEGER: 1, AIDU-MIB::genEquipCurrentAlarmSeverity = INTEGER: warning(4), AIDU-MIB::genEquipCurrentAlarmIfIndex = INTEGER: 407, AIDU-MIB::genEquipCurrentAlarmModule = STRING: "IDU", AIDU-MIB::genEquipCurrentAlarmDesc = STRING: "E1/DS1 unexpected signal on port #7", AIDU-MIB::genEquipMostSevereAlarm = INTEGER: major(2), AIDU-MIB::genEquipNetworkAgentIp = IpAddress: 10.100.5.109, AIDU-MIB::genEquipCurrentAlarmState = INTEGER: cleared(0), AIDU-MIB::genEquipTrapCfgMgrCLLI = ""
I can verify that the above trap was received by Zabbix as it is recorded in the syslog. However when I check the latest data for the device that should receive the trap, the history is empty. I can confirm the device is working if I pass direct zabbix_sender commands to be processed.
I'm guessing the problem has something to do with the nature of the structure of the trap. Here is my snmptrap.sh (taken from the Zabbix book):
- - - -
# CONFIGURATION
ZABBIX_SERVER="localhost";
ZABBIX_PORT="10051";
ZABBIX_SENDER="/usr/bin/zabbix_sender";
KEY="snmptraps";
HOST="snmptraps";
# END OF CONFIGURATION
read hostname
read ip
read uptime
read oid
read address
read community
read enterprise
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'"'`
export HOME=/root
ZABBIXHOSTID=$(echo "select hostid,host from zabbix.hosts where ip=\"$hostname\" order by 'hostid' limit 1;" | mysql -N 2> /dev/null)
ZABBIXID=$(echo $ZABBIXHOSTID | cut -d" " -f1)
ZABBIXHOST=$(echo $ZABBIXHOSTID | cut -d" " -f2-)
[[ "$ZABBIXHOST" ]] && {
TRAPOID=$(echo $oid | cut -d: -f3)
if [ "$TRAPOID" ]; then
ZABBIXITEM=$(echo "select key_ from zabbix.items where key_=\"$TRAPOID\" and hostid=\"$ZABBIXID\";" | mysql -N 2> /dev/null)
if [ "$ZABBIXITEM" ]; then
KEY=$ZABBIXITEM
HOST=$ZABBIXHOST
elif [ "$(echo "select key_ from zabbix.items where key_='snmptraps' and hostid=\"$ZABBIXID\";" | mysql -N 2> /dev/null)" ]; then
HOST=$ZABBIXHOST
fi
elif [ "$(echo "select key_ from zabbix.items where key_='snmptraps' and hostid=\"$ZABBIXID\";" | mysql -N 2> /dev/null)" ]; then
HOST=$ZABBIXHOST
fi
}
str="$hostname $address $community $enterprise $oid"
$ZABBIX_SENDER -z $ZABBIX_SERVER -p $ZABBIX_PORT -s "$HOST" -k "$KEY" -o "$str"
- - - -
I'm unsure how to interrupt what data is being pulled from the trap and processed by the script. At first I thought it was because the trap message ended in ("") which might indicate there is no data to pass to Zabbix but even using Zabbix_sender commands with empty data I at last have a blank history entry.
Would anyone be able to give me a few hints please as to how to begin working this problem?
Thank you kindly,
Stephen


Comment