Re: [Mon-devel] No summary for upalert events
Brought to you by:
trockij
From: Ed R. <er...@pa...> - 2005-12-19 22:54:54
|
On Mon, Dec 19, 2005 at 01:55:17PM -0800, Todd Lyons wrote: ... > do_alert ($group, $service, $sref->{"_upalertoutput"}, 0, $FL_UPALERT); > > The hashref $sref->{"_upalertoutput"} is not defined anywhere in the > code that I can find. It seems that there should be something like: > > $sref->{"_upalertoutput"} = $output; I reported this when I first discovered it several months ago, and again this past October 12 to the mon list when folks were talking about releasing Mon 1.1 - I guess you weren't subscribed yet. Here's my fix, unsurprisingly similar to yours: @@ -3295,6 +3296,8 @@ (!defined($sref->{"upalertafter"}) || (($tmnow - $sref->{"_first_failure"}) >= $sref->{"upalertafter"})))) { + # Save the last failing monitor's output for posterity + $sref->{"_upalertoutput"}= $sref->{"_last_output"}; do_alert ($group, $service, $sref->{"_upalertoutput"}, 0, $FL_UPALERT); } I don't remember if this made it into CVS. I spent a bit of time reading the code and thinking about where to put the one-line fix, and it's been working flawlessly in production here ever since, so you might want to use my patch instead. -- Ed ---------- > The following patch works for me, but without a deeper understanding of > the code, I like to have someone with mon internals experience tell me > if I'm doing it the right way, or if it should just be passing $output > to the do_alert() function, or if there is something else going on that > I'm not seeing. > > > > --- /usr/sbin/mon.orig 2005-12-19 13:51:41.000000000 -0800 > +++ /usr/sbin/mon 2005-12-19 13:47:22.000000000 -0800 > @@ -3332,6 +3332,8 @@ > my $old_status = $sref->{"_op_status"}; > set_op_status ($group, $service, $STAT_OK); > > + $sref->{"_upalertoutput"} = $output; > + > if ($type eq "t") > { > $sref->{"_last_uptrap"} = $tmnow; > @@ -3350,6 +3352,7 @@ > || (($tmnow - $sref->{"_first_failure"}) >= $sref->{"upalertafter"})))) > { > do_alert ($group, $service, $sref->{"_upalertoutput"}, 0, $FL_UPALERT); > + do_alert ($group, $service, $sref->{"_upalertoutput"}, 0, $FL_UPALERT); > } > > # > > -- |