0

I am new to Linux. I have installed Munin and setup email alerts, but no alerts have been generated. Can you please help me? Here is part of my munin.conf config:

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

I am not getting any alerts in my email but I do get all alerts in /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]).

emails are queuing up in "/var/spool/mail/root" aswell, here is one of the emails :

 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]).

Any help will be highly appreciated as I have searched the net for any possible solution but couldn't find anything. Thanks in Advance

Daud Zeb
  • 45
  • 6
  • You sure this is correct: `root@Munin.localdomain`? Whats in `/etc/aliases/`? – Lenniey Apr 26 '17 at 07:25
  • `/etc/aliases` of course... – Lenniey Apr 26 '17 at 07:32
  • Does munin allow for multiple `contact.*.command` definitions for the same item? I don't see anything in the docs that says explicitly either way but the behaviour you're seeing suggests that the second one might just be overwriting the first one. – Paul Haldane Apr 26 '17 at 08:59
  • Thanks @Lenniey, " root@Munin.localdomain" I am not sure about this to be very honest. In "/etc/aliases" all options are set to 'root'. – Daud Zeb Apr 26 '17 at 10:37
  • @PaulHaldane I have not set multiple contacts. If you are referring to " contact.sha.command tee -a /var/log/munin/alert.log ", its just to log them locally:q – Daud Zeb Apr 26 '17 at 10:40
  • But won't that just override the earlier `contact.sha.command mail ...` setting? – Paul Haldane Apr 26 '17 at 10:44
  • @PaulHaldane You are a star I have commented it out and now I am receiving email, I read on one of forum cant remember where but according to that both should work. Anyways I am a happy man as its working now. Thanks to all you – Daud Zeb Apr 26 '17 at 10:48

1 Answers1

2

It seems that each contact can only have a single command defined and the last setting overwrites any previous ones. I couldn't find anything in the documentation that says this explicitly but the observed behaviour certainly matches this.

I guess that if you need multiple actions to be taken then you'd use multiple contacts or push notifications into another system like Nagios.

Paul Haldane
  • 4,517
  • 1
  • 21
  • 32