Snmptrap problem

Hi all.
I'm trying to config Snmptrap on my router. I have a somt device on the network that can sends traps
i installed snmp-utils snmptrapd.
i run the command to start snmptrapd:

snmptrapd -Ln -f -Lf /etc/snmp/snmptrapd.log

(I want to write logs to this folder) and everything works, i get traps in folderlog

Here is the output of the command ps

root@******:/etc/snmp# ps | grep snmp
  5576 root 3152 S snmptrapd -Ln -f -Lf /etc/snmp/snmptrapd.log
  5659 root 1312 S grep snmp

In LuCi interface i see autoload service snmptrapd:

1

But when I restart the router I see the following

root@******:/etc/snmp# ps | grep snmp
  1759 root 3152 S /usr/sbin/snmptrapd -Lf /dev/null -f
  5063 root 1312 S grep snmp

Why does everything "fly" to /dev/null ???
Why it happens ?
How to fix it ?
Help, please.

Depending on the router and its flash, it may not be a good idea to write to /etc
Then it depends on how the service starts snmptrapd. /etc/init.d/snmptrapd

1 Like

Thanks.

Indeed I opened the file and there was a line.

start_service() {
        procd_open_instance

        procd_set_param command $PROG -Lf /dev/null -f
        procd_set_param respawn

        procd_close_instance
}

I edited it and everything is ok
Please tell me, where is the best place to store the log files?

Traditionally /var/log.
In OpenWrt it might be linked to /tmp, which is ramfs and will be erased at reboot, but it is done so that the frequent writes will not wear out the flash.

2 Likes