Ad Widget

Collapse

Cannot stat SNMP trapper file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Beginner
    Junior Member
    • Feb 2017
    • 10

    #1

    Cannot stat SNMP trapper file

    Hello,

    I'm trying to get SNMP Traps to work, but am having alot of struggles with configuring so.

    I am working on an Ubuntu machine and have followed this guide https://www.zabbix.org/wiki/Start_wi...raps_in_Zabbix
    everything is basically the same expect for the package installations. And i didn't use the 2.2.1 version of the perl script but the 3.2.4 version, since i'm running zabbix on that version.

    I did try everything and got it eventually to work, but as soon as i cheered, it got stuck again after rebooting. If i'm looking at my zabbix_server log there is an error saying:
    Cannot stat file "tmp/zabbix_traps.tmp" no such file or directory.

    When i manually create this file, i won't get the errors but the tmp file won't get filled with data of the received traps.

    Also i've allowed port 161/udp and 162/udp with UFW and rebooted the machine.

    Any ideas and help is appreciated
    Bye

    EDIT: Also these are the steps i did when trying to achieven snmp trapping

    1. put zabbix trap receiver perl fil in /usr/bin and add execute permission in the perl file the trapping directory is /tmp/zabbix_traps.tmp
    2. add following lines to /etc/snmp/snmptrapd.conf

    authCommunity execute public
    authCommunite execute ZabbixServer
    perl do "/usr/bin/zabbix_trap_receiver.pl";

    3. enable snmp trapping in zabbix_server.conf and define tmp file

    StartSNMPTrapper=1
    SNMPTrapperFile=/tmp/zabbix_traps.tmp

    4. Add the MIB I want to use to /usr/share/snmp/mibs (DELL-SHADOW-MIB.txt) and define it in the /etc/snmp/snmp.conf with mibs +DELL-SHADOW-MIB
    5. Reboot and enable services snmptt snmptrapd snmpd
  • ovas
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Apr 2017
    • 138

    #2
    Hello!

    Taking in consideration error message:
    "Cannot stat file "tmp/zabbix_traps.tmp" no such file or directory."

    As per the documentation, if systemd parameter PrivateTmp is used, this file is unlikely to work in /tmp. Can it be your case?
    Can you please display the outputs from grep PrivateTmp /etc/systemd/ -R?

    Comment

    • Beginner
      Junior Member
      • Feb 2017
      • 10

      #3
      Originally posted by ovas
      Hello!

      Taking in consideration error message:
      "Cannot stat file "tmp/zabbix_traps.tmp" no such file or directory."

      As per the documentation, if systemd parameter PrivateTmp is used, this file is unlikely to work in /tmp. Can it be your case?
      Can you please display the outputs from grep PrivateTmp /etc/systemd/ -R?
      I've tried changing the destination of the file to other location but i will still get the same errors. Also it did work previously in this location.

      The command gives me this:
      /etc/systemd/sysinit.target.wants/systemd-timesyncd.server:PrivateTmp=yes

      That's all i'm getting
      Last edited by Beginner; 24-04-2017, 10:23.

      Comment

      • Beginner
        Junior Member
        • Feb 2017
        • 10

        #4
        Bump,

        I still need help with this problem. When i change the directory of the .tmp file in zabbixserver config file, and in the perl script, i will just get the same error but with different location of the error:

        28017:20170428:095549.904 cannot stat SNMP trapper file "/var/log/zabbix_traps.tmp": [2] No such file or directory

        1634:20170427:180827.384 cannot stat SNMP trapper file "/tmp/zabbix_traps.tmp": [2] No such file or directory

        Comment

        • ovas
          Senior Member
          Zabbix Certified Trainer
          Zabbix Certified SpecialistZabbix Certified Professional
          • Apr 2017
          • 138

          #5
          Hello!

          Some additional tips on troubleshooting this situations:
          1. Disable SElinux temporarily to see if an issue will persists.
          2. Make sure zabbix user can execute the full path and use the file:
          su - zabbix -c 'touch /tmp/zabbix_traps.tmp && echo test >> /tmp/zabbix_traps.tmp'

          Comment

          Working...