Debian 13 trixie

Munin : メール通知の設定2025/10/03

 

監視対象となる項目はプラグインで設定します。
CPU 使用率等の主要なプラグインはデフォルトで有効、且つ、しきい値も設定されていますが、このしきい値に対して値を超えた際にコマンドを実行するよう設定することができます。この機能を利用して通知メールを送信するも可能です。

[1]

メールでの通知をする場合は、使用可能な SMTP サーバーが必要となります
当例ではローカルホストで SMTP サーバーが稼働していることを前提に設定します。

[2] root 宛てに通知メールを送信するよう設定します。
root@dlp:~#
apt -y install mailutils
root@dlp:~#
vi /etc/munin/munin.conf
# 87行目あたりに追記

contact.email.command mail -s "Munin-notification for ${var:group}::${var:host}" root
# 通知メールを強制送信

root@dlp:~#
su - munin --shell=/bin/bash -c "/usr/share/munin/munin-limits --contact email --force"

root@dlp:~#
mail

"/var/mail/root": 1 message 1 new
>N   1 munin application  Thu Oct  2 09:02  36/1503  Munin-notification for srv.world::dlp.srv.world
? 1
Return-Path: <munin@dlp.srv.world>
X-Original-To: root
Delivered-To: root@dlp.srv.world
Received: by dlp.srv.world (Postfix, from userid 101)
        id 1F772E0011; Thu, 02 Oct 2025 09:02:13 +0900 (JST)
Subject: Munin-notification for srv.world::dlp.srv.world
To: root@dlp.srv.world
User-Agent: mail (GNU Mailutils 3.19)
Date: Thu,  2 Oct 2025 09:02:13 +0900
Message-Id: <20251002000213.1F772E0011@dlp.srv.world>
From: munin application user <munin@dlp.srv.world>

srv.world :: dlp.srv.world :: File table usage
        OKs: open files is 864.00.

srv.world :: dlp.srv.world :: Disk usage in percent
        OKs: /tmp is 0.00, / is 5.79, /boot is 15.35, /run is 0.14, /dev/shm is 0.00, /run/lock is 0.00.

srv.world :: dlp.srv.world :: Munin processing time
        OKs: munin graph is 0.45, munin update is 3.61.

srv.world :: dlp.srv.world :: Inode usage in percent
        OKs: /run/lock is 0.00, /run is 0.11, / is 2.82, /dev is 0.07, /tmp is 0.00, /dev/shm is 0.00, /boot is 0.58.

srv.world :: dlp.srv.world :: Disk latency per device :: Average latency for /dev/vda
        OKs: Write IO Wait time is 0.00, Read IO Wait time is 0.00.

srv.world :: dlp.srv.world :: Disk latency per device :: Average latency for /dev/debian-vg/root
        OKs: Read IO Wait time is 0.00, Write IO Wait time is 0.00.

srv.world :: dlp.srv.world :: Disk latency per device :: Average latency for /dev/debian-vg/swap_1
.....
.....
[3] メール送信ではなくログファイルに書き出す場合は以下のように設定します。
root@dlp:~#
vi /etc/munin/munin.conf
# 87行目あたりに追記

contact.log.command tee -a /var/log/munin/alert.log
関連コンテンツ