Email

穆寧不發送電子郵件警報

  • May 9, 2017

我是 Linux 新手。我已經安裝了 Munin 並設置了電子郵件警報,但沒有生成任何警報。你能幫我麼?這是我的 munin.conf 配置的一部分:

contact.sha.command mail -s "Munin notification - ${var:group} :: ${var:host}" xxxx@gmail.com
contact.sha.always_send warning critical
contact.sha.command tee -a /var/log/munin/alert.log

###CONTACT GROUP/GROUPS
[sha;]
   contacts sha

# a simple host tree
[sha;Munin-Server]
address 127.0.0.1
use_node_name yes

[sha;Server1]
address 192.168.10.253
use_node_name yes

cpu.iowait.warning 14
cpu.iowait.critical 17

cpu.system.warning 10

df_dev_mapper_VolGroup_lv_root.warning .5

#contacts sha

[sha;Website]
address 172.16.1.184
use_node_name yes

[sha;Serv]
address 172.16.1.184
port 4948
use_node_name yes

[sha;Server2]
address 192.168.10.252
use_node_name yes
cpu.iowait.warning 14
cpu.iowait.critical 17

cpu.system.warning 5

vmstat.wait.warning 1
vmstat.wait.critical 2

我的電子郵件中沒有收到任何警報,但我確實在 /var/log/munin/alert.log 中收到了所有警報

   #  /var/log/munin/alert.log

sha :: Server2 :: CPU usage
       WARNINGs: system is 5.24 (outside range [:5]).

sha :: Server2 :: CPU usage
       OKs: system is 4.83.

sha :: Server2 :: VMstat
       WARNINGs: running is 2.00 (outside range [:1]).

電子郵件也在“/var/spool/mail/root”中排隊,這是其中一封電子郵件:

From root@Munin.localdomain  Tue Apr 25 22:50:21 2017
Return-Path: <root@Munin.localdomain>
X-Original-To: root
Delivered-To: root@Munin.localdomain
Received: by Munin.localdomain (Postfix, from userid 498)
       id BTN8B30F7G; Tue, 25 Apr 2017 22:50:21 +0100 (BST)
From: root@Munin.localdomain (Cron Daemon)
To: root@Munin.localdomain
Subject: Cron <munin@Munin> test -x /usr/bin/munin-cron && /usr/bin/munin-cron
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <LANG=en_US.UTF-8>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/var/lib/munin>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=munin>
X-Cron-Env: <USER=munin>
Message-Id: <20170425215021.BTN8B30F7G@Munin.localdomain>
Date: Tue, 25 Apr 2017 22:50:17 +0100 (BST)

sha :: Server2 :: CPU usage
       WARNINGs: system is 5.15 (outside range [:5]).

任何幫助都將受到高度讚賞,因為我在網上搜尋了任何可能的解決方案,但找不到任何東西。提前致謝

似乎每個contact都只能定義一個命令,並且最後一個設置會覆蓋任何以前的設置。我在文件中找不到任何明確說明這一點的內容,但觀察到的行為肯定與此相符。

我想如果您需要採取多項行動,那麼您會使用多個聯繫人或將通知推送到另一個系統,例如Nagios.

引用自:https://serverfault.com/questions/846546