Snmpd Cannot Statfs Directory

Snmpd Cannot Statfs Directory

On Ubuntu 16.04, I'm running snmpd for monitoring. In my syslog, I'm seeing the following message every 5 minutes:

Sep 23 11:10:11 kvm snmpd[3427]: Cannot statfs /sys/kernel/debug/tracing: Permission denied

The snmp daemon is being run under the snmp user. /sys/kernel/debug has permissions:

drwx------ 27 root root 0 Sep 22 21:34 .

So, this error makes sense. What doesn't make sense, however, is why snmpd is trying to stat this directory. Any thoughts?

2 Answers

The following setting is in /etc/default/snmpd. The Permission Denied message goes away when I change to Ls3d from Lsd, so I assume that it is related to log level.

SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux,mteTrigger,mteTriggerConf -p /run/snmpd.pid'

I found some information about snmpd log level in this question on ServerFault.

1

This is an older post but it is the first hit on DuckDuckGo so I am going to post a clarification since I've been working on this all morning. I am running Debian 9 with systemd, so you need to edit /lib/systemd/system/snmpd.service and reload using systemctl daemon-reload as stated previously. You also need to restart snmpd using systemctl restart snmpd. You can check the command line used to actually start the service using systemctl status snmpd.

The instruction above to change -Lsd to -Ls3d is incorrect. This option is case-sensitive and -Ls3d does nothing. It also doesn't throw an error when used to start the service. The correct option is -LS3d. From the man page:

-Ls FACILITY
Log messages via syslog, using the specified facility ('d' for LOG_DAEMON, 'u' for 
LOG_USER, or '0'-'7' for LOG_LOCAL0 through LOG_LOCAL7).
There are also "upper case" versions of each of these options, which allow the 
corresponding logging mechanism to be restricted to certain priorities of message.

For -LF and -LS the priority specification comes before the file or facility token.
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Maya Lin-Takahashi
Author

Maya Lin-Takahashi

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.