증상 : Ubuntu 16.04 환경에서 snmp 설정하고 나서 30초 단위로 첨부된 이미지와 같은 에러발생
원인 :
Ubuntu & Debian 계열에서는 SNMP를 설치하고 나면 다음과 같은 옵션을 가지게 된다.
이중 로깅 옵션(-L flag)을 보게 되면 여기서는 -Lsd 즉 로그 디버그 수준에 메세지도 syslog 에 남기라고 되어있다.
LOG_DEBUG 를 제외시키기 위헤서는 7(d) 레벨에서 6(i) 레벨로 바꾸어서 운영하면 된다.
$ cat /etc/default/snmpd
.........................................
# snmpd options (use syslog, close stdin/out/err).
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux,mteTrigger,mteTriggerConf -p /run/snmpd.pid'
조치(해결) :
보통은 LOG_INFO(6) 나 LOG_ERROR(3) 을 권장한다.
$ sudo sed -i "s|-Lsd|-LS6d|" /etc/default/snmpd
$ cat /etc/default/snmpd
.........................................
# snmpd options (use syslog, close stdin/out/err).
SNMPDOPTS='-LS6d -Lf /dev/null -u snmp -g snmp -I -smux,mteTrigger,mteTriggerConf -p /run/snmpd.pid'
$ sudo /etc/snmpd/snmpd restart
LOGGING OPTIONS
The mechanism and destination to use for logging of warning and error messages can be controlled by passing various parameters to the -L flag.- -Le
- Log messages to the standard error stream.
- -Lf FILE
- Log messages to the specified file.
- -Lo
- Log messages to the standard output stream.
- -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. Using standard error logging as an example:
- -LE pri
- will log messages of priority 'pri' and above to standard error.
- -LE p1-p2
- will log messages with priority between 'p1' and 'p2' (inclusive) to standard error.
For -LF and -LS the priority specification comes before the file or facility token. The priorities recognised are:
- 0 or ! for LOG_EMERG,
1 or a for LOG_ALERT,
2 or c for LOG_CRIT,
3 or e for LOG_ERR,
4 or w for LOG_WARNING,
5 or n for LOG_NOTICE,
6 or i for LOG_INFO, and
7 or d for LOG_DEBUG.
Normal output is (or will be!) logged at a priority level of LOG_NOTICE