[smokeping-users] Re: Time stamp on alerts

Shane Kindt skindt at swwnet.com
Thu Dec 22 00:21:54 MET 2005


Now I get  " Unknown Date"  here is a copy of that section in my 
Smokeping.pm file:

***************************
# send something
                        my $from;
                        my $line = "$name/$prop";
                        my $base = $cfg->{General}{datadir};
                        $line =~ s|^$base/||;
                        $line =~ s|/host$||;
                        $line =~ s|/|.|g;
                        do_log("Alert $_ $what for $line");
                        my $urlline = $line;
                        $urlline = 
$cfg->{General}{cgiurl}."?target=".$line;
                        my $loss = "loss: ".join ", ",map {defined $_ ? 
(/^\d/ ?
 sprintf "%.0f%%", $_ :$_):"U" } @{$x->{loss}};
                        my $rtt = "rtt: ".join ", ",map {defined $_ ? (/^\d/ 
? s
printf "%.0fms", $_*1000 :$_):"U" } @{$x->{rtt}};
                        my $stamp = scalar localtime time;
                        my @to;
                        foreach my $addr (map {$_ ? (split /\s*,\s*/,$_) : 
()} $
cfg->{Alerts}{to},$tree->{alertee},$cfg->{Alerts}{$_}{to}){
                             next unless $addr;
                             if ( $addr =~ /^\|(.+)/) {
                                 if ($edgetrigger) {
                                        system 
$1,$_,$line,$loss,$rtt,$tree->{ho
st}, ($what =~/raise/);
                                 } else {
                                        system 
$1,$_,$line,$loss,$rtt,$tree->{ho
st};
                                 }
                             } elsif ( $addr =~ /^snpp:(.+)/ ) {
                                 sendsnpp $1, <<SNPPALERT;
$cfg->{Alerts}{$_}{comment}
$_ $what on $line
$loss
$rtt
SNPPALERT
                             } else {
                                 push @to, $addr;
                             }
                        };
                        if (@to){
                            my $to = join ",", at to;
                            sendmail $cfg->{Alerts}{from},$to, <<ALERT;
To: $to
From: $cfg->{Alerts}{from}
Date: $stamp
Subject: [SmokeAlert] $_ $what on $line

#$stamp

Alert "$_" $what for $urlline
****************************************

I put in the " Date: $stamp " per your instructions and i got the "unknown 
date" for a time stamp instead of Dec 31 1969.  So i tried to comment out 
the lower $stamp (it was there by default) to see if that would help.  still 
get "unknown date".

This is the only part of the code that I could find that pertains to the 
alerts and time stamp.  On my Smokeping.pm script this is a copy from lines 
1122 to 1165 if that helps.  I am running smokeping 2.05 on Redhat 9.

Thanks again!

Shane Kindt

----- Original Message ----- 
From: "Scott Schappell" <archon at silvertree.org>
To: <smokeping-users at list.ee.ethz.ch>
Sent: Wednesday, December 21, 2005 9:51 AM
Subject: [smokeping-users] Re: Time stamp on alerts


> Edit Smokeping.pm as follows:
>
>    1104 To: $to
>    1105 From: $cfg->{Alerts}{from}
>    1106 Date: $stamp <-- Add this line
>    1107 Subject: [SmokeAlert] $_ on $line
>
>
> You'll have to perform this edit every time you upgrade smokeping.
>
> --
> Unsubscribe 
> mailto:smokeping-users-request at list.ee.ethz.ch?subject=unsubscribe
> Help        mailto:smokeping-users-request at list.ee.ethz.ch?subject=help
> Archive     http://lists.ee.ethz.ch/smokeping-users
> WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi
>
> 

--
Unsubscribe mailto:smokeping-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:smokeping-users-request at list.ee.ethz.ch?subject=help
Archive     http://lists.ee.ethz.ch/smokeping-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the smokeping-users mailing list