RHEL5 で HP SMH などのヘルスチェックのアプリケーションを インストールしていると, /var/log/messages に snmp のログがうざいほど出る.
そんなときは,/etc/sysconfig/snmpd.options を編集し,
OPTIONS="-LS 5 d -Lf /dev/null -p /var/run/snmpd.pid -a"
とする.
"-L" オプションの詳しい説明があまりなくてよく分からないが, 上記のようにすることで, NOTICE レベル以上のログのみを出力するように制限できるようだ.
http://www.jp.redhat.com/FAQ/support3.html#26
"-L" オプションについては,以下のサイトを参照. http://linux.die.net/man/1/snmpcmd
抜粋
-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: 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.
なので,
OPTIONS="-LS 5 0 -Lf /dev/null -p /var/run/snmpd.pid -a"
などとして,LOG_LOCAL0 ファシリティで出力し, さらに,/etc/syslog.conf を調整して snmp のログ(LOG_LOCAL0)は別ファイルに 出力させた方が messages の見通しは効く.
/etc/syslog.conf の変更箇所の例
*.info;mail.none;authpriv.none;cron.none /var/log/messages
を
*.info;mail.none;authpriv.none;cron.none;local0.none /var/log/messages local0.* /var/log/snmpd.log