金曜日, 11月 30, 2007

snmpdで「Connection from」が大量に出力される(その2)

以前にsnmpのログが大量に出力されるのを発見し、これの対処を行った。当時(2007/06)はCentOS4.xを使用していたが、CentOS5になって挙動が少し変わった様子。前回と同様に起動スクリプトのオプション「-Lsd」の部分を「-Le」に変更してからsnmpdを起動すると、snmpwalkで検索を行った結果と一緒に「Connection from」が標準出力に出てきた。

もう一度挙動を調べてみると、snmpcmdのmanページに次の記述が。
---
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).
---


「-Le」オプションでも良さそうな気はするが、メッセージが標準出力に出てしまうので今回はsyslog経由でログを保存することに。

1)snmpdの起動スクリプトのオプションを「-Ls6」としてlocal6ファシリティに送る設定に変更。
2)syslog.confを変更。messagesにlocal6を送らないのと、local6を個別に収集。
---
*.info;mail.none;authpriv.none;cron.none;local6.none /var/log/messages
local6.* /var/log/net-snmpd.log
---

0 件のコメント: