0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Munin で snmp 経由でのデータ取得に失敗した時に確認すべき箇所

Posted at

え゛っ IPv4 優先なん?

普段、ワシは流量監視に Munin1 を使っちょるが、久々に新規構築しおる時に、自らトラップに嵌りに行ったけん、その経緯を忘備録として記して置く💦

localhost の罠

snmp 関連の設定で Munin のお作法に則り、node へのアクセスは localhost とする事になっちょるのだ(厳密には違う)が、その際に node の bind address を [::] として、IPv6 のみでポートを解放させていた事からこの問題に遭遇したんじゃな

ほじゃ、実際の動きはどうなっとるん?

perl にはワシは暗いけん、吐き出られちょるログから紐解いていく事にした✌
環境としては sysutils/munin-master 自身の監視に sysutils/munin-node から snmp 経由でルータが 4 台とう構成

最初に設定してエラーになっとる
2025/11/27 08:10:00 [INFO]: Starting munin-update
2025/11/27 08:10:00 [INFO] starting work in 31028 for example.osaka.jp ([::1]:4949).
2025/11/27 08:10:00 [INFO] starting work in 31029 for 10.60.20.203 (localhost:4949).
2025/11/27 08:10:00 Failed to connect to node localhost:4949/tcp : Socket is not connected
2025/11/27 08:10:00 [INFO] starting work in 31030 for 10.60.20.201 (localhost:4949).
2025/11/27 08:10:00 [ERROR] Munin::Master::UpdateWorker<SNMP;10.60.20.203> failed to connect to node
2025/11/27 08:10:00 Failed to connect to node localhost:4949/tcp : Socket is not connected
2025/11/27 08:10:00 [ERROR] Munin::Master::UpdateWorker<SNMP;10.60.20.201> failed to connect to node
2025/11/27 08:10:00 [INFO] starting work in 31031 for 10.60.20.101 (localhost:4949).
2025/11/27 08:10:00 [INFO] starting work in 31033 for 10.60.20.103 (localhost:4949).
2025/11/27 08:10:00 Failed to connect to node localhost:4949/tcp : Socket is not connected
2025/11/27 08:10:00 [ERROR] Munin::Master::UpdateWorker<SNMP;10.60.20.101> failed to connect to node
2025/11/27 08:10:00 Failed to connect to node localhost:4949/tcp : Socket is not connected
2025/11/27 08:10:00 [ERROR] Munin::Master::UpdateWorker<SNMP;10.60.20.103> failed to connect to node
2025/11/27 08:10:07 [INFO]: Munin-update finished for node surveillance;example.osaka.jp (7.44 sec)
2025/11/27 08:10:07 [INFO] Reaping Munin::Master::UpdateWorker<SNMP;10.60.20.103>.  Exit value/signal: 20/0
2025/11/27 08:10:07 [INFO] Reaping Munin::Master::UpdateWorker<SNMP;10.60.20.101>.  Exit value/signal: 20/0
2025/11/27 08:10:07 [INFO] Reaping Munin::Master::UpdateWorker<SNMP;10.60.20.201>.  Exit value/signal: 20/0
2025/11/27 08:10:07 [INFO] Reaping Munin::Master::UpdateWorker<SNMP;10.60.20.203>.  Exit value/signal: 20/0
2025/11/27 08:10:17 [INFO] Remaining workers: SNMP;10.60.20.101, SNMP;10.60.20.103, SNMP;10.60.20.203, SNMP;10.60.20.201
2025/11/27 08:10:17 [INFO] Reaping Munin::Master::UpdateWorker<surveillance;example.osaka.jp>.  Exit value/signal: 0/0
2025/11/27 08:10:17 [INFO]: Munin-update finished (17.52 sec)
上記logのconfig /usr/local/etc/munin/munin-conf.d/_SNMP.conf
[SNMP;10.60.20.101]
    address localhost
    use_node_name no

[SNMP;10.60.20.103]
    address localhost
    use_node_name no

[SNMP;10.60.20.201]
    address localhost
    use_node_name no

[SNMP;10.60.20.203]
    address localhost
    use_node_name no

最初になぁ~んも考えずに設定した恥ずかしい設定ファイルである🤣
ワシの思うに localhost じゃけ ::1/128,127.0.0.1/8 の設定じゃけ良しなにアクセスする物と信じて疑わんかったが、何故か繋がっちょらん🤔

IPアドレス直打ちに書き替えてみたがダメポ😢
2025/11/27 08:50:00 [INFO]: Starting munin-update
2025/11/27 08:50:00 [INFO] starting work in 60594 for 10.60.20.101 (::1:4949).
2025/11/27 08:50:00 [INFO] starting work in 60595 for 10.60.20.201 (::1:4949).
2025/11/27 08:50:00 [INFO] starting work in 60596 for 10.60.20.203 (::1:4949).
2025/11/27 08:50:00 [INFO] starting work in 60597 for 10.60.20.103 (::1:4949).
2025/11/27 08:50:00 [INFO] starting work in 60598 for example.osaka.jp ([::1]:4949).
2025/11/27 08:50:00 Failed to connect to node ::1:4949/tcp : Invalid argument
2025/11/27 08:50:00 [ERROR] Munin::Master::UpdateWorker<SNMP;10.60.20.103> failed to connect to node
2025/11/27 08:50:00 Failed to connect to node ::1:4949/tcp : Invalid argument
2025/11/27 08:50:00 Failed to connect to node ::1:4949/tcp : Invalid argument
2025/11/27 08:50:00 [ERROR] Munin::Master::UpdateWorker<SNMP;10.60.20.203> failed to connect to node
2025/11/27 08:50:00 [ERROR] Munin::Master::UpdateWorker<SNMP;10.60.20.101> failed to connect to node
2025/11/27 08:50:00 Failed to connect to node ::1:4949/tcp : Invalid argument
2025/11/27 08:50:00 [ERROR] Munin::Master::UpdateWorker<SNMP;10.60.20.201> failed to connect to node
2025/11/27 08:50:07 [INFO]: Munin-update finished for node surveillance;example.osaka.jp (7.39 sec)
2025/11/27 08:50:07 [INFO] Reaping Munin::Master::UpdateWorker<SNMP;10.60.20.103>.  Exit value/signal: 20/0
2025/11/27 08:50:07 [INFO] Reaping Munin::Master::UpdateWorker<SNMP;10.60.20.203>.  Exit value/signal: 20/0
2025/11/27 08:50:07 [INFO] Reaping Munin::Master::UpdateWorker<SNMP;10.60.20.201>.  Exit value/signal: 20/0
2025/11/27 08:50:07 [INFO] Reaping Munin::Master::UpdateWorker<SNMP;10.60.20.101>.  Exit value/signal: 20/0
2025/11/27 08:50:17 [INFO] Remaining workers: SNMP;10.60.20.103, SNMP;10.60.20.203, SNMP;10.60.20.101, SNMP;10.60.20.201
2025/11/27 08:50:17 [INFO] Reaping Munin::Master::UpdateWorker<surveillance;example.osaka.jp>.  Exit value/signal: 0/0
2025/11/27 08:50:17 [INFO]: Munin-update finished (17.48 sec)
上記logのconfig /usr/local/etc/munin/munin-conf.d/_SNMP.conf
[SNMP;10.60.20.101]
    address ::1
    use_node_name no

[SNMP;10.60.20.103]
    address ::1
    use_node_name no

[SNMP;10.60.20.201]
    address ::1
    use_node_name no

[SNMP;10.60.20.203]
    address ::1
    use_node_name no

ホスト名がダメなら IP アドレス直打ちって思考はちぃーとばかしネットワークかじっちょれば分かる事じゃけ書き替えてみるが書換前とほぼ同じエラーが出ちゃる😢
で、良くログを見おると snmp 経由では無いヤツはちゃんと仕事しちょる事に気が付く(遅い!)

これ
example.osaka.jp ([::1]:4949)

っちゃけで、[]で括ってみた✌

IPアドレスをエスケープして無事解決👏
2025/11/27 08:55:00 [INFO]: Starting munin-update
2025/11/27 08:55:00 [INFO] starting work in 61801 for 10.60.20.201 ([::1]:4949).
2025/11/27 08:55:00 [INFO] starting work in 61802 for 10.60.20.101 ([::1]:4949).
2025/11/27 08:55:00 [INFO] starting work in 61803 for 10.60.20.203 ([::1]:4949).
2025/11/27 08:55:00 [INFO] node 10.60.20.201 advertised itself as example.osaka.jp instead.
2025/11/27 08:55:00 [INFO] starting work in 61805 for 10.60.20.103 ([::1]:4949).
2025/11/27 08:55:00 [INFO] node 10.60.20.101 advertised itself as example.osaka.jp instead.
2025/11/27 08:55:00 [INFO] starting work in 61806 for example.osaka.jp ([::1]:4949).
2025/11/27 08:55:00 [INFO] node 10.60.20.203 advertised itself as example.osaka.jp instead.
2025/11/27 08:55:00 [INFO] node 10.60.20.103 advertised itself as example.osaka.jp instead.
2025/11/27 08:55:02 [INFO]: Munin-update finished for node SNMP;10.60.20.201 (2.47 sec)
2025/11/27 08:55:03 [INFO]: Munin-update finished for node SNMP;10.60.20.103 (2.49 sec)
2025/11/27 08:55:03 [INFO] Reaping Munin::Master::UpdateWorker<SNMP;10.60.20.201>.  Exit value/signal: 0/0
2025/11/27 08:55:03 [INFO]: Munin-update finished for node SNMP;10.60.20.203 (2.57 sec)
2025/11/27 08:55:03 [INFO] Reaping Munin::Master::UpdateWorker<SNMP;10.60.20.103>.  Exit value/signal: 0/0
2025/11/27 08:55:03 [INFO]: Munin-update finished for node SNMP;10.60.20.101 (2.78 sec)
2025/11/27 08:55:03 [INFO] Reaping Munin::Master::UpdateWorker<SNMP;10.60.20.203>.  Exit value/signal: 0/0
2025/11/27 08:55:08 [INFO]: Munin-update finished for node surveillance;example.osaka.jp (7.97 sec)
2025/11/27 08:55:08 [INFO] Reaping Munin::Master::UpdateWorker<SNMP;10.60.20.101>.  Exit value/signal: 0/0
2025/11/27 08:55:08 [INFO] Reaping Munin::Master::UpdateWorker<surveillance;example.osaka.jp>.  Exit value/signal: 0/0
2025/11/27 08:55:08 [INFO]: Munin-update finished (8.07 sec)
上記logのconfig /usr/local/etc/munin/munin-conf.d/_SNMP.conf
[SNMP;10.60.20.101]
    address [::1]
    use_node_name no

[SNMP;10.60.20.103]
    address [::1]
    use_node_name no

[SNMP;10.60.20.201]
    address [::1]
    use_node_name no

[SNMP;10.60.20.203]
    address [::1]
    use_node_name no

結局[]でアドレスをエスケープしちゃらんといけんって事じゃった👏

IPv6 の扱いが場面によって変わるんってなんなん

個人的に IPv6 とは黎明期から触って来てるが、OS や言語で扱いに統一感が未だに無いのが悩みのタネなんよね😣

結び

この事例は他のソフトウェアの設定でも参考になるやもしれんけぇ、チョットでも手助けになればと思う次第じゃ(自分も含めてw)

  1. Munin Monitoring

0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?