Ad Widget

Collapse

SNMP in Zabbix 1.6

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tazzu
    Junior Member
    • Nov 2006
    • 26

    #1

    SNMP in Zabbix 1.6

    Hi Guys,

    I have a question for using SNMP in Zabbix 1.6 . It's the first time that i want to use snmp in Zabbix. I've already monitored performance Data with Zabbix 1.4 but that was with the zabbix agent.

    So I've found several documentation about snmp in Zabbix. But I'm a little bit confused now (The most Threads or How-To are for 1.4). Can someone explain in short words how I can receive SNMP Traps with Zabbix 1.6? I've compiled zabbix with option --with-net-snmp .

    For now, I only want to receive the traps (no active polling).

    Regards

    Tazzu
  • tazzu
    Junior Member
    • Nov 2006
    • 26

    #2
    What I've done:

    Copyed snmptrap.sh to /home/zabbix/zabbix-1.6/bin/snmptrap.sh
    Config:

    ZABBIX_SERVER="localhost";
    ZABBIX_PORT="10050";
    ZABBIX_SENDER="/usr/sbin/zabbix_sender";
    KEY="snmptraps";
    HOST="snmptraps";

    snmpd.conf config:

    TRAPDRUN=yes
    outputOption efnQs
    traphandle default /bin/bash /home/zabbix/zabbix-1.6/bin/snmptrap.sh


    In Zabbix:

    I've addet a host called snmptraps. For this host I've created an item "snmptraps" as an "ZABBIX trapper".

    But I can't receive any traps when i use:

    snmptrap -v1 -c public localhost .1.3.6.1.6.3.1.1.5.2 0 0 "" "" .1.3.6.1.4.1 s "hello"

    What is wrong with my config?

    EDIT:

    I've found some errors in /var/log/net-snmpd.log:

    NET-SNMP version 5.3.0.1
    cannot open /proc/net/snmp6 ...


    I've addet this to /etc/snmptrapd.conf:
    TRAPDRUN=yes
    traphandle default /bin/bash /home/zabbix/zabbix-1.6/bin/snmptrap.sh

    I'm using Suse Linux Enterprise 10 (SLES 10)
    Last edited by tazzu; 20-10-2008, 13:46.

    Comment

    • tazzu
      Junior Member
      • Nov 2006
      • 26

      #3
      Ok I've made some changes. Now my snmpd is working fine:



      I've made some changes in snmptrap.sh so that I can see what happens:

      Code:
      # CONFIGURATION
      
      ZABBIX_SERVER="localhost";
      ZABBIX_PORT="10051";
      
      ZABBIX_SENDER="/usr/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"
      echo " " > /home/zabbix/zabbix-1.6/bin/test.log
      echo $ZABBIX_SENDER "ZABBIX_SENDER" >> /home/zabbix/zabbix-1.6/bin/test.log
      echo $ZABBIX_SERVER "ZABBIX_SERVER" >> /home/zabbix/zabbix-1.6/bin/test.log
      echo $ZABBIX_PORT "ZABBIX_PORT" >> /home/zabbix/zabbix-1.6/bin/test.log
      echo $HOST "HOST" >> /home/zabbix/zabbix-1.6/bin/test.log
      echo $KEY "KEY" >> /home/zabbix/zabbix-1.6/bin/test.log
      echo "$str" "str" >> /home/zabbix/zabbix-1.6/bin/test.log
      
      #$ZABBIX_SENDER $ZABBIX_SERVER $ZABBIX_PORT $HOST $KEY $str"
      echo $ZABBIX_SENDER $ZABBIX_SERVER $ZABBIX_PORT $HOST $KEY \'"$str"\' >> /home/zabbix/zabbix-1.6/bin/test.log
      $ZABBIX_SENDER $ZABBIX_SERVER $ZABBIX_PORT $HOST $KEY \'"$str"\'
      Then I executed:

      Code:
      snmptrap -v1 -c public localhost .1.3.6.1.6.3.1.1.5.2 0 0 "" "" .1.3.6.1.4.1 s "hello"
      in test.log now:
      /usr/sbin/zabbix_sender ZABBIX_SENDER
      localhost ZABBIX_SERVER
      10051 ZABBIX_PORT
      snmptraps HOST
      snmptraps KEY
      localhost "hello" public SNMPv2-MIB::warmStart SNMPv2-MIB::coldStart str
      /usr/sbin/zabbix_sender localhost 10051 snmptraps snmptraps 'localhost "hello" public SNMPv2-MIB::warmStart SNMPv2-MIB::coldStart'

      So I've tryed to execute the sender manually:

      Code:
      /usr/sbin/zabbix_sender localhost 10051 snmptraps snmptraps 'localhost "hello" public SNMPv2-MIB::warmStart SNMPv2-MIB::coldStart'
      Response:

      usage: zabbix_sender [-Vhv] {[-zpsI] -ko | [-zpI] -i <file>} [-c <file>]

      Now I'm a little bit confused... Anyone who can help?

      It seems that I've got an old sender:

      Join the friendly and open Zabbix community on our forums and social media platforms.


      I've downloaded the newest Version of Zabbix 1.6 ! Maybe this will help people who have the same problems than me.
      Last edited by tazzu; 20-10-2008, 15:33.

      Comment

      • Stephanizoly
        Junior Member
        • Jul 2009
        • 13

        #4
        Snmptrap and zabbix_sender

        Hello,

        I try to receive some traps via Zabbix, and it's a total disaster. I'm on it since last week...

        I followed two tutorials :
        - in one hand, i added some lines in the file : snmptrapd.conf
        TRAPDRUN = yes
        outputOption efnQs
        traphandle default /bin/bash /home/zabbix/bin/snmptrap.sh

        - then, i edit the file "snmptrap.sh" and i defined Zabbix_sender patch and another things...
        - finally i create host and item according to what i defined in "snmptrap.sh"


        For testing the sending of trap, in the shell i write this :
        snmptrapd -P -F "%02.2h:%02.2j TRAP %w.%q de %A\n"
        and
        snmptrap -v2c -c public 127.0.0.1 uptime trapoid .1.3.6 i 123
        if i don't write "trapoid", this command doesn't work...


        The result is :
        14:43 TRAP 0.0 from 0.0.0.0
        zabbix_sender [6581]: DEBUG: Answer [{
        "response":"success",
        "info";"Processed 1 Failed 0 Total 1 Seconds spent 0.102274"}]
        Into from server : "Processed 1 Failed 0 Total 1 Seconds spent 0.102274"
        sent : 1; skipped : 0; total : 1


        it's seems to be OK but i received on Zabbix "localhost =" !! And, in a file test.log which returns the value of the string sent, i have :
        (...)
        localhost = str
        /home/.../zabbix_sender localhost 10051 Server_Zabbix snmptraps 'localhost ='


        Moreover, i try to use zabbix_sender and i had to use this command :
        /home/.../zabbix_sender -z localhost -p 10051 -s Server_Zabbix -k snmptraps -o 'test'
        to receive "test" on Zabbix web page (this works)


        Anyone knows why i receive 'localhost =' in my string instead of 'localhost 123 public SNMPv2-SMI::dod' ??
        Or why do i have TRAP 0.0 from 0.0.0.0 ??

        A help will greatly appreciated....

        Stephanie

        Comment

        • prashants
          Junior Member
          • Dec 2008
          • 4

          #5
          Originally posted by tazzu
          Response:

          usage: zabbix_sender [-Vhv] {[-zpsI] -ko | [-zpI] -i <file>} [-c <file>]

          Now I'm a little bit confused... Anyone who can help?
          change below line in "snmptrap.sh"
          Code:
          $ZABBIX_SENDER $ZABBIX_SERVER $ZABBIX_PORT $HOST $KEY \'"$str"\'

          with this one & try.
          Code:
          $ZABBIX_SENDER -z $ZABBIX_SERVER -p $ZABBIX_PORT -s $HOST -k $KEY -o "$str"

          Hope this will solve your problem..


          -Prashant

          Comment

          • Stephanizoly
            Junior Member
            • Jul 2009
            • 13

            #6
            my solution :

            There was a difference between the librairies and headers used by the snmp i installed on my computer and what was written in yast... once I resolved this problem, the snmptrap worked.

            thanks for yours helps

            Comment

            • natreen
              Junior Member
              • Sep 2009
              • 5

              #7
              Is there a comprehensive tutorial in this somewhere? I´m new to Zabbix and I would like to use SNMP with it (I don´t want to install agents on the other windows servers and SNMP delivers all information I need. Thanks for an answer!

              Comment

              Working...