Hey everyone,
Spent the entire weekend frustrated with that, thought i'd post this. I've looked at several threads regarding this and there a few customized snmptrap.sh scripts but those threads were relatively old, so i'm not sure if the new script that came with 1.6.4 worked out of the box.
Here is what i've done.
This is my /etc/snmptrapd.conf:
traphandle default /bin/bash /usr/local/sbin/snmptrap.sh
ignoreauthfailure 1
logoption f /var/log/snmpd2.log
disableAuthorization yes
This is my /usr/local/sbin/snmptrap.sh:
ZABBIX_SERVER="127.0.0.1";
ZABBIX_PORT="10051";
ZABBIX_SENDER="/usr/local/sbin/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'"'`
str="$hostname $address $community $enterprise $oid"
$ZABBIX_SENDER $ZABBIX_SERVER $ZABBIX_PORT $HOST $KEY "$str"
My host in zabbix is setup as the following:
Name: snmptraps
IP Address: 0.0.0.0
Connect to: IP Address
Zabbix agent port: 10051
Status: Monitored
I then created an item under this host:
Description: test
Type: Zabbix trapper
Key: snmptraps
Type of information: Character
Status: Active
I then executed snmptrapd with this command:
#/usr/local/sbin/snmptrapd -C -c /etc/snmptrapd.conf -Lf /var/log/net-snmptrapd.conf
I'm tailing /var/log/net-snmptrapd.conf as well as /var/log/snmpd2.log and /tmp/zabbix_server for any errors.
I then issue a test snmp command to make sure that the snmptrap is receving the info:
#snmptrap -v1 -cpublic localhost .1.3.6.1.6.3.1.1.5.2 0 0 "" "" .1.3.6.1.4.1 s "hello"
Both my log files get logged with this "2009-06-08 12:07:35 0.0.0.0(via UDP: [0.0.0.0]->[127.0.0.1]:-21909) TRAP, SNMP v1, community public
SNMPv2-MIB::warmStart Cold Start Trap (0) Uptime: 3 days, 22:53:21.68
SNMPv2-SMI::enterprises = STRING: "hello"
I then check the overview for my snmptraps host and nothing shows. I suspect that it is either not executing the snmptraps.sh script or there is an issue with my configuration. So snmptrapd is working but i'm not sure if it is executing that script. Is there any way I can determine if it is indeed launching the script or if the problem lies with somwhere in the script? I am on Solaris 10 BTW.
Can anyone point me in the right direction here, I've been looking at this stuff for a very long time. Everything above is copied and pasted. I don't think there are any misconfigs but i'm sure there is somewhere.
I really appreciate the help and support from this forum! Thanks in advanced!!!
Spent the entire weekend frustrated with that, thought i'd post this. I've looked at several threads regarding this and there a few customized snmptrap.sh scripts but those threads were relatively old, so i'm not sure if the new script that came with 1.6.4 worked out of the box.
Here is what i've done.
This is my /etc/snmptrapd.conf:
traphandle default /bin/bash /usr/local/sbin/snmptrap.sh
ignoreauthfailure 1
logoption f /var/log/snmpd2.log
disableAuthorization yes
This is my /usr/local/sbin/snmptrap.sh:
ZABBIX_SERVER="127.0.0.1";
ZABBIX_PORT="10051";
ZABBIX_SENDER="/usr/local/sbin/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'"'`
str="$hostname $address $community $enterprise $oid"
$ZABBIX_SENDER $ZABBIX_SERVER $ZABBIX_PORT $HOST $KEY "$str"
My host in zabbix is setup as the following:
Name: snmptraps
IP Address: 0.0.0.0
Connect to: IP Address
Zabbix agent port: 10051
Status: Monitored
I then created an item under this host:
Description: test
Type: Zabbix trapper
Key: snmptraps
Type of information: Character
Status: Active
I then executed snmptrapd with this command:
#/usr/local/sbin/snmptrapd -C -c /etc/snmptrapd.conf -Lf /var/log/net-snmptrapd.conf
I'm tailing /var/log/net-snmptrapd.conf as well as /var/log/snmpd2.log and /tmp/zabbix_server for any errors.
I then issue a test snmp command to make sure that the snmptrap is receving the info:
#snmptrap -v1 -cpublic localhost .1.3.6.1.6.3.1.1.5.2 0 0 "" "" .1.3.6.1.4.1 s "hello"
Both my log files get logged with this "2009-06-08 12:07:35 0.0.0.0(via UDP: [0.0.0.0]->[127.0.0.1]:-21909) TRAP, SNMP v1, community public
SNMPv2-MIB::warmStart Cold Start Trap (0) Uptime: 3 days, 22:53:21.68
SNMPv2-SMI::enterprises = STRING: "hello"
I then check the overview for my snmptraps host and nothing shows. I suspect that it is either not executing the snmptraps.sh script or there is an issue with my configuration. So snmptrapd is working but i'm not sure if it is executing that script. Is there any way I can determine if it is indeed launching the script or if the problem lies with somwhere in the script? I am on Solaris 10 BTW.
Can anyone point me in the right direction here, I've been looking at this stuff for a very long time. Everything above is copied and pasted. I don't think there are any misconfigs but i'm sure there is somewhere.
I really appreciate the help and support from this forum! Thanks in advanced!!!
Comment