diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/CHANGES /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/CHANGES
--- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/CHANGES 2007-12-30 20:33:32.000000000 -0500
+++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/CHANGES 2008-02-02 16:24:04.000000000 -0500
@@ -8,6 +8,9 @@
new data directory structure
show test results on webpage
overview webpage
+ friendlier notification messages
+ bugfixes
+ => some config file changes may be needed
* Version 3.5 [2007 June 14]
SNMPv2c
diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/Configure /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/Configure
--- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/Configure 2007-01-15 21:40:51.000000000 -0500
+++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/Configure 2008-02-02 22:00:40.000000000 -0500
@@ -5,7 +5,7 @@
# Date: 2002-Apr-19 16:44 (EDT)
# Function: discover configuration info
#
-# $Id: Configure,v 1.24 2007/01/16 02:40:51 jaw Exp $
+# $Id: Configure,v 1.25 2008/02/03 03:00:40 jaw Exp $
cat</dev/null 2>&1; then
+ # nb. fping might be a symlink. just try running it
+ $path_fping 127.0.0.1 >/dev/null 2>&1
+ if [ $? != 0 ] ; then
echo '* but it is not installed setuid'
echo '* argus ping tests will fail unless argus runs as root'
echo '* or fping is fixed'
diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/Makefile.tplt /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/Makefile.tplt
--- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/Makefile.tplt 2007-12-31 17:20:31.000000000 -0500
+++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/Makefile.tplt 2008-02-02 22:00:40.000000000 -0500
@@ -3,9 +3,9 @@
# Created: 2002-Jun-27
# Function: Makefile template
#
-# $Id: Makefile.tplt,v 1.169 2007/12/31 22:20:31 jaw Exp $
+# $Id: Makefile.tplt,v 1.170 2008/02/03 03:00:40 jaw Exp $
-VERSION = dev-20071231
+VERSION = dev-20080202
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
@@ -27,7 +27,7 @@
NotMe.pm Override.pm Server.pm Service.pm Stats.pm \
Web.pm NullConf.pm Error.pm Argus::Ctl.pm Argus::Encode.pm \
NullCtl.pm UserCron.pm TestPort.pm Resolv.pm \
- misc.pl localization.pl \
+ misc.pl localization.pl Argus::HashDir.pm \
Argus::MonEl::Expand.pm Argus::MonEl::Noise.pm Argus::MonEl::Trans.pm \
Argus::Archivist.pm Argus::Archive.pm Argus::Web::Overview.pm
diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/misc/argus.css /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/misc/argus.css
--- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/misc/argus.css 2007-12-30 20:24:30.000000000 -0500
+++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/misc/argus.css 2008-02-03 00:23:32.000000000 -0500
@@ -4,7 +4,7 @@
Created: 2007-Jan-10 23:20 (EST)
Function: argus css
- $Id: argus.css,v 1.4 2007/12/31 01:24:30 jaw Exp $
+ $Id: argus.css,v 1.6 2008/02/03 05:23:32 jaw Exp $
*/
diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Argus::HashDir.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Argus::HashDir.pm
--- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Argus::HashDir.pm 1969-12-31 19:00:00.000000000 -0500
+++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Argus::HashDir.pm 2008-01-21 12:21:02.000000000 -0500
@@ -0,0 +1,39 @@
+# -*- perl -*-
+
+# Copyright (c) 2008 by Jeff Weisberg
+# Author: Jeff Weisberg
+# Created: 2008-Jan-21 12:18 (EST)
+# Function:
+#
+# $Id$
+
+package Argus::HashDir;
+use strict;
+
+# quickly pick a 2 level directory for the file
+sub hashed_directory {
+ my $file = shift;
+
+ my $h = 5381;
+ for my $c (split '', $file){
+ $h = (33*$h) + ord($c);
+ $h &= 0xFFFFFF;
+ }
+
+ my $a = ($h % 26) + 65;
+ $h >>= 5;
+ my $b = ($h % 26) + 65;
+
+ sprintf '%c/%c', $a, $b;
+}
+
+sub import {
+ my $pkg = shift;
+ my $caller = caller;
+
+ no strict;
+ *{$caller . '::hashed_directory'} = \&hashed_directory;
+}
+
+
+1;
diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Argus::MonEl::Expand.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Argus::MonEl::Expand.pm
--- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Argus::MonEl::Expand.pm 2007-01-27 16:34:34.000000000 -0500
+++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Argus::MonEl::Expand.pm 2008-02-02 22:00:41.000000000 -0500
@@ -5,7 +5,7 @@
# Created: 2007-Jan-27 10:28 (EST)
# Function: expand % sequences
#
-# $Id: Argus::MonEl::Expand.pm,v 1.2 2007/01/27 21:34:34 jaw Exp $
+# $Id: Argus::MonEl::Expand.pm,v 1.3 2008/02/03 03:00:41 jaw Exp $
package MonEl;
use POSIX ('strftime', 'tzset');
@@ -85,7 +85,7 @@
# specified mappings before standard ones, so they can override
my $l = join('', keys %$data);
$fmt =~ s/%([$l])/$enc->($data->{$1})/ges if $l;
-
+
$fmt =~ s/%d/$enc->($DARP::info->{tag})/ges if defined $DARP::info;
$fmt =~ s/%r/$enc->($me->{srvc}{reason})/ges;
$fmt =~ s/%s/uc($enc->($me->{ovstatus}))/ges;
diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Argus::SNMP.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Argus::SNMP.pm
--- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Argus::SNMP.pm 2007-06-30 14:38:42.000000000 -0400
+++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Argus::SNMP.pm 2008-02-02 22:00:41.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.3 2007/06/30 18:38:42 jaw Exp $
+# $Id: Argus::SNMP.pm,v 1.4 2008/02/03 03:00:41 jaw Exp $
# SNMP v1 => RFC 1157
# SNMP v2 => RFC 1905
@@ -288,6 +288,7 @@
$me->{label_right_maybe} ||= $me->{snmp}{oid};
$me->{udp}{port} ||= 161;
$me->SUPER::config($cf);
+ $me->{friendlyname} = "$me->{snmp}{oid} on $me->{ip}{hostname}";
$me->snmp_oid_init($cf);
$me;
diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Argus::Web::Overview.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Argus::Web::Overview.pm
--- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Argus::Web::Overview.pm 2007-12-30 20:24:31.000000000 -0500
+++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Argus::Web::Overview.pm 2008-02-02 22:00:42.000000000 -0500
@@ -5,7 +5,7 @@
# Created: 2007-Dec-30 15:42 (EST)
# Function: web page overview
#
-# $Id: Argus::Web::Overview.pm,v 1.1 2007/12/31 01:24:31 jaw Exp $
+# $Id: Argus::Web::Overview.pm,v 1.2 2008/02/03 03:00:42 jaw Exp $
package MonEl;
use strict;
@@ -25,11 +25,11 @@
unless open( $fh, "> $file" ) ;
$top->{web}{buildtimeov} = $^T;
- $top->web_header($fh);
+ $top->web_header($fh, 'Overview', 'Overview' );
print $fh "\n";
- $top->web_show_has_errors($fh) if $Conf::has_errors;
+ $top->web_show_has_errors($fh, 3) if $Conf::has_errors;
my $color = $Conf::has_errors ? 'FF8888' : 'AAAAFF';
@@ -73,6 +73,8 @@
for my $x (sort { $b->{transtime} <=> $a->{transtime} } @obj){
next unless $x;
next unless $x->{interesting};
+ next if $x->{anc_in_ov};
+ next if $x->{ovstatus} eq 'depends';
my $url = $x->url('func=page');
my $label = $x->{label_overview} || $x->unique();
my $color = MonEl::web_color($x->{ovstatus}, $x->{currseverity});
@@ -125,6 +127,7 @@
for my $p (sort {$a->{created} <=> $b->{created}} values %$unacked){
my $color = ($p->{status} eq 'acked') ? '88FF88' : 'FF8888';
my $txt = $p->{msg};
+ $txt =~ s/\n/
\n/gs;
my $url = "__BASEURL__?func=ntfydetail;idno=$p->{idno}";
print $fh "\n";
diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Conf.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Conf.pm
--- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Conf.pm 2007-12-30 20:24:31.000000000 -0500
+++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Conf.pm 2008-02-02 22:00:42.000000000 -0500
@@ -5,7 +5,7 @@
# Date: 2002-Apr-03 09:13 (EST)
# Function: config file reading
#
-# $Id: Conf.pm,v 1.61 2007/12/31 01:24:31 jaw Exp $
+# $Id: Conf.pm,v 1.62 2008/02/03 03:00:42 jaw Exp $
# some bozo put a Config.pm in the standard perl dist
package Conf;
@@ -101,12 +101,6 @@
default => ($^O eq 'solaris' ? 250 : undef),
versn => '3.6',
},
-
- newdirs => { # XXX?
- attrs => ['config', 'top'],
- versn => '3.6',
- },
-
################################################################
# experimental, undocumented features - for author's use only
diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Configable.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Configable.pm
--- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Configable.pm 2007-12-22 12:22:13.000000000 -0500
+++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Configable.pm 2008-02-02 22:00:42.000000000 -0500
@@ -5,7 +5,7 @@
# Date: 2002-Dec-30 23:29 (EST)
# Function: configurable objects
#
-# $Id: Configable.pm,v 1.25 2007/12/22 17:22:13 jaw Exp $
+# $Id: Configable.pm,v 1.26 2008/02/03 03:00:42 jaw Exp $
package Configable;
@@ -401,6 +401,7 @@
next if ($k =~ /^_/) && ::topconf('_hide_expr');
$v =~ s/\#/\\\#/g;
$v =~ s/\n/\\n\\\n/g;
+ $v =~ s/\r/\\r/g;
$r .= "\t$k:\t$v";
$r .= "\t# unused parameter - typo?"
unless $me->{confck}{$k} || $d->{conf}{notypos};
diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/DNS.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/DNS.pm
--- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/DNS.pm 2007-01-08 00:30:04.000000000 -0500
+++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/DNS.pm 2008-02-02 22:00:42.000000000 -0500
@@ -5,7 +5,7 @@
# Date: 2002-Nov-13 10:53 (EST)
# Function: a swiss-army DNS tester
#
-# $Id: DNS.pm,v 1.25 2007/01/08 05:30:04 jaw Exp $
+# $Id: DNS.pm,v 1.26 2008/02/03 03:00:42 jaw Exp $
# it seems that there is no end to the DNS server mis-configurations
# and failure modes that are available. this is an attempt to stay one step ahead.
@@ -158,6 +158,7 @@
$cf->warning("unknown DNS test method '$me->{dns}{test}")
unless grep {$_ eq $me->{dns}{test}} qw(none noerror authok serial answer nanswers);
+ $me->{friendlyname} = "DNS for $me->{dns}{zone} on $me->{ip}{hostname}";
$me;
}
diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/MonEl.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/MonEl.pm
--- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/MonEl.pm 2007-12-30 20:50:37.000000000 -0500
+++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/MonEl.pm 2008-02-03 09:52:34.000000000 -0500
@@ -5,7 +5,7 @@
# Date: 2002-Apr-02 17:11 (EST)
# Function: Monitor Element class
#
-# $Id: MonEl.pm,v 1.154 2007/12/31 01:50:37 jaw Exp $
+# $Id: MonEl.pm,v 1.156 2008/02/03 05:23:33 jaw Exp $
package MonEl;
@ISA = qw(Configable);
@@ -65,6 +65,9 @@
# uname: HTTP-2
# }
},
+ friendlyname => {
+ descr => 'a friendlier name for this object',
+ },
unique => {
descr => 'full unique name of this object',
},
@@ -248,7 +251,7 @@
descr => 'format for notification messages',
attrs => ['config', 'inherit'],
# message{up,dn} => %m
- default => '%i %m - %t',
+ default => '%i %t - %m',
versn => '3.3',
},
notify::message_fmtup => {
@@ -296,15 +299,24 @@
versn => '3.5', # was 'no'
},
notify::shortmessages => {
- descr => 'use shorter default notification messages',
- attrs => ['config', 'inherit', 'bool'],
+ descr => 'deprecated, use message_style: short',
+ attrs => ['config', 'bool', 'deprecated'],
versn => '3.2',
default => 'no',
html => 'notif',
},
+ notify::message_style => {
+ descr => 'what style of message to send by default',
+ attrs => ['config', 'inherit'],
+ vals => ['long', 'short', 'friendly'],
+ versn => '3.6',
+ default => 'friendly',
+ html => 'notif',
+ },
notify::notify => {
- descr => 'list of addresses to notify: method:address method:address ...',
+ descr => 'list of addresses to notify',
+ exmpl => 'mail:user@example.com qpage:sysop aim:joeysmith vxml:2155551234',
attrs => ['config', 'inherit'],
html => 'notif',
},
@@ -332,26 +344,8 @@
html => 'notif',
versn => '3.2',
},
- 'notify::notify.critical' => {
- descr => 'list of addresses to notify when down/critical',
- attrs => ['config', 'inherit'],
- html => 'notif',
- versn => '3.6',
- },
- 'notify::notify.major' => {
- descr => 'list of addresses to notify when down/major',
- attrs => ['config', 'inherit'],
- html => 'notif',
- versn => '3.6',
- },
- 'notify::notify.minor' => {
- descr => 'list of addresses to notify when down/minor',
- attrs => ['config', 'inherit'],
- html => 'notif',
- versn => '3.6',
- },
- 'notify::notify.warning' => {
- descr => 'list of addresses to notify when down/warning',
+ 'notify::notify.clear' => { # == notifyup
+ descr => 'list of addresses to notify when up',
attrs => ['config', 'inherit'],
html => 'notif',
versn => '3.6',
@@ -371,6 +365,13 @@
versn => '3.5',
html => 'notif',
},
+ notify::unack_timeout => {
+ descr => 'automatically ack notification if it is up and this much time has passed',
+ attrs => ['config', 'inherit', 'timespec'],
+ default => 3600,
+ versn => '3.6',
+ html => 'notif',
+ },
notify::autoack => {
descr => 'do notifications not require ack',
attrs => ['config', 'inherit', 'bool'],
@@ -383,8 +384,21 @@
default => 'no',
versn => '3.2',
},
+ notify::ack_on_better => {
+ descr => 'automatically ack notifications when severity level improves',
+ attrs => ['config', 'inherit', 'bool'],
+ versn => '3.6',
+ html => 'notif',
+ },
+ notify::ack_on_worse => {
+ descr => 'automatically ack notifications when severity level worsens',
+ attrs => ['config', 'inherit', 'bool'],
+ versn => '3.6',
+ html => 'notif',
+ },
+
notify::escalate => {
- descr => 'list of times (in minutes or as a timespec) and addresses for notification escalation: time method:address ...; time method:address ...',
+ descr => 'list of times (in minutes or as a timespec) and addresses for notification escalation',
attrs => ['config', 'inherit'],
exmpl => '30 qpage:manager qpage:noc; 60 qpage:ceo',
versn => '3.5',
@@ -926,6 +940,20 @@
},
};
+# 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){
+ # none of these are applicable for 'up/clear'
+ my %d = %{ $doc->{fields}{"notify::$nt"} };
+ $d{versn} = '3.6';
+ $d{descr} .= " when down/$sev";
+ delete $d{default};
+ $doc->{fields}{"notify::$nt.$sev"} = \%d;
+ }
+}
+delete $doc->{fields}{'notify::ack_on_worse.critical'};
+
+
# what is my name?
sub unique {
my $me = shift;
@@ -1008,13 +1036,28 @@
$me->{alarm} = 0;
$me->{transtime} = $^T;
$me->{sirentime} = $^T;
-
- $me->{notify}{messageup} = ($me->{notify}{shortmessages} ?
- $me->{uname} : $me->unique()) . ' is UP'
- unless defined $me->{notify}{messageup};
- $me->{notify}{messagedn} = ($me->{notify}{shortmessages} ?
- $me->{uname} : $me->unique()) . ' is DOWN'
- unless defined $me->{notify}{messagedn};
+ $me->{friendlyname} ||= $me->{uname};
+
+ # if messages are not specified, pick defaults based on style preference
+ my $msgstyle = $me->{notify}{message_style};
+ unless( defined $me->{notify}{messageup} ){
+ if( $msgstyle eq 'long' ){
+ $me->{notify}{messageup} = '%o{unique} is %s';
+ }elsif( $msgstyle eq 'short' ){
+ $me->{notify}{messageup} = '%o{uname} is %s';
+ }else{
+ $me->{notify}{messageup} = $me->friendly_messageup() || '%o{friendlyname} is %s';
+ }
+ }
+ unless( defined $me->{notify}{messagedn} ){
+ if( $msgstyle eq 'long' ){
+ $me->{notify}{messagedn} = '%o{unique} is %s/%y';
+ }elsif( $msgstyle eq 'short' ){
+ $me->{notify}{messagedn} = '%o{uname} is %s';
+ }else{
+ $me->{notify}{messagedn} = $me->friendly_messagedn() || '%o{friendlyname} is %s/%y';
+ }
+ }
$me->{image}{title} = $me->{label_right}
unless defined $me->{image}{title};
@@ -1055,6 +1098,12 @@
1;
}
+
+# overridden in subclasses
+sub friendly_messageup {}
+sub friendly_messagedn {}
+
+
END {
deconfigure();
}
@@ -1147,6 +1196,7 @@
foreach my $c ( @{$me->{children}} ){
my $cc = $c;
$cc = $c->aliaslookup() if $c->can('aliaslookup');
+ next unless $cc; # skip broken alias
if( $cc->{children} && @{$cc->{children}} ){
$cc->jiggle_lightly();
@@ -1927,7 +1977,9 @@
}
foreach my $x (@all){
next unless $x->isa('Service');
+ next if exists $x->{compute};
$n++;
+ next if $x->{srvc}{state} && $x->{srvc}{state} ne 'done';
next if $sc{ $x->unique() };
$ctl->write( $x->unique() . "\n" );
}
diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Notify.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Notify.pm
--- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Notify.pm 2007-12-31 17:20:34.000000000 -0500
+++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Notify.pm 2008-02-03 00:37:08.000000000 -0500
@@ -5,7 +5,7 @@
# Date: 2002-Apr-12 20:06 (EDT)
# Function: Tell someone what happened
#
-# $Id: Notify.pm,v 1.69 2007/12/31 22:20:34 jaw Exp $
+# $Id: Notify.pm,v 1.72 2008/02/03 05:37:08 jaw Exp $
package Notify;
use NotMe;
@@ -26,9 +26,6 @@
# can be overridden in user-defined notification methods via 'qtime: 1234'
my $QUEUETIME = 120;
-# we keep re-sending, but if it comes up, give up after this long
-my $UNACK_TO = 1800;
-
# if older than this, and no longer active, throw them away
my $OLD_AGE = 3600 * 24 * 5;
@@ -38,7 +35,8 @@
# fields which get saved in save file (and then re-loaded)
my @SAVE_FIELDS = qw(created msg sentcnt state objstate objovstate
priority autoack ackonup period ackedby ackedat
- escalated lastsent audit detail severity reason);
+ escalated lastsent audit detail severity reason
+ ackonbetter ackonworse);
sub new {
my $obj = shift;
@@ -51,7 +49,7 @@
if( $obj->{status} eq 'down' ){
$msg = $obj->{notify}{messagedn};
$fmt = $obj->{notify}{message_fmtdn};
- $aa = $obj->{notify}{autoack};
+ $aa = value_at_severity('autoack', $obj);
}else{
$msg = $obj->{notify}{messageup};
$fmt = $obj->{notify}{message_fmtup};
@@ -70,25 +68,27 @@
return unless $msg;
$me = {
- obj => $obj,
- created => $^T,
- idno => newid(),
- sentcnt => 0,
- escalated => 0,
- state => 'active', # active, supressed, acked
- objstate => $obj->{status},
- objovstate => $obj->{ovstatus},
- priority => $obj->{notify}{priority},
- autoack => $aa,
- period => $obj->{notify}{renotify},
- ackonup => $obj->{notify}{ackonup},
- status => {},
- sendto => [],
- log => [],
- audit => $param{audit}, # bool
- detail => $param{detail},
- severity => $obj->{currseverity},
- reason => $obj->{srvc}{reason},
+ obj => $obj,
+ created => $^T,
+ idno => newid(),
+ sentcnt => 0,
+ escalated => 0,
+ state => 'active', # active, supressed, acked
+ objstate => $obj->{status},
+ objovstate => $obj->{ovstatus},
+ priority => value_at_severity('priority', $obj),
+ autoack => $aa,
+ period => value_at_severity('renotify', $obj),
+ ackonup => value_at_severity('ackonup', $obj),
+ ackonbetter => value_at_severity('ack_on_better', $obj),
+ ackonworse => value_at_severity('ack_on_worse', $obj),
+ status => {},
+ sendto => [],
+ log => [],
+ audit => $param{audit}, # bool
+ detail => $param{detail},
+ severity => $obj->{currseverity},
+ reason => $obj->{srvc}{reason},
};
bless $me; # gesundheit
@@ -104,6 +104,20 @@
$me->notify();
}
+
+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}
+}
+
sub init {
my $me = shift;
my $obj = shift;
@@ -158,8 +172,9 @@
# -- proverbs 13:17
{
my $n = 1;
- if( $obj->{notify}{escalate} ){
- foreach my $esc ( split /\;\s+/, $obj->{notify}{escalate} ){
+ my $esc = value_at_severity('escalate', $obj, $me->{severity});
+ if( $esc ){
+ foreach my $esc ( split /\;\s+/, $esc ){
# each is of form N dest dest dest ...
# previously, N was number of pages to escalate
# then, it was elapsed-time in minutes
@@ -195,6 +210,7 @@
$me->{acl_ntfydetail} = $obj->{acl_ntfydetail};
$me->{timezone} = $obj->{notify}{timezone};
$me->{mailfrom} = $obj->{notify}{mail_from};
+ $me->{unack_to} = $obj->{notify}{unack_timeout};
1;
}
@@ -486,15 +502,27 @@
next;
}
# auto-ack if no longer down and TO
- if( $p->{obj}->{status} ne 'down' && $^T - $p->{obj}->{transtime} > $UNACK_TO ){
+ if( $p->{obj}->{status} ne 'down' && $p->{unack_to} && $^T - $p->{obj}->{transtime} > $p->{unack_to} ){
$p->ack('timeout');
next;
}
# auto-ack if not down and ackonup is set
if( $p->{objstate} eq 'down' && $p->{obj}->{status} ne 'down' && $p->{ackonup} ){
- $p->ack('up');
+ $p->ack('ackonup');
+ }
+ # auto-ack on severity changes
+ if( $p->{severity} ne $p->{obj}->{currseverity} ){
+ my $old = $MonEl::severity_sort{ $p->{severity} };
+ my $new = $MonEl::severity_sort{ $p->{obj}->{currseverity} };
+
+ if( $old > $new && $p->{ackonbetter} ){
+ $p->ack('ack_on_better');
+ }
+ if( $old < $new && $p->{ackonworse} ){
+ # hopefully, the user has configured a new notification at this severity
+ $p->ack('ack_on_worse');
+ }
}
-
if( $p->{period} && ($p->{lastsent} + $p->{period} <= $^T) ){
# time to resend
$p->renotify();
@@ -603,7 +631,15 @@
if( $nolots ){
# list all messages, don't summarize into Lots UP/DOWN
- $msg = join("\n", map { $_->{msg} } @more);
+
+ my $j;
+ if( grep { /\n/s } $msg, @more ){
+ $j = "\n\n";
+ }else{
+ $j = "\n";
+ }
+
+ $msg = join($j, map { $_->{msg} } $msg, @more);
}
}else{
@@ -644,6 +680,15 @@
# interpolate message 1st, it may contain additional % sequences...
$fmt =~ s/%m/$msg/g;
+ # pretify value
+ my $v = $obj->{srvc} ? $obj->{srvc}{result} : undef;
+ if( length($v) > 40 ){
+ $v = substr($v,0,40);
+ $v .= ' [...]';
+ }
+ $v =~ s/\r/\\r/gs;
+ $v =~ s/\n/\\n/gs;
+
my $res = $obj->expand($fmt,
localtime => 1,
dtformat => "%d/%b %R", # dd/Mon hh:mm
@@ -653,6 +698,7 @@
o => $obj->{uname},
p => $me->{priority},
s => uc($me->{objstate}),
+ v => $v,
y => $me->{severity},
},
);
@@ -713,40 +759,48 @@
sub cmd_detail {
my $ctl = shift;
my $param = shift;
- my( $p, $k, $v, $ww, $n );
- $p = $param->{idno};
- if( exists $byid{$p} ){
- $p = $byid{$p};
- $ctl->ok();
- foreach $k (sort keys %$p){
- $v = $p->{$k};
- if( ref($v) ){
- $v = "#[";
- }else{
- $v = encode( $v );
- }
- $ctl->write( "$k:\t$v\n" );
+ my $idno = $param->{idno};
+ unless( exists $byid{$idno} ){
+ $ctl->bummer(404, 'Notification Not Found');
+ return;
+ }
+
+ my $p = $byid{$idno};
+ $ctl->ok();
+ foreach my $k (sort keys %$p){
+ my $v = $p->{$k};
+ if( ref($v) ){
+ $v = "#][";
+ }else{
+ $v = encode( $v );
}
- $ctl->write( "object: " . encode( $p->{obj}->unique() ) . "\n" );
+ $ctl->write( "$k:\t$v\n" );
+ }
+ $ctl->write( "object: " . encode( $p->{obj}->unique() ) . "\n" );
+
+ for my $e qw(style_sheet javascript bkgimage icon icon_up icon_down){
+ my $v = $p->{obj}->{web}{$e};
+ next unless $v;
+ $ctl->write("web $e: " . encode($v) . "\n");
+ }
- foreach my $w (sort keys %{$p->{status}}){
- my $we = encode($w);
- $ww .= " $we";
- $ctl->write("status $we: " . $p->{status}{$w} . "\n" );
- }
- $ctl->write("statuswho: $ww\n");
- $n = 0;
- foreach my $l (@{$p->{log}}){
- $ctl->write( "log $n: $l->{time} " . ($l->{who}? encode($l->{who}) : '_') .
- ' ' . encode($l->{msg}) . "\n" );
- $n++;
- }
- $ctl->write( "loglines: $n\n");
- $ctl->final();
- }else{
- $ctl->bummer(404, 'Notification Not Found');
+ my $ww;
+ foreach my $w (sort keys %{$p->{status}}){
+ my $we = encode($w);
+ $ww .= " $we";
+ $ctl->write("status $we: " . $p->{status}{$w} . "\n" );
+ }
+ $ctl->write("statuswho: $ww\n");
+
+ my $n = 0;
+ foreach my $l (@{$p->{log}}){
+ $ctl->write( "log $n: $l->{time} " . ($l->{who}? encode($l->{who}) : '_') .
+ ' ' . encode($l->{msg}) . "\n" );
+ $n++;
}
+ $ctl->write( "loglines: $n\n");
+ $ctl->final();
}
sub cmd_ack {
diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Ping.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Ping.pm
--- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Ping.pm 2007-03-04 10:51:49.000000000 -0500
+++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Ping.pm 2008-02-02 22:00:43.000000000 -0500
@@ -5,7 +5,7 @@
# Date: 2002-Apr-03 23:24 (EST)
# Function: ping service test
#
-# $Id: Ping.pm,v 1.51 2007/03/04 15:51:49 jaw Exp $
+# $Id: Ping.pm,v 1.52 2008/02/03 03:00:43 jaw Exp $
package Ping;
@ISA = qw(Service);
@@ -374,6 +374,7 @@
$x->isup();
}
}else{
+ s/$ip\s+//;
$x->isdown( $_ );
}
}
@@ -406,6 +407,16 @@
$pending[$fn] = undef;
}
+sub friendly_messagesup {
+ my $me = shift;
+ '%o{ping::hostname} is UP (pingable)';
+}
+sub friendly_messagesdn {
+ my $me = shift;
+
+ '%o{ping::hostname} is %s/%y (NOT PINGABLE)';
+}
+
sub about_more {
my $me = shift;
my $ctl = shift;
diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Prog.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Prog.pm
--- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Prog.pm 2007-09-01 12:51:38.000000000 -0400
+++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Prog.pm 2008-02-02 22:00:43.000000000 -0500
@@ -5,7 +5,7 @@
# Date: 2002-Apr-03 19:27 (EST)
# Function: test exececution of a program
#
-# $Id: Prog.pm,v 1.40 2007/09/01 16:51:38 jaw Exp $
+# $Id: Prog.pm,v 1.41 2008/02/03 03:00:43 jaw Exp $
package Prog;
@ISA = qw(Service);
@@ -146,6 +146,7 @@
# fork failed
my $m = "fork failed: $!";
close W;
+ close $fh;
::sysproblem( "PROG $m" );
$me->debug( $m );
return $me->done();
diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Resolv.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Resolv.pm
--- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Resolv.pm 2007-09-01 12:51:38.000000000 -0400
+++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Resolv.pm 2008-02-02 22:00:44.000000000 -0500
@@ -5,7 +5,7 @@
# Date: 2003-May-22 21:46 (EDT)
# Function: caching async resolver + re-resolver
#
-# $Id: Resolv.pm,v 1.23 2007/09/01 16:51:38 jaw Exp $
+# $Id: Resolv.pm,v 1.24 2008/02/03 03:00:44 jaw Exp $
# Wise to resolve, and patient to perform.
# -- Homer, Odyssey
@@ -41,7 +41,7 @@
isa => [qw(Service MonEl BaseIO)],
methods => {},
versn => '3.4',
- html => 'resolv',
+ html => 'advanced',
fields => {
resolv::conf => {
descr => 'location of resolv.conf',
diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Service.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Service.pm
--- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Service.pm 2007-12-30 20:50:37.000000000 -0500
+++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Service.pm 2008-02-02 22:00:44.000000000 -0500
@@ -5,7 +5,7 @@
# Date: 2002-Apr-03 08:56 (EST)
# Function: the service class
#
-# $Id: Service.pm,v 1.113 2007/12/31 01:50:37 jaw Exp $
+# $Id: Service.pm,v 1.114 2008/02/03 03:00:44 jaw Exp $
package Service;
@ISA = qw(MonEl BaseIO);
@@ -410,6 +410,8 @@
sub me_start {
my $me = shift;
+ # is checknow running?
+ return if $me->{srvc}{state} && $me->{srvc}{state} ne 'done';
$me->pre_start_check();
}
diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/TCP.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/TCP.pm
--- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/TCP.pm 2007-03-18 16:43:14.000000000 -0400
+++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/TCP.pm 2008-02-02 22:00:44.000000000 -0500
@@ -5,7 +5,7 @@
# Date: 2002-Apr-03 15:59 (EST)
# Function: testing of TCP services
#
-# $Id: TCP.pm,v 1.76 2007/03/18 20:43:14 jaw Exp $
+# $Id: TCP.pm,v 1.77 2008/02/03 03:00:44 jaw Exp $
package TCP;
@@ -227,7 +227,6 @@
$me->{tcp}{port} ||= $config{$name}{port};
$me->{tcp}{send} ||= $config{$name}{send};
- $me->{test}{expect} ||= $config{$name}{expect};
$me->{tcp}{readhow} ||= $config{$name}{readhow};
$me->{tcp}{ssl} ||= $config{$name}{ssl};
@@ -235,6 +234,11 @@
$me->Argus::IP::init( $cf );
$me->init_from_config( $cf, $doc, 'tcp' );
+
+ 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};
+ }
if( $name =~ /^(HTTP|HTTPS|SSL)$/ ){
my $http = http_request($me);
@@ -245,7 +249,7 @@
$me->{tcp}{ssl} = $me->{tcp}{url} =~ /https:/ ? 1 : undef;
$me->{tcp}{port} = $port ||= ($me->{tcp}{ssl} ? 443 : 80);
$file ||= '/';
- $me->{ip}{hostname} = $host;
+ $me->{ip}{hostname} ||= $host;
$me->{uname} = "URL_$host:$port$file";
unless( $host ){
return $cf->error( 'invalid URL' );
@@ -268,10 +272,13 @@
$me->Argus::IP::config( $cf );
+ $me->{friendlyname} = ($config{$name} ? $name : "TCP/$me->{udp}{port}") . " on $me->{ip}{hostname}";
+
if( $name eq 'URL' ){
- # nop
+ $me->{friendlyname} = "URL $me->{tcp}{url}";
}elsif( $name =~ /NFS/ ){
$me->{uname} = "TCP_${name}_$me->{ip}{hostname}";
+ $me->{friendlyname} = "TCP/$name on $me->{ip}{hostname}";
}else{
if( $name ){
$me->{uname} = "${name}_$me->{ip}{hostname}";
diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/UDP.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/UDP.pm
--- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/UDP.pm 2007-06-30 14:38:44.000000000 -0400
+++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/UDP.pm 2008-02-02 22:00:45.000000000 -0500
@@ -5,7 +5,7 @@
# Date: 2002-Apr-03 18:25 (EST)
# Function: testing of UDP services
#
-# $Id: UDP.pm,v 1.68 2007/06/30 18:38:44 jaw Exp $
+# $Id: UDP.pm,v 1.69 2008/02/03 03:00:45 jaw Exp $
package UDP;
@@ -158,6 +158,8 @@
$me->Argus::IP::config( $cf );
$me->init_from_config( $cf, $doc, 'udp' );
+ $me->{friendlyname} = ($config{$base} ? $base : "UDP/$me->{udp}{port}") . " on $me->{ip}{hostname}";
+
if( $name ){
$me->{uname} = "${name}_$me->{ip}{hostname}";
}else{
diff -ruBNx HTML /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Web.pm /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Web.pm
--- /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20071231/src/Web.pm 2007-12-31 17:20:34.000000000 -0500
+++ /home/hostedsites/www.jeremykister.com/data/argus/argus-dev-20080202/src/Web.pm 2008-02-02 22:00:45.000000000 -0500
@@ -5,7 +5,7 @@
# Date: 2002-Apr-06 21:30 (EST)
# Function: web page stuff
#
-# $Id: Web.pm,v 1.65 2007/12/31 22:20:34 jaw Exp $
+# $Id: Web.pm,v 1.66 2008/02/03 03:00:45 jaw Exp $
package MonEl;
use strict;
@@ -53,11 +53,13 @@
}
sub web_header {
- my $me = shift;
- my $fh = shift;
-
- my $n = $me->unique();
- my $file = $me->filename();
+ my $me = shift;
+ my $fh = shift;
+ my $title = shift;
+ my $id = shift;
+
+ $title ||= $me->unique();
+ $id ||= $me->filename();
my $icon;
my $refresh = $me->{web}{refresh};
@@ -67,7 +69,7 @@
print $fh "\n";
print $fh "\n";
print $fh "\n";
- print $fh "Argus - $n\n";
+ print $fh "Argus - $title\n";
print $fh "\n" if $refresh;
if( $me->{ovstatus} eq 'up' ){
$icon = $me->{web}{icon_up};
@@ -85,7 +87,7 @@
for my $js ( split /\s+/, $me->{web}{javascript} ){
print $fh "\n";
}
- print $fh "\n";
+ print $fh "\n";
print $fh "]