Ad Widget

Collapse

Not receiving SNMP traps in zabbix 6.2

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Comsau@90
    Junior Member
    • Feb 2023
    • 4

    #1

    Not receiving SNMP traps in zabbix 6.2

    I configured the SNMP traps my zabbix 6.2 server installed in ubuntu machine 22.02 but zabbix is not showing snmp traps for connected device .

    Please suggest the solution to rectify this issue .

    I followed this documnet link to configure zabbix snmp trap.
    https://blog.zabbix.com/snmp-traps-in-zabbix/8210/
  • tim.mooney
    Senior Member
    • Dec 2012
    • 1427

    #2
    Are the traps being written to the intermediate file that's used to pass information from snmptrapd (via a plugin or script) to Zabbix? Knowing the answer to that will suggest whether the problem is with the SNMP setup and reception or whether it's with Zabbix and getting the data from the intermediate file.

    Comment

    • Comsau@90
      Junior Member
      • Feb 2023
      • 4

      #3
      Hi ,

      Thnaks for your reply .

      I have added the following in /etc/snmp/snmptrapd.conf file

      authCommunity execute public
      perl do "/tmp/zabbix_trap_receiver.pl";

      Kindly sugget.

      Comment

      • tim.mooney
        Senior Member
        • Dec 2012
        • 1427

        #4
        The "/tmp/zabbix_trap_receiver.pl" should be writing any SNMP TRAPs that it receives to a file. Are the traps getting written to that file? Knowing an answer to that question tells us whether the problem is with the first part of the setup or with the last part of the setup.

        Comment

        • Comsau@90
          Junior Member
          • Feb 2023
          • 4

          #5
          Hello ,

          It's not writing any traps in snmptrapper file , checked with this command
          cat /tmp/zabbix_traps.tmp

          can you pls help me to check all these with proper command instruction.
          or else pls provide me a link/instruction to configure again all these for snmp traps.

          Comment

          • Comsau@90
            Junior Member
            • Feb 2023
            • 4

            #6
            As per this blog i configured the setup for snmptrap.
            https://blog.zabbix.com/snmp-traps-in-zabbix/8210/

            Comment

            • gcaselli
              Junior Member
              • Oct 2022
              • 6

              #7
              Hi All,

              I have the same problem, but the S.O is Debian 11. I can't receive any logs in the /tmp/zabbix_traps.tmp

              Any solution?

              Thanks

              Comment

              • tim.mooney
                Senior Member
                • Dec 2012
                • 1427

                #8
                Zabbix won't see the traps until you have snmptrapd correctly receiving traps and writing them to the file.

                Did you follow the SNMP trap setup for your version of Zabbix? https://www.zabbix.com/documentation...types/snmptrap

                Many Linux distros split the SNMP packages into many pieces, and the "plugin" to allow direct processing via a perl script is often in its own package. I think Debian calls it "libnet-snmp-perl", but I could be mistaken. In any case, make sure you have your distro's necessary SNMP+Perl package installed.

                Does your snmptrapd.conf file (wherever Debian keeps it; on RHEL it's /etc/snmp/snmptrapd.conf) have an "authCommunity execute" statement for whatever community your traps are using? Something like:

                Code:
                authCommunity    log,execute    notpublic
                perl do "/usr/local/libexec/monitoring/zabbix_trap_receiver.pl";
                At the start, you want both "log,execute", so you get log messages when traps are received. Once you have everything working, you can remove the "log" type from the "authCommunity" if you want.

                Is your "snmptrapd" service running?

                If you run "sudo ss -lunp" does "snmptrapd" show as listening on UDP port 162?

                Is there a firewall that would block connections to UDP port 162 on your Zabbix server?

                Assuming Debian 11 uses "systemd" for starting services, is "snmptrapd.service" set to use PrivateTmp? If so, there will be a "/tmp/systemd-private-<longhex-string>-snmptrapd.service-<randchars>" directory? If that directory does exist when snmptrapd is running, is your file getting written in that directory?

                Is AppArmor, SELinux, or some other access control system enabled on your Zabbix server? If it is, you'll need to tell AppArmor/SELinux that it's OK for snmptrapd to listen on port UDP 162, execute the script you specify, write to the file location you specify, etc.

                Once you've verified all those things, if you use the "snmptrap" command from another host, as documented in the install guide linked above, does sending a trap from another host get to your server? Knowing whether snmptrapd logs receiving one (even if the perl script still isn't writing it to the file) will tell you whether it's a reception problem or a executing/writing problem. Once you know that, you can further focus your debugging.​

                Comment

                • gcaselli
                  Junior Member
                  • Oct 2022
                  • 6

                  #9
                  Hi tim, thanks for the response.

                  I was able to solve my problem and now, the snmp traps works fine.

                  The problem was the ";" of the end of line: perl do "/usr/bin/zabbix_trap_receiver.pl"; <-- this

                  Then, at the top of the script, add the line: use NetSNMP::TrapReceiver;

                  After that, the traps were received correctly.

                  Comment


                  • tim.mooney
                    tim.mooney commented
                    Editing a comment
                    Thanks for following up and letting people know what the issue was for you. That will help future people that search these forums.
                • edgarquadros
                  Junior Member
                  • Jan 2023
                  • 1

                  #10
                  Hi!

                  In my case, I can see the traps in the /tmp/zabbix_traps.tmp but I can't see anything in Latest Data, even though I created snmptrap.falback item. Also, in the zabbix_server.log (I'm using just one server to all) I have not new info when a trap is received.

                  BR,
                  Edgar

                  Comment

                  Working...