Ubuntu 24.04

Munin : メール通知の設定2026/03/13

 

監視対象となる項目はプラグインで設定します。
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 110)
        id 5AFEB6812E; Thu, 12 Mar 2026 23:58:48 +0000 (UTC)
Subject: Munin-notification for srv.world::dlp.srv.world
To: root@dlp.srv.world
User-Agent: mail (GNU Mailutils 3.17)
Date: Thu, 12 Mar 2026 23:58:48 +0000
Message-Id: <20260312235848.5AFEB6812E@dlp.srv.world>
From: munin application user <munin@dlp.srv.world>
X-UID: 2
Status: O

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

srv.world :: dlp.srv.world :: Disk latency per device :: Average latency for /de
v/ubuntu-vg/ubuntu-lv
        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 /de
v/vda
        OKs: Write IO Wait time is 0.00, Read IO Wait time is 0.00.
.....
.....
[3] メール送信ではなくログファイルに書き出す場合は以下のように設定します。
root@dlp:~#
vi /etc/munin/munin.conf
# 87行目あたりに追記

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