Ad Widget

Collapse

snmptrapd.conf?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maxijose
    Member
    • May 2007
    • 36

    #1

    snmptrapd.conf?

    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!
  • bill.unger
    Member
    • Jun 2007
    • 79

    #2
    We may be battling the same problem. A couple of quick questions:

    What is the output of the snmptrap.sh script?

    What happens if take the output from snmptrap.sh and run it from the command prompt?

    Bill

    Comment

    • maxijose
      Member
      • May 2007
      • 36

      #3
      My problem does not come from snmptrap.sh in fact.
      I have a problem with ZABBIX_SENDER!!!
      When I redirect the output of snmptrap.sh in a file. I get:
      sent: 0; failed: 1; total: 1 which is the result of zabbix_sender (called in snmptrap.sh)

      i have the same result when I try to use zabbix_sender alone like:

      zabbix_sender zabbix_server 10051 dummyTrapper snmptraps 25

      where dummyTrapper is a dummy host I created to receive traps and snmptraps is the key of an item of type Zabbix trapper I created on dummyTrapper. The information i want to receive is of type alphanumeric and I want to receive the value 25 in zabbix.

      Is my binary zabbix_sender good?

      I would like some help please

      Comment

      • ahanson
        Junior Member
        • Sep 2007
        • 15

        #4
        Same Issue

        I'm finding the documentation on this piece pretty lacking. I see where my disconnect is happening. I'm executing a zabbix_sender command from the command prompt, and it fails. Unfortunately, all I can see is that it failed, but I have no idea why. Is there any way I can get any more information out of it? Is there somewhere I can read documentation that is up to date on how to get this up and running? I'm not even convinced I have the command line formatting correctly because the help from the zabbix_sender tool differs from the snmptrap.sh script pretty drastically. Any help here at all?

        Comment

        • alj
          Senior Member
          • Aug 2006
          • 188

          #5
          Originally posted by maxijose
          My problem does not come from snmptrap.sh in fact.
          I have a problem with ZABBIX_SENDER!!!
          When I redirect the output of snmptrap.sh in a file. I get:
          sent: 0; failed: 1; total: 1 which is the result of zabbix_sender (called in snmptrap.sh)

          i have the same result when I try to use zabbix_sender alone like:

          zabbix_sender zabbix_server 10051 dummyTrapper snmptraps 25

          where dummyTrapper is a dummy host I created to receive traps and snmptraps is the key of an item of type Zabbix trapper I created on dummyTrapper. The information i want to receive is of type alphanumeric and I want to receive the value 25 in zabbix.

          Is my binary zabbix_sender good?

          I would like some help please

          zabbix_sender is broken in 1.4.2. Use zabbix_sender from older zabbix agent.

          Comment

          • ahanson
            Junior Member
            • Sep 2007
            • 15

            #6
            Good news is that I'm still on 1.4.1 for now. I have actually figured out what was going on here. From some other post on this forum (sorry I lost the link, so I can't fully give credit where credit is due) I read that in zabbix sender you have to send the hostname, not the IP address or even the DNS name of the host you are sending information for. Apparently, that is the only unique key by default, even though in my setup IP Address and DNS Name are both unique. A recommendation for the Zabbix developers: Let us use IP Address and/or DNS Name. Typically these are unique and the Zabbix host name is a much more user friendly name to display in Zabbix for me. If I wanted to make the hostname a unique value in my setup I would simply copy it from the IP or DNS field anyway.

            Comment

            Working...