diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/CHANGES /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/CHANGES --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/CHANGES 2008-02-02 16:24:04.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/CHANGES 2008-05-31 13:10:37.000000000 -0400 @@ -9,6 +9,7 @@ show test results on webpage overview webpage friendlier notification messages + compute service bugfixes => some config file changes may be needed diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/Makefile.tplt /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/Makefile.tplt --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/Makefile.tplt 2008-03-04 22:45:55.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/Makefile.tplt 2008-05-31 11:57:20.000000000 -0400 @@ -5,7 +5,7 @@ # # $Id: Makefile.tplt,v 1.173 2008/03/05 03:45:55 jaw Exp $ -VERSION = dev-20080304 +VERSION = dev-20080531 MESSAGE = This is unstable development code INSTALL = please see the INSTALL document for the next steps UPGRADE1 = be sure to install the new misc/argus.css and misc/argus.js files diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/Argus::Compute.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/Argus::Compute.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/Argus::Compute.pm 2007-12-30 20:24:30.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/Argus::Compute.pm 2008-05-31 13:29:10.000000000 -0400 @@ -32,7 +32,7 @@ exmpl => "( %{Top:Foo} + %{Top:Bar} ) / %{Top:Baz}", attrs => ['config', 'inherit'], }, - + compute::downtime => {}, compute::srvcs => {}, }, }; @@ -154,6 +154,26 @@ } +sub isup { + my $me = shift; + + $me->{compute}{downtime} = undef; + $me->SUPER::isup(@_); +} + +sub isdown { + my $me = shift; + + # emulate retries in a reasonable way + if( $me->{srvc}{retries} ){ + $me->{compute}{downtime} ||= $^T; + my $t = 1 + ($^T - $me->{compute}{downtime}) / $me->{srvc}{frequency}; + $me->{srvc}{tries} = $t; + } + + $me->SUPER::isdown(@_); +} + sub recycle { my $me = shift; diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/Argus::SNMP::Helper.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/Argus::SNMP::Helper.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/Argus::SNMP::Helper.pm 2008-03-04 22:45:56.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/Argus::SNMP::Helper.pm 2008-05-31 14:16:03.000000000 -0400 @@ -55,7 +55,6 @@ snmph::descr => {}, # descr table data snmph::rdescr => {}, # ditto. reversed snmph::lastuptime => {}, # most recent uptime - }, }; @@ -152,7 +151,7 @@ $me->SUPER::reschedule(); } -# error? back to square one +# error? retry or back to square one sub isdown { my $me = shift; @@ -168,8 +167,15 @@ $me->{snmp}{snmpversion} = $SRC{$src}{ver} || 1; } } + + if( $me->{srvc}{tries} > $me->{srvc}{retries} ){ + # start over + if( $me->{snmph}{phase} ){ + $me->{snmph}{phase} = 0; + $me->next_phase(); + } + } - $me->{snmph}{phase} = 0; $me->SUPER::isdown(@_); } @@ -235,7 +241,7 @@ elsif( $SRC{$src} && ($oid eq $SRC{$src}{number}) ){ if( $me->{snmph}{idxnumber} != $val && !$me->{snmph}{phase} ){ - $me->enter_fetch_phase(); + $me->next_phase(); $me->debug("system reconfig detected. refetching table"); } @@ -326,7 +332,8 @@ label => $host, hostname => $host, oid => 'sysUptime', # placeholder to prevent config error - + + severity => 'critical', passive => 'yes', # passive - sets nostatus=yes, siren=no, sendnotify=no nostats => 'yes', # nostats - do not save statistics overridable => 'no', # because that would be silly diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/Conf.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/Conf.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/Conf.pm 2008-02-02 22:00:42.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/Conf.pm 2008-05-31 13:00:46.000000000 -0400 @@ -200,7 +200,7 @@ } elsif( /:/ ){ - my ($k, $v) = split /:\s*/, $_, 2; + my ($k, $v) = split /:[ \t]*/, $_, 2; if( $nomoredata ){ $me->warning( "additional data not permitted here (ignored)" ); next; diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/Configable.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/Configable.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/Configable.pm 2008-02-02 22:00:42.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/Configable.pm 2008-05-31 13:07:06.000000000 -0400 @@ -400,7 +400,7 @@ my $v = $me->{config}{$k}; next if ($k =~ /^_/) && ::topconf('_hide_expr'); $v =~ s/\#/\\\#/g; - $v =~ s/\n/\\n\\\n/g; + $v =~ s/\n/\\n/g; $v =~ s/\r/\\r/g; $r .= "\t$k:\t$v"; $r .= "\t# unused parameter - typo?" diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/DARP.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/DARP.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/DARP.pm 2007-12-22 16:47:10.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/DARP.pm 2008-05-31 13:03:35.000000000 -0400 @@ -169,7 +169,7 @@ } elsif( /:/ ){ - my($k, $v) = split /:\s*/, $_, 2; + my($k, $v) = split /:[ \t]*/, $_, 2; if( $nomoredata ){ $me->warning( "additional data not permitted here (ignored)" ); diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/DARP::Conf.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/DARP::Conf.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/DARP::Conf.pm 2007-12-22 12:22:13.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/DARP::Conf.pm 2008-05-31 13:03:49.000000000 -0400 @@ -113,7 +113,7 @@ } elsif( /:/ ){ - my($k, $v) = split /:\s*/, $_, 2; + my($k, $v) = split /:[ \t]*/, $_, 2; $cf->warning( "redefinition of parameter '$k'" ) if defined $me->{config}{$k}; diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/Encoding::BER.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/Encoding::BER.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/Encoding::BER.pm 2007-03-05 21:50:10.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/Encoding::BER.pm 2008-05-31 14:43:11.000000000 -0400 @@ -5,14 +5,14 @@ # Created: 2007-Jan-28 16:03 (EST) # Function: BER encoding/decoding (also: CER and DER) # -# $Id: BER.pm,v 1.9 2007/03/06 02:50:10 jaw Exp $ +# $Id: BER.pm,v 1.11 2008/05/31 18:43:11 jaw Exp $ # references: ITU-T x.680 07/2002 - ASN.1 # references: ITU-T x.690 07/2002 - BER package Encoding::BER; use vars qw($VERSION); -$VERSION = '1.00'; +$VERSION = '1.01'; use Carp; use strict; # loaded on demand if needed: @@ -452,7 +452,7 @@ my @i; my $big; - if( defined &Math::BigInt::new ){ + if( _have_math_bigint() ){ # value is a bigint or a long string $big = 1 if (ref $val && $val->can('as_hex')) || length($val) > 8; } @@ -496,8 +496,8 @@ my @i; my $big; - - if( defined &Math::BigInt::new ){ + + if( _have_math_bigint() ){ # value is a bigint or a long string $big = 1 if (ref $val && $val->can('bcmp')) || length($val) > 8; } @@ -1275,7 +1275,7 @@ my $val; my $big; - $big = 1 if defined &Math::BigInt::new && length($data) > 4; + $big = 1 if _have_math_bigint() && length($data) > 4; if( $big ){ my $sign = unpack('c', $data) < 0; @@ -1421,6 +1421,14 @@ }; } +sub _have_math_bigint { + + return unless defined &Math::BigInt::new; + return unless defined &Math::BigInt::is_neg; + + 1; +} + ################################################################ sub hexdump { diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/Group.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/Group.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/Group.pm 2007-09-01 12:51:37.000000000 -0400 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/Group.pm 2008-05-31 13:01:00.000000000 -0400 @@ -106,7 +106,7 @@ } elsif( /:/ ){ - my($k, $v) = split /:\s*/, $_, 2; + my($k, $v) = split /:[ \t]*/, $_, 2; # data must be before Service|Group|Alias # disallow # Group "foo" { diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/MonEl.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/MonEl.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/MonEl.pm 2008-03-03 10:45:17.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/MonEl.pm 2008-05-31 12:28:33.000000000 -0400 @@ -344,12 +344,6 @@ html => 'notif', versn => '3.2', }, - 'notify::notify.clear' => { # == notifyup - descr => 'list of addresses to notify when up', - attrs => ['config', 'inherit'], - html => 'notif', - versn => '3.6', - }, notify::mail_from => { descr => 'address to use as From: on notification email', attrs => ['config', 'inherit'], @@ -942,7 +936,7 @@ # add in severity based notification params for my $sev qw(critical major minor warning){ - for my $p qw(notify renotify autoack escalate sendnotify ack_on_better ack_on_worse){ + for my $p qw(renotify autoack escalate ack_on_better ack_on_worse){ # none of these are applicable for 'up/clear' my %d = %{ $doc->{fields}{"notify::$p"} }; $d{versn} = '3.6'; @@ -954,7 +948,7 @@ delete $doc->{fields}{'notify::ack_on_worse.critical'}; for my $sev qw(critical major minor warning clear){ - for my $p qw(siren web::icon){ + for my $p qw(siren web::icon notify::notify notify::sendnotify){ my %d = %{ $doc->{fields}{$p} }; $d{versn} = '3.6'; $d{descr} .= ($sev eq 'clear') ? " when up/$sev" : " when down/$sev"; @@ -1076,6 +1070,7 @@ $me->{siren} = 0; $me->{nostatus} = 1; $me->{notify}{sendnotify} = 0; + $me->{notify}{"sendnotify.$_"} = 0 for qw(critical major minor warning clear); # QQQ - set an override ? } @@ -1159,12 +1154,12 @@ sub resolve_alii { my $me = shift; my $cf = shift; - my( $c ); if( $me->can('aliaslookup') ){ $me->aliaslookup($cf); } - foreach $c ( @{$me->{children}} ){ + + foreach my $c ( @{$me->{children}} ){ $c->resolve_alii($cf); } } @@ -1176,19 +1171,30 @@ # -- Ezra 2:42 sub sort_children { my $me = shift; - my( $c ); if( $me->{sort} ){ - @{$me->{children}} = sort { - ($a->{label_left} || $a->{name}) cmp ($b->{label_left} || $b->{name}) - } @{$me->{children}}; + @{$me->{children}} = + map { $_->[0] } + sort { $a->[1] cmp $b->[1] } + map { [ $_, $_->sort_key() ] } + @{$me->{children}}; + } - - foreach $c ( @{$me->{children}} ){ + + foreach my $c ( @{$me->{children}} ){ $c->sort_children(); } } +sub sort_key { + my $me = shift; + + my $name = $me->{label_left} || $me->{name}; + + $name =~ s/(\d+)/sprintf('%08d', $1)/ge; + $name; +} + # need to make sure we recalc statuses as objects may have changed on disk sub jiggle { my $me = shift; @@ -1251,6 +1257,7 @@ my $cf = shift; my( $dt, @ndl ); + # check depend list. make sure targets are valid. if( $me->{depends} && !ref $me->{depends} ){ foreach my $d (split /\s+/, $me->{depends}){ diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/NotMe.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/NotMe.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/NotMe.pm 2007-12-22 12:22:14.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/NotMe.pm 2008-05-31 13:01:32.000000000 -0400 @@ -274,7 +274,7 @@ last; } elsif( /:/ ){ - my($k, $v) = split /:\s*/, $_, 2; + my($k, $v) = split /:[ \t]*/, $_, 2; $cf->warning( "redefinition of parameter '$k'" ) if defined $me->{config}{$k}; $me->{config}{$k} = $v; diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/Notify.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/Notify.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/Notify.pm 2008-03-03 10:45:17.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/Notify.pm 2008-05-31 12:08:25.000000000 -0400 @@ -43,9 +43,9 @@ my %param = @_; my( $me, $msg, $fmt, $aa, $dst, @t ); - # do not notify if notifys are not wanted - return unless $obj->{notify}{sendnotify}; - + # do not notify if notifies are not wanted + return unless value_at_severity('sendnotify', $obj); + if( $obj->{status} eq 'down' ){ $msg = $obj->{notify}{messagedn}; $fmt = $obj->{notify}{message_fmtdn}; @@ -104,15 +104,14 @@ $me->notify(); } - +# return notify::field.severity // notify::field sub value_at_severity { my $fld = shift; my $obj = shift; my $sev = shift; $sev ||= $obj->{currseverity}; - - return $obj->{notify}{$fld} if $sev eq 'clear'; + my $v = $obj->{notify}{"$fld.$sev"}; return $v if defined $v; return $obj->{notify}{$fld} @@ -127,11 +126,12 @@ if( $me->{audit} ){ $notify = $obj->{notify}{notifyaudit}; }else{ + # notify.severity // notify(up|dn) // notify if( $me->{objstate} eq 'down' ){ $notify = $obj->{notify}{"notify.$me->{severity}"}; $notify = $obj->{notify}{notifydn} unless defined $notify; }else{ - $notify = $obj->{notify}{"notify.clear"}; # NYI + $notify = $obj->{notify}{"notify.clear"}; $notify = $obj->{notify}{notifyup} unless defined $notify; } diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/Service.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/Service.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/Service.pm 2008-03-03 10:45:17.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/Service.pm 2008-05-31 13:01:14.000000000 -0400 @@ -985,7 +985,7 @@ } elsif( /:/ ){ - my($k, $v) = split /:\s*/, $_, 2; + my($k, $v) = split /:[ \t]*/, $_, 2; $cf->warning( "redefinition of parameter '$k'" ) if defined $me->{config}{$k}; $me->{config}{$k} = $v; diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/TCP.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/TCP.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/TCP.pm 2008-02-02 22:00:44.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/TCP.pm 2008-03-27 22:13:39.000000000 -0400 @@ -225,10 +225,12 @@ $name = $me->{name}; $name =~ s/^TCP\/?//; - $me->{tcp}{port} ||= $config{$name}{port}; - $me->{tcp}{send} ||= $config{$name}{send}; - $me->{tcp}{readhow} ||= $config{$name}{readhow}; - $me->{tcp}{ssl} ||= $config{$name}{ssl}; + if( $config{$name} ){ + $me->{tcp}{port} ||= $config{$name}{port}; + $me->{tcp}{send} ||= $config{$name}{send}; + $me->{tcp}{readhow} ||= $config{$name}{readhow}; + $me->{tcp}{ssl} ||= $config{$name}{ssl}; + } $me->{label_right_maybe} ||= $name; @@ -237,7 +239,7 @@ if( !defined($me->{test}{expect}) && !($me->{test}{pluck} || $me->{test}{unpack}) ){ # don't use default expect, if expected value will not be there - $me->{test}{expect} = $config{$name}{expect}; + $me->{test}{expect} = $config{$name}{expect} if $config{$name}; } if( $name =~ /^(HTTP|HTTPS|SSL)$/ ){ diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/UDP.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/UDP.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/UDP.pm 2008-02-03 17:58:43.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/UDP.pm 2008-03-27 21:42:55.000000000 -0400 @@ -145,13 +145,15 @@ $base = $name; $base =~ s/\/.*// unless $config{$base}; - $me->{srvc}{timeout} ||= $config{$base}{timeout}; - $me->{udp}{port} ||= $config{$base}{port}; - $me->{udp}{send} ||= $config{$base}{send}; - $me->{test}{expect} ||= $config{$base}{expect}; - $me->{test}{unpack} ||= $config{$base}{unpack}; - $me->{test}{scale} ||= $config{$base}{scale}; - + if( $config{$base} ){ + $me->{srvc}{timeout} ||= $config{$base}{timeout}; + $me->{udp}{port} ||= $config{$base}{port}; + $me->{udp}{send} ||= $config{$base}{send}; + $me->{test}{expect} ||= $config{$base}{expect}; + $me->{test}{unpack} ||= $config{$base}{unpack}; + $me->{test}{scale} ||= $config{$base}{scale}; + } + $me->{label_right_maybe} ||= $name; $me->Argus::IP::init( $cf ); diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/UserCron.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/UserCron.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/UserCron.pm 2007-12-22 12:22:14.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/UserCron.pm 2008-05-31 13:03:23.000000000 -0400 @@ -79,7 +79,7 @@ last; } elsif( /:/ ){ - my($k, $v) = split /:\s*/, $_, 2; + my($k, $v) = split /:[ \t]*/, $_, 2; $cf->warning( "redefinition of parameter '$k'" ) if defined $me->{config}{$k}; $me->{config}{$k} = $v; diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/Web.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/Web.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/Web.pm 2008-03-03 10:45:18.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/Web.pm 2008-05-31 12:44:47.000000000 -0400 @@ -217,7 +217,10 @@ return undef unless $me->{stats}{log} && @{$me->{stats}{log}}; print $fh "\n"; + print $fh "", $me->unique(), "
\n"; print $fh "\n"; + print $fh "\n"; + foreach my $l ( reverse @{$me->{stats}{log}} ){ # [time, status, ovstatus, tag, msg] my $st = $l->[2]; diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/web_login.pl /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/web_login.pl --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080304/src/web_login.pl 2008-02-03 23:56:21.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080531/src/web_login.pl 2008-05-31 12:12:58.000000000 -0400 @@ -58,7 +58,7 @@ unless(@a){ my $emsg = l10n('Authentication Failed'); - $me->web_login_form(); + $me->web_login_form($emsg); return ; }