diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/Makefile.tplt /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/Makefile.tplt --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/Makefile.tplt 2008-02-02 22:00:40.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/Makefile.tplt 2008-03-03 10:45:13.000000000 -0500 @@ -3,9 +3,9 @@ # Created: 2002-Jun-27 # Function: Makefile template # -# $Id: Makefile.tplt,v 1.170 2008/02/03 03:00:40 jaw Exp $ +# $Id: Makefile.tplt,v 1.172 2008/03/03 15:45:13 jaw Exp $ -VERSION = dev-20080202 +VERSION = dev-20080301 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-20080202/examples/config /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/examples/config --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/examples/config 2007-06-13 21:46:12.000000000 -0400 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/examples/config 2008-02-03 11:46:37.000000000 -0500 @@ -83,7 +83,7 @@ oid: .1.3.6.1.2.1.2.2.1.7.2 eqvalue: 1 } - Service UDP/SNMP/OperStatus.2 { + Service UDP/SNMP/ifOperStatus.2 { eqvalue: 1 } } diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/misc/argus.css /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/misc/argus.css --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/misc/argus.css 2008-02-03 00:23:32.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/misc/argus.css 2008-02-03 23:56:19.000000000 -0500 @@ -4,7 +4,7 @@ Created: 2007-Jan-10 23:20 (EST) Function: argus css - $Id: argus.css,v 1.6 2008/02/03 05:23:32 jaw Exp $ + $Id: argus.css,v 1.7 2008/02/04 04:56:19 jaw Exp $ */ @@ -13,12 +13,12 @@ border-spacing: 0; border: none; } -TD.BUTTON { +TD.BUTTON, TD.ERRORSBUTTON { border: none; background-color: #fff; } -TD.BUTTON > A { +TD.BUTTON > A, TD.ERRORSBUTTON > A { background-color: #ddd; display: block; border: 2px outset #ccc; @@ -28,6 +28,11 @@ text-decoration: none; } +TD.ERRORSBUTTON > A { + background-color: #f88; + border: 2px outset #e77; +} + /* make the stats table smaller and centered */ TABLE.STATS TD { font-size: 85%; diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Argus::Agent.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/Argus::Agent.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Argus::Agent.pm 2007-01-08 00:30:04.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/Argus::Agent.pm 2008-02-03 23:56:19.000000000 -0500 @@ -5,7 +5,7 @@ # Date: 2002-Nov-06 18:03 (EST) # Function: monitor various system values via a remote agent # -# $Id: Argus::Agent.pm,v 1.14 2007/01/08 05:30:04 jaw Exp $ +# $Id: Argus::Agent.pm,v 1.15 2008/02/04 04:56:19 jaw Exp $ package Argus::Agent; use Argus::Encode; @@ -73,7 +73,8 @@ #... $me->SUPER::config($cf); $me->{uname} = "SYS_$me->{ip}{hostname}_$l"; - + $me->{friendlyname} = "$l on me->{ip}{hostname}"; + } sub about_more { diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Argus::MonEl::Trans.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/Argus::MonEl::Trans.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Argus::MonEl::Trans.pm 2007-12-30 20:24:30.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/Argus::MonEl::Trans.pm 2008-03-03 10:45:16.000000000 -0500 @@ -5,7 +5,7 @@ # Created: 2007-Feb-14 12:23 (EST) # Function: MonEl object transition # -# $Id: Argus::MonEl::Trans.pm,v 1.3 2007/12/31 01:24:30 jaw Exp $ +# $Id: Argus::MonEl::Trans.pm,v 1.4 2008/03/03 15:45:16 jaw Exp $ package MonEl; use strict; @@ -73,19 +73,19 @@ $me->{status} = $nr; $me->{ovstatus} = $no; - if( $ca && ($me->{status} eq "down" && $me->{siren}) ){ - $me->{alarm} = 1; - # this may get cleared later if there is an override - }else{ - $me->{alarm} = 0; - } - if( $me->{ovstatus} eq 'down' ){ $me->{currseverity} = $csv || 'critical'; }else{ $me->{currseverity} = 'clear'; } + if( $ca && $me->alarming_p() ){ + $me->{alarm} = 1; + # this may get cleared later if there is an override + }else{ + $me->{alarm} = 0; + } + $me->transition2(); $me->{prevstatus} = $ps; $me->{prevovstatus} = $po; @@ -219,4 +219,13 @@ } +sub alarming_p { + my $me = shift; + + return 0 if $me->{status} ne 'down'; + my $s = $me->{"siren.$me->{currseverity}"}; + return $s if defined $s; + return $me->{siren}; +} + 1; diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Argus::SNMP.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/Argus::SNMP.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Argus::SNMP.pm 2008-02-02 22:00:41.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/Argus::SNMP.pm 2008-02-03 23:56:19.000000000 -0500 @@ -5,7 +5,7 @@ # Date: 2002-Apr-03 18:59 (EST) # Function: testing of SNMP things - support for both v1, v2c and v3 # -# $Id: Argus::SNMP.pm,v 1.4 2008/02/03 03:00:41 jaw Exp $ +# $Id: Argus::SNMP.pm,v 1.5 2008/02/04 04:56:19 jaw Exp $ # SNMP v1 => RFC 1157 # SNMP v2 => RFC 1905 @@ -361,6 +361,11 @@ my $me = shift; my @more; + + if( $me->{snmp}{bulk} ){ + ::sysproblem( 'BUG ALERT - SNMP bulk fetch did not finish processing' ); + } + if( $me->{snmp}{helping} ){ # continue, skip test, or down (host|oid) not found my $oid = eval { @@ -736,11 +741,12 @@ $fh = $me->{fd}; $i = recv($fh, $l, 8192, 0); - return $me->isdown( "SNMP recv failed: $!", 'recv failed' ) + return $me->m_isdown( "SNMP recv failed: $!", 'recv failed' ) unless defined($i); $me->debug( "SNMP recv data" ); $me->{udp}{rbuffer} = $l; # for debugging + delete $me->{udp}{send} if $me->{snmp}{bulk}; my $ber = Encoding::BER::SNMP->new( debug => $BER_DEBUG, error => sub { die "$_[0]\n" }, @@ -750,7 +756,7 @@ eval { $dat = $ber->decode( $l ); }; - return $me->isdown( "SNMP decode failed: $@", 'recv failed' ) if $@; + return $me->m_isdown( "SNMP decode failed: $@", 'recv failed' ) if $@; if( $me->{snmp}{snmpversion} == 1 || $me->{snmp}{snmpversion} eq '2c' ){ $dat->destruct_bind(my $resm = {}, [ 'version', 'community', \ 'snmppdu' ]); @@ -769,11 +775,11 @@ $dat->destruct_bind($resv, $snmp); my $secparam = $resv->{secparams}; - return $me->isdown("SNMP response corrupt.", 'BER error') unless $secparam; + return $me->m_isdown("SNMP response corrupt.", 'BER error') unless $secparam; # sec params is BER embedded in a string... $secparam = $ber->decode($secparam); - return $me->isdown("SNMP response corrupt.", 'BER error') unless $secparam; + return $me->m_isdown("SNMP response corrupt.", 'BER error') unless $secparam; my $usmsec = ['aeng', 'eboot', 'etime', 'name', 'authpm', 'privpm' ]; $secparam->destruct_bind($resv, $usmsec); @@ -801,12 +807,12 @@ eval { $scopedpdu = $ber->decode($d); }; - return $me->isdown( "SNMPv3 decryption failed: $@", 'decrypt failed' ) if $@; + return $me->m_isdown( "SNMPv3 decryption failed: $@", 'decrypt failed' ) if $@; }else{ $scopedpdu = $resv->{scopedpdu}; } - return $me->isdown("SNMP response corrupt.", 'BER error') unless $scopedpdu; + return $me->m_isdown("SNMP response corrupt.", 'BER error') unless $scopedpdu; # pull out snmppdu my $snmppdu = $scopedpdu->{value}[2]; @@ -825,7 +831,6 @@ $o->done(); } delete $me->{snmp}{bulk}; - delete $me->{udp}{send}; return; } @@ -843,7 +848,6 @@ $o->done(); } delete $me->{snmp}{bulk}; - delete $me->{udp}{send}; return; } @@ -875,22 +879,22 @@ for my $oid (keys %repoid){ $oid1 = $oid; if( $v3errs{$oid} ){ - return $me->isdown( "SNMPv3 error report. $v3errs{$oid}", 'SNMP error' ); + return $me->m_isdown( "SNMPv3 error report. $v3errs{$oid}", 'SNMP error' ); } } - return $me->isdown( "SNMPv3 report. possibly misconfigured? ($oid1)", 'SNMP error' ); + return $me->m_isdown( "SNMPv3 report. possibly misconfigured? ($oid1)", 'SNMP error' ); }else{ - return $me->isdown( "SNMPv3 unknown reply type ($pdutype)", 'SNMP error' ); + return $me->m_isdown( "SNMPv3 unknown reply type ($pdutype)", 'SNMP error' ); } } - return $me->isdown("SNMP response corrupt.", 'BER error') unless $results; + return $me->m_isdown("SNMP response corrupt.", 'BER error') unless $results; if( $results->{errst} ){ # 1 bad oid in a bulk query, not an error unless( @{$results->{res}} && $results->{errst} == 2){ - return $me->isdown( "SNMP error - " . $errstat{$results->{errst}} || $results->{errst}, 'SNMP error' ); + return $me->m_isdown( "SNMP error - " . $errstat{$results->{errst}} || $results->{errst}, 'SNMP error' ); } } @@ -925,24 +929,22 @@ $o->check_and_test_result($val); } delete $me->{snmp}{bulk}; - delete $me->{udp}{send}; }else{ my $value = $results->{res}[0]{val}; $me->check_and_test_result($value); } } -sub isdown { +sub m_isdown { my $me = shift; if( $me->{snmp}{bulk} ){ foreach my $o (@{$me->{snmp}{bulk}}){ - $o->SUPER::isdown(@_); + $o->isdown(@_); } } delete $me->{snmp}{bulk}; - delete $me->{udp}{send}; - $me->SUPER::isdown(@_); + $me->isdown(@_); } sub timeout { @@ -951,10 +953,9 @@ if( $me->{snmp}{bulk} ){ foreach my $o (@{$me->{snmp}{bulk}}){ $o->SUPER::timeout(@_); - } + } } delete $me->{snmp}{bulk}; - delete $me->{udp}{send}; $me->SUPER::timeout(@_); } diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/BaseIO.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/BaseIO.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/BaseIO.pm 2007-09-01 12:51:35.000000000 -0400 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/BaseIO.pm 2008-03-03 10:45:16.000000000 -0500 @@ -5,7 +5,7 @@ # Date: 2002-Apr-02 09:47 (EST) # Function: BaseIO class # -# $Id: BaseIO.pm,v 1.51 2007/09/01 16:51:35 jaw Exp $ +# $Id: BaseIO.pm,v 1.52 2008/03/03 15:45:16 jaw Exp $ # low-level I/O, non-blocking, select-loop @@ -253,7 +253,7 @@ my $i; if( $tt == $addtimed_time && $addtimed_index < @bytime ){ - # oftentimes, many srvcs will the same freq finish at the same time + # oftentimes, many srvcs with the same freq finish at the same time # eg. bulk Pings # they will all want to be scheduled at the same time again # we try to cache the index and reuse @@ -492,7 +492,7 @@ $done++; # prevent resource starvation under load - last if $max && $done > $max; + return if $max && $done > $max; } # finished this entire set? @@ -767,7 +767,7 @@ # initialization ################################################################ -Control::command_install( 'filinfo', \&cmd_filinfo, "file info" ); +Control::command_install( 'filinfo', \&cmd_filinfo, "file info" ); Control::command_install( 'files', \&cmd_files, "list all open file descriptors" ); Control::command_install( 'sched', \&cmd_schedule, "list all scheduled tasks" ); Doc::register( $doc ); diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/MonEl.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/MonEl.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/MonEl.pm 2008-02-03 09:52:34.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/MonEl.pm 2008-03-03 10:45:17.000000000 -0500 @@ -5,7 +5,7 @@ # Date: 2002-Apr-02 17:11 (EST) # Function: Monitor Element class # -# $Id: MonEl.pm,v 1.156 2008/02/03 05:23:33 jaw Exp $ +# $Id: MonEl.pm,v 1.158 2008/03/03 15:45:17 jaw Exp $ package MonEl; @ISA = qw(Configable); @@ -301,7 +301,7 @@ notify::shortmessages => { descr => 'deprecated, use message_style: short', attrs => ['config', 'bool', 'deprecated'], - versn => '3.2', + versn => '3.6', default => 'no', html => 'notif', }, @@ -942,17 +942,26 @@ # add in severity based notification params for my $sev qw(critical major minor warning){ - for my $nt qw(notify renotify autoack escalate sendnotify ack_on_better ack_on_worse){ + for my $p qw(notify renotify autoack escalate sendnotify ack_on_better ack_on_worse){ # none of these are applicable for 'up/clear' - my %d = %{ $doc->{fields}{"notify::$nt"} }; + my %d = %{ $doc->{fields}{"notify::$p"} }; $d{versn} = '3.6'; $d{descr} .= " when down/$sev"; delete $d{default}; - $doc->{fields}{"notify::$nt.$sev"} = \%d; + $doc->{fields}{"notify::$p.$sev"} = \%d; } } delete $doc->{fields}{'notify::ack_on_worse.critical'}; +for my $sev qw(critical major minor warning clear){ + for my $p qw(siren web::icon){ + my %d = %{ $doc->{fields}{$p} }; + $d{versn} = '3.6'; + $d{descr} .= ($sev eq 'clear') ? " when up/$sev" : " when down/$sev"; + delete $d{default}; + $doc->{fields}{"$p.$sev"} = \%d; + } +} # what is my name? sub unique { diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Notify.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/Notify.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Notify.pm 2008-02-03 00:37:08.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/Notify.pm 2008-03-03 10:45:17.000000000 -0500 @@ -5,7 +5,7 @@ # Date: 2002-Apr-12 20:06 (EDT) # Function: Tell someone what happened # -# $Id: Notify.pm,v 1.72 2008/02/03 05:37:08 jaw Exp $ +# $Id: Notify.pm,v 1.74 2008/03/03 15:45:17 jaw Exp $ package Notify; use NotMe; @@ -27,7 +27,7 @@ my $QUEUETIME = 120; # if older than this, and no longer active, throw them away -my $OLD_AGE = 3600 * 24 * 5; +my $OLD_AGE = 3600 * 24 * 10; # delay escalation, if no longer down for this long my $DELAY_ESCALATE = 600; @@ -170,7 +170,7 @@ # pre-build escalation table # A wicked messenger falleth into mischief: but a faithful ambassador is health. # -- proverbs 13:17 - { + unless( $me->{autoack} ){ my $n = 1; my $esc = value_at_severity('escalate', $obj, $me->{severity}); if( $esc ){ @@ -324,6 +324,8 @@ $me->init($obj); } +################################################################ + sub notify { my $me = shift; my( $l ); @@ -334,6 +336,7 @@ $me->{sentcnt} ++; $me->{lastsent} = $^T; + $me->ack() if $me->{autoack}; } # I say again! repeated the Pigeon @@ -364,6 +367,9 @@ my $me = shift; my( $n ); + # auto-ack if aa and it has already been sent + return $me->ack() if $me->{autoack}; + # postpone if no longer down for X minutes if( $me->{obj}->{status} ne 'down' && $^T - $me->{obj}->{transtime} > $DELAY_ESCALATE ){ @@ -388,7 +394,7 @@ $qt = NotMe::qtime($dst); $qt = ::topconf('qtime') unless defined $qt; $qt = $QUEUETIME unless defined $qt; - + if( $lastsent{$dst} && ($lastsent{$dst} + $qt > $^T) ){ $me->queue($dst, $tag); }else{ @@ -616,19 +622,10 @@ # if many, summarize if( @more ){ + my $nolots = NotMe::nolots( $dst ); $nolots ||= ::topconf('nolotsmsgs'); - my $d; - foreach my $p (@more){ - $d = 1 if $p->{objstate} eq 'down'; - } - if( $d ){ - $msg = ::topconf('message_lotsdn') || 'Lots of stuff just went DOWN!'; - }else{ - $msg = ::topconf('message_lotsup') || 'Lots of stuff just came UP!'; - } - if( $nolots ){ # list all messages, don't summarize into Lots UP/DOWN @@ -640,8 +637,17 @@ } $msg = join($j, map { $_->{msg} } $msg, @more); + }else{ + my $d; + foreach my $p (@more){ + $d = 1 if $p->{objstate} eq 'down'; + } + if( $d ){ + $msg = ::topconf('message_lotsdn') || 'Lots of stuff just went DOWN!'; + }else{ + $msg = ::topconf('message_lotsup') || 'Lots of stuff just came UP!'; + } } - }else{ $msg = $me->{msg}; } diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Self.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/Self.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Self.pm 2007-02-18 16:20:25.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/Self.pm 2008-02-03 23:56:20.000000000 -0500 @@ -5,7 +5,7 @@ # Date: 2003-Apr-06 13:08 (EST) # Function: monitor myself - for testing, etc # -# $Id: Self.pm,v 1.12 2007/02/18 21:20:25 jaw Exp $ +# $Id: Self.pm,v 1.13 2008/02/04 04:56:20 jaw Exp $ package Self; @@ -53,6 +53,8 @@ $me->{label_right_maybe} ||= $me->{self}{param}; $me->{uname} = "Self_$me->{self}{param}"; + $me->{friendlyname} = "test of argus internal $me->{self}{param}"; + } sub start { diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Service.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/Service.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Service.pm 2008-02-02 22:00:44.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/Service.pm 2008-03-03 10:45:17.000000000 -0500 @@ -5,7 +5,7 @@ # Date: 2002-Apr-03 08:56 (EST) # Function: the service class # -# $Id: Service.pm,v 1.114 2008/02/03 03:00:44 jaw Exp $ +# $Id: Service.pm,v 1.116 2008/03/03 15:45:17 jaw Exp $ package Service; @ISA = qw(MonEl BaseIO); @@ -337,7 +337,7 @@ $me->init_from_config( $cf, $doc, 'srvc' ); $me->init_from_config( $cf, $doc, 'graphd' ); - $me->generic_test_config($cf); + $me->init_from_config( $cf, $doc, 'test' ); # frequency = 0 is not permitted $me->{srvc}{frequency} ||= $ZERO_FREQ; @@ -348,6 +348,8 @@ $me->{uname} ||= $me->{name}; return undef unless $me->init($cf); # == MonEl::init + $me->generic_test_config($cf); + # the default is different for Service, set if not specified in config $me->{notify}{sendnotify} = 1 unless defined $me->{notify}{sendnotify}; @@ -481,8 +483,6 @@ sub run_alsoruns { my $me = shift; - $me->{srvc}{result_valid} = 1; - if( $me->{srvc}{alsorun} ){ for my $s ( @{$me->{srvc}{alsorun}} ){ $s->start(); @@ -518,10 +518,16 @@ $s->{elapsed} = 0; $s->{reason} = $reason; - $s->{status} = 'down'; - # to make %v in notifications more useful - $s->{result} = $altval if defined $altval && exists $s->{result}; - + $s->{status} = 'down'; + $s->{result_valid} = 1 if exists $s->{result}; + + if( defined($altval) && exists($s->{result}) ){ + # to make %v in notifications more useful + $s->{result} = $altval; + # but don't use it to Compute or graph + $s->{result_valid} = 0; + } + $me->debug( "Service DOWN - $reason" ) if $reason; if( ($s->{tries} || 0) <= $s->{retries} ){ @@ -537,7 +543,7 @@ $me->update( $s->{invert_status} ? 'up' : 'down', $sever ); } - $me->graph_add_sample( $s->{result}, $me->{ovstatus} ) if $me->{graph}; + $me->graph_add_sample( $s->{result}, $me->{ovstatus} ) if $me->{graph} && $s->{result_valid}; $me->archive_log_data(); $me->run_alsoruns(); $me->done(); @@ -554,6 +560,8 @@ $s->{reason} = undef; $s->{tries} = 0; $s->{status} = 'up'; + $s->{result_valid} = 1; + $me->update( $s->{invert_status} ? 'down' : 'up' ); $me->graph_add_sample( $s->{result}, $me->{ovstatus} ) if $me->{graph}; @@ -596,9 +604,9 @@ $me->{ovstatus} = $st; $me->{transtime} = $^T; # these may get cleared in t2 if there is an override - $me->{alarm} = (($me->{status} eq 'down') && $me->{siren}) ? 1 : 0; $me->{currseverity} = ($me->{status} eq 'down') ? ($sv || $me->{severity}) : 'clear'; - + $me->{alarm} = $me->alarming_p(); + $me->transition2(); $me->{prevstatus} = $ps; $me->{prevovstatus} = $po; @@ -711,8 +719,6 @@ my $me = shift; my $cf = shift; - $me->init_from_config( $cf, $doc, 'test' ); - foreach my $p (qw/expect nexpect minvalue maxvalue eqvalue nevalue calc pluck unpack scale perlexpr/){ $me->{test}{testedp} = 1 if defined($me->{test}{$p}); diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Stats.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/Stats.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Stats.pm 2007-12-30 20:24:33.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/Stats.pm 2008-03-03 10:45:18.000000000 -0500 @@ -5,7 +5,7 @@ # Date: 2002-Apr-05 10:28 (EST) # Function: maintain object statistics # -# $Id: Stats.pm,v 1.46 2007/12/31 01:24:33 jaw Exp $ +# $Id: Stats.pm,v 1.48 2008/03/03 15:45:18 jaw Exp $ package MonEl; @@ -16,6 +16,7 @@ my $STATS_KEEP_DAYS = 14; my $STATS_KEEP_MONTHS = 14; my $STATS_KEEP_YEARS = 10; +my $STATS_KEEP_LOGS = 1000; my $SAVE_TIME_MIN = 30; # for self testing, etc @@ -25,7 +26,7 @@ my $me = shift; my( $foo, $lastt, @l ); - return if $me->{transient} || ::topconf('_test_mode'); + return if $me->{transient} || ::topconf('_test_mode') || $::opt_t; $me->{stats}{status} = $me->{status}; $me->{stats}{lasttime} = $^T; @@ -161,7 +162,7 @@ my $me = shift; my( $file, $p, $l ); - return if $me->{transient} || ::topconf('_test_mode'); + return if $me->{transient} || ::topconf('_test_mode') || $::opt_t; $file = "$::datadir/stats/" . $me->pathname(); open( FILE, ">$file" ) || @@ -223,8 +224,10 @@ } } } - + + my $nlog = 0; foreach $l ( @{$me->{stats}{log}} ){ + last if $nlog ++ > $STATS_KEEP_LOGS; # [ time, status, ovstatus, tag, msg ] print FILE "log $l->[0] $l->[1] $l->[2] ", (encode($l->[3]) || '_'), ' ', diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Web.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/Web.pm --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Web.pm 2008-02-02 22:00:45.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/Web.pm 2008-03-03 10:45:18.000000000 -0500 @@ -5,7 +5,7 @@ # Date: 2002-Apr-06 21:30 (EST) # Function: web page stuff # -# $Id: Web.pm,v 1.66 2008/02/03 03:00:45 jaw Exp $ +# $Id: Web.pm,v 1.68 2008/03/03 15:45:18 jaw Exp $ package MonEl; use strict; @@ -60,7 +60,6 @@ $title ||= $me->unique(); $id ||= $me->filename(); - my $icon; my $refresh = $me->{web}{refresh}; my $bkgimg = $me->{web}{bkgimage}; @@ -71,10 +70,12 @@ print $fh "\n"; print $fh "Argus - $title\n"; print $fh "\n" if $refresh; + + my $icon = $me->{web}{"icon.$me->{currseverity}"}; if( $me->{ovstatus} eq 'up' ){ - $icon = $me->{web}{icon_up}; + $icon ||= $me->{web}{icon_up}; }elsif( $me->{ovstatus} eq 'down' ){ - $icon = $me->{web}{icon_down}; + $icon ||= $me->{web}{icon_down}; } $icon ||= $me->{web}{icon}; print $fh "\n" @@ -360,8 +361,9 @@ sub web_button_text { my $txt = shift; my $color = shift || 'DDDDDD'; - - "
". + + my $class = ($color eq 'FF8888') ? 'ERRORSBUTTON' : 'BUTTON'; + "
". "$txt
\n"; } diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/cgi /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/cgi --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/cgi 2008-02-02 22:00:45.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/cgi 2008-02-03 23:56:21.000000000 -0500 @@ -6,7 +6,7 @@ # Date: 2002-Apr-02 23:12 (EST) # Function: cgi frontend (will run as cgi-bin or as mod_perl) # -# $Id: cgi,v 1.87 2008/02/03 03:00:45 jaw Exp $ +# $Id: cgi,v 1.88 2008/02/04 04:56:21 jaw Exp $ use lib('__LIBDIR__'); @@ -50,7 +50,7 @@ my %auth; my %fnc_dispatch = - # function, need authcookie +# function, need authcookie, default user ( error => [\&web_error, 0 ], default => [\&web_home, 0 ], @@ -58,7 +58,7 @@ login => [\&web_login, 0 ], logout => [\&web_logout, 1 ], page => [\&web_page, 1 ], - graph => [\&web_graph, 1 ], + graph => [\&web_graph, 1, 'graphuser' ], graphpage => [\&web_graphpage, 1 ], flushcache => [\&web_flushcache, 1 ], about => [\&web_about, 1 ], @@ -67,15 +67,15 @@ rmannotate => [\&web_annotate, 1 ], override => [\&web_override, 1 ], rmoverride => [\&web_rmoverride, 1 ], - logfile => [\&web_logfile, 1 ], + logfile => [\&web_logfile, 1, 'loguser' ], ntfylist => [\&web_ntfylist, 1 ], ntfylsua => [\&web_ntfylsua, 1 ], ntfydetail => [\&web_ntfydetail, 1 ], ntfyack => [\&web_ntfyack, 1 ], hushsiren => [\&web_hushsiren, 1 ], checknow => [\&web_checknow, 1 ], - summary => [\&web_summary, 1 ], - rss => [\&web_notify_rss, 1 ], + summary => [\&web_summary, 1, 'json' ], + rss => [\&web_notify_rss, 1, 'rss' ], ); my $TZ = $ENV{TZ}; @@ -144,10 +144,16 @@ } # set desired language init_l10n($x, $x->{prefs}{LANG} || $lang_conf || $ENV{LC_ALL} || $ENV{LC_ARGUS} || $ENV{LANG} || 'default'); - - # if func requires cookie, and we don't have one, force login + + # does function require being logged in? if( $fnc->[1] && ! $x->{auth}{user} ){ - $fnc = $fnc_dispatch{home}; + # does function allow a special user to bypass being logged in? + if( $fnc->[2] && $x->authenticate( $fnc->[2], '') ){ + # ok. let'm in. + }else{ + # force user to log in + $fnc = $fnc_dispatch{home}; + } } # print STDERR "[$$] func $f\n"; @@ -177,7 +183,7 @@ delete $me->{ci} if $me->{ci} eq 'invalid'; if( ! $me->{ci} && !defined &auth_user ){ - # bypass login + # bypass login if no auth function exists $me->create_auth( 'webanon', 'Top', 'root', 'staff', 'user' ); $me->{ci} = $me->{co}; } diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/graphd.pl /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/graphd.pl --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/graphd.pl 2008-02-02 22:00:46.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/graphd.pl 2008-02-03 23:56:21.000000000 -0500 @@ -6,7 +6,7 @@ # Date: 2002-Oct-31 15:45 (EST) # Function: server side of graph data collector # -# $Id: graphd.pl,v 1.14 2008/02/03 03:00:46 jaw Exp $ +# $Id: graphd.pl,v 1.15 2008/02/04 04:56:21 jaw Exp $ # read in data from argusd, save to data files # uses a large number of file descriptors, be sure @@ -22,7 +22,7 @@ use POSIX qw(:errno_h); use strict; -my $DEBUG = 1; +my $DEBUG = 0; my %obj = (); my @lru = (); my $nopen; diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/main.pl /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/main.pl --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/main.pl 2008-02-02 22:00:46.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/main.pl 2008-02-03 23:56:21.000000000 -0500 @@ -6,7 +6,7 @@ # Date: 2002-Apr-02 12:09 (EST) # Function: argus startup and glue # -# $Id: main.pl,v 1.68 2008/02/03 03:00:46 jaw Exp $ +# $Id: main.pl,v 1.69 2008/02/04 04:56:21 jaw Exp $ # In God we trust, everyone else we monitor. # -- U2 pilot motto @@ -148,7 +148,7 @@ } } -# create subdirs, clean old files +# create subdirs # NB: gcache might not be writable my $wantclean; foreach my $dir (qw(html gdata stats)){ diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/vxml /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/vxml --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/vxml 2007-01-27 12:14:44.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/vxml 2008-03-03 10:45:18.000000000 -0500 @@ -6,7 +6,7 @@ # Created: 2005-Dec-10 15:18 (EST) # Function: vxml cgi # -# $Id: vxml,v 1.11 2007/01/27 17:14:44 jaw Exp $ +# $Id: vxml,v 1.12 2008/03/03 15:45:18 jaw Exp $ # tested + works on: blix, voxeo # does not work on: tellme @@ -456,7 +456,7 @@ print < - + Alert $sayidno. $name became $r->{objstate} at $when. $acked , press . diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/web_login.pl /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/web_login.pl --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/web_login.pl 2007-02-20 16:39:39.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/web_login.pl 2008-02-03 23:56:21.000000000 -0500 @@ -5,7 +5,7 @@ # Created: 2005-Dec-10 12:55 (EST) # Function: # -# $Id: web_login.pl,v 1.3 2007/01/14 23:00:02 jaw Exp $ +# $Id: web_login.pl,v 1.4 2008/02/04 04:56:21 jaw Exp $ package Argus::Web; use strict; @@ -22,44 +22,57 @@ $me->heavy_redirect( $me->{q}->url() ); } +sub authenticate { + my $me = shift; + my $user = shift; + my $pass = shift; + + my @a; + if( !defined &auth_user ){ + # no auth function. allow access. + @a = ('Top', 'root', 'staff', 'user' ); + $user = 'webanon'; + }else{ + expire_auth(); + @a = auth_user( $user, $pass ); + } + if( @a ){ + $me->create_auth( $user, @a ); + return ( $user, @a ); + } + return ; +} + sub web_login { my $me = shift; my $q = $me->{q}; - my( $emsg, $user ); + + my $user = $q->param('name'); - if( !defined &auth_user ){ - $me->create_auth( 'webanon', 'Top', 'root', 'staff', 'user' ); - my $func = $q->param('nextf') || 'page'; - my $home = $q->param('home') || 'Top'; - my $top = 1; - return $me->heavy_redirect( $me->{q}->url() . "?object=$home;func=$func;top=$top" ); + unless( $user ){ + $me->web_login_form(); + return ; } - if( $q->param('name') ){ - # authenticate user - my @a; - $user = $q->param('name'); + my @a = $me->authenticate( $user, $q->param('passwd') ); - expire_auth(); - @a = auth_user( $user, $q->param('passwd') ); + unless(@a){ + my $emsg = l10n('Authentication Failed'); + $me->web_login_form(); + return ; + } - if( @a ){ - $me->create_auth( $user, @a ); - my( $func, $home, $top ); - $func = $q->param('nextf') || 'page'; - if( $q->param('home') ){ - $home = $q->param('home'); - $top = $q->param('top'); - }else{ - $home = $a[0]; - $top = 1; - } - return $me->heavy_redirect( $me->{q}->url() . "?object=$home;func=$func;top=$top" ); - }else{ - $emsg = l10n('Authentication Failed'); - } + my( $func, $home, $top ); + $func = $q->param('nextf') || 'page'; + if( $q->param('home') ){ + $home = $q->param('home'); + $top = $q->param('top'); + }else{ + $home = $a[1]; + $top = 1; } - $me->web_login_form($emsg); + return $me->heavy_redirect( $me->{q}->url() . "?object=$home;func=$func;top=$top" ); + } sub web_login_form { diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/web_web20.pl /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/web_web20.pl --- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/web_web20.pl 2007-01-21 18:07:23.000000000 -0500 +++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080301/src/web_web20.pl 2008-02-03 23:56:21.000000000 -0500 @@ -5,7 +5,7 @@ # Created: 2007-Jan-14 12:10 (EST) # Function: json + rss output for integration with other apps # -# $Id: web_web20.pl,v 1.2 2007/01/21 23:07:23 jaw Exp $ +# $Id: web_web20.pl,v 1.3 2008/02/04 04:56:21 jaw Exp $ package Argus::Web; use strict; @@ -79,14 +79,14 @@ $url/?func=ntfylist Argus Notifications Argus $VERSION - 2 + 2 EOCHAN ; # Throw me in the channel! # -- Shakespeare, 2 king Henry IV foreach my $nd (@{$r->{data}}){ - my $dt = strftime "%a, %d %b %Y %R %z", localtime($nd->{create}); + my $dt = strftime "%a, %d %b %Y %R %z", localtime($nd->{create}); my $obj = decode($nd->{obj}); my $msg = decode($nd->{msg}); my $id = $nd->{id};