LoginSignup
0
1

More than 1 year has passed since last update.

ZABBIX: SNMPTTのログを出力させないようにする(CentOS8)

Posted at

タイトルそのまま。
snmptrapdの出力を他に飛ばしても、SNMPTTのログだけ/var/log/messagesに出力されてしまうので困った。
他にも困っている人。。。がいるとは思えないけど、ついでにsnmptrapdの出力先も変えるので参考にして欲しい。

SNMP TRAPD

/etc/sysconfig/snmptrapd
OPTIONS="-A -Lf /path/to/logfile.log -m +ALL -On -n"

尚、snmptrapdのオプションで直接出力先となるログファイルを指定することも可能だが、再起動するたびにログファイルがリフレッシュされることから、syslog経由でログを出力する。

参考にしたQiitaにはこのように書かれているが、実は-Aをつけるとその問題は解決する(バージョンによるかもしれないので、man snmptrapdで確認してもらえると嬉しい)

こんな感じで書かれてる。

man snmptrapd
       -A      Append to the log file rather than truncating it.

               Note that this needs to come before any  -Lf  options  that  it
               should apply to.

あ、-nをつけてるのはDNSによる名前解決を行わないようにするため。
閉塞網でDNSを用意していないのに問い合わせにいってしまっていた。
そうすると、DNS問い合わせがタイムアウトするまでのラグが発生したのでつけてる。

他のオプションについてはすでについているものだと思うので割愛。

snmptthandler-embedded

/usr/sbin/snmptthandler-embeddedの114行目をコメントアウト。

snmptthandler-embedded
112   # Cycle through all the varbinds  
113   foreach my $x (@$varbinds) { 
--- 114     printf "  %-30s type=%-2d value=%s\n", $x->[0], $x->[2], $x->[1];
+++ 114     #printf "  %-30s type=%-2d value=%s\n", $x->[0], $x->[2], $x->[1];
115 

参考

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1