Opened 20 months ago
Last modified 20 months ago
#1147 new defect
No explanation message on Munin's alert email
| Reported by: | rgs | Owned by: | nobody |
|---|---|---|---|
| Priority: | normal | Milestone: | Munin 2.0.0 |
| Component: | plugins | Version: | 2.0-beta4 |
| Severity: | normal | Keywords: | missing explaination subject |
| Cc: |
Description
I am running munin 2.0beta4 and I am getting alert e-mails with no explanation on the subject:
From: Munin <munin@…>
To: alert@…,
Munin@…
Subject: [Systems-logs] sunjammer.sugarlabs.org:
Date: Mon, 03 Oct 2011 04:55:41 -0400
sugarlabs.org :: sunjammer.sugarlabs.org :: Load average
OKs: load is 6.50.
Is anyone else seeing this?
Change History (3)
comment:1 Changed 20 months ago by rgs
comment:2 Changed 20 months ago by rgs
Sorry, forgot to properly indent the code snippet, here it goes again:
if (!defined $pipe) {
- DEBUG "[DEBUG] Opening pipe for $c";
- pipe(my $r, my $w) or WARN "[WARNING] Failed to open pipe for $c: $!";
- my $pid = fork();
- defined($pid) or WARN "[WARNING] Failed fork for pipe for $c: $!";
- if($pid) { # parent
- DEBUG "[DEBUG] Opened pipe for $c as pid $pid";
-
- close $r;
- $pipe = $w;
- munin_set($contactobj, "pipe_command", $cmd);
- munin_set($contactobj, "pipe", $pipe);
- munin_set($contactobj, "num_messages", 0);
- $curmess = 0;
- } else { # child
- close $w;
- open(STDIN, "<&", $r);
- exec($cmd) or WARN "[WARNING] Failed to exec for contact $c in pid $$";
- exit;
+ my @cmd = extract_multiple(
+ message_expand($hash, $cmd),
+ [sub {extract_delimited($_[0], q{"'})}, qr/\S+/],
+ undef, 1
+ );
+ @cmd = map {
+ my $c = $_;
+ $c =~ s/['"]$//;
+ $c =~ s/^['"]//;
+ $c;
+ } @cmd;
+ $contactobj->{"num_messages"} = 0;
+ if ($cmd[0] eq "|") {
+ $cmd[0] = "|-";
+ }
+ elsif ($cmd[0] !~ /^[|>]/) {
+ unshift(@cmd, "|-");
+ }
comment:3 Changed 20 months ago by kenyon
That code has changed a bit since 2.0-beta4: log:trunk/master/lib/Munin/Master/LimitsOld.pm#4273:4417
Can you try trunk and see if it fixes the issue?
Note: See
TracTickets for help on using
tickets.

I think the problems is due to the following change in ./master/lib/Munin/Master/LimitsOld.pm:
-
+ my @cmd = extract_multiple(
+ message_expand($hash, $cmd),
+ [sub {extract_delimited($_[0], q{"'})}, qr/\S+/],
+ undef, 1
+ );
+ @cmd = map {
+ my $c = $_;
+ $c =~ s/['"]$;
+ $c =~ s/['"];
+ $c;
+ } @cmd;
+ $contactobj->{"num_messages"} = 0;
+ if ($cmd[0] eq "|") {
+ }
This doesn't seem to correctly parse the following (arguably valid) config line:
contact.logs.command mail -s "${var:host}: Munin alert" foo@…
as it ends up mailing to munin@localhost , alert@localhost and foo@… with the subject just set to the extrapolated value of ${var:host}.