我是 Linux 新手。我已经安装了 Munin 并设置了电子邮件警报,但未生成任何警报。你能帮助我吗?这是我的 munin.conf 配置的一部分:
contact.sha.command mail -s "Munin notification - ${var:group} :: ${var:host}" [email protected]
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 [email protected] Tue Apr 25 22:50:21 2017
Return-Path: <[email protected]>
X-Original-To: root
Delivered-To: [email protected]
Received: by Munin.localdomain (Postfix, from userid 498)
id BTN8B30F7G; Tue, 25 Apr 2017 22:50:21 +0100 (BST)
From: [email protected] (Cron Daemon)
To: [email protected]
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: <[email protected]>
Date: Tue, 25 Apr 2017 22:50:17 +0100 (BST)
sha :: Server2 :: CPU usage
WARNINGs: system is 5.15 (outside range [:5]).
任何帮助都将不胜感激,因为我已经在网上搜索过任何可能的解决方案,但一无所获。提前致谢
答案1
似乎每个contact
命令只能定义一个命令,最后一个设置会覆盖所有先前的设置。我在文档中找不到任何明确说明这一点的内容,但观察到的行为肯定符合这一点。
我想如果您需要采取多项行动那么您可以使用多个联系人或将通知推送到另一个系统(比如)Nagios
。