montrap, a command line client

2002-06-08 Thread Ed Ravin

I suspect I'm not the first to write something like this, but I don't
recall anyone posting it to the mon list.  This is a simple command
line client for sending mon traps.

  montrap [-p port] [-r retval] -o opstatus -s summary [-d detail]
  host group:service

  host - Mon host to send trap to
  opstatus - one of "fail", "ok", "coldstart", "warmstart", etc.

The original plan was to have a Mon watch for every critical
cron job, have those critical cron jobs run montrap at the end
of every successful run to indicate that they were OK, and have
Mon page if the trap isn't received in the specified interval.
I haven't put this together yet, but I'm sure someone can think
of other interesting uses for it.

Note that it doesn't support passwords - I'd rather run with
no password than specify it on the command line, but it's easy
enough to hard-code it or read from a file if someone wants.

-- Ed


#!/usr/bin/perl

use strict;
use Getopt::Std;
use Mon::Client;

my @opstrings= (
"fail", "ok", "coldstart", "warmstart", "linkdown",
"unknown", "timeout", "untested",
);

my $usage= "montrap [-p port] [-r retval] -o opstatus -s summary [-d detail] host 
group:service\n";

use vars qw($opt_p $opt_r $opt_o $opt_s $opt_d);
getopts("p:r:o:s:d:");


die $usage unless @ARGV == 2 and $ARGV[1] =~ /[^:]+:[^:]+/;

my $host= $ARGV[0];
my ($group, $service)= $ARGV[1] =~ /^([^:]+):([^:]+)/;

my $port= $opt_p || 2583;
my $retval= $opt_r || 255;
my $opstatus= $opt_o || die "montrap: '-o opstatus' required\n";

die "montrap: unrecognized opstatus: $opstatus\n" unless
grep $opstatus, @opstrings;


my $summary= $opt_s  || die "montrap: '-s summary' required\n";
my $detail= $opt_d || "";

my $mon;

if (!defined ($mon = Mon::Client->new)) {
die "$0: could not create client object: $@";
}
$mon->host($host);

$mon->send_trap(
group=> $group,
service=> $service,
retval=> $retval,
opstatus=> $opstatus,
summary=> $summary,
detail => $detail,
);




Re: Website browsing

2002-06-08 Thread David Amiel

It depends on the Website :
- for exemple to validate google.com is working you've to make a request et
get some answers
- To validate a website running a webmail, you've to log on the webmail and
send/receive a mail
etc etc

For all this wevsites verifying the web server is responding is not
sufficient because the application hosted relies on other applications
(databases, ldap ..)


- Original Message -
From: "Gilles Lamiral" <[EMAIL PROTECTED]>
To: "mon" <[EMAIL PROTECTED]>
Sent: Saturday, June 08, 2002 3:47 AM
Subject: Re: Website browsing


> David,
>
> > Though the http monitor script validate the web server is responding, it
> > can't validate the service hosted on this webserver is correctly running
..
>
> So what is a webserver correctly running ?
>
>
> --
> Au revoir,  33 (0) 2 99 78 62 49
> Gilles Lamiral. France, L'Hermitage (35590) 33 (0) 6 20 79 76 06




Re: Website browsing

2002-06-08 Thread Nate Campi

On Sat, Jun 08, 2002 at 03:47:20AM +0200, Gilles Lamiral wrote:
> David,
> 
> > Though the http monitor script validate the web server is responding, it
> > can't validate the service hosted on this webserver is correctly running ..
> 
> So what is a webserver correctly running ?

At my work there's a group (of mostly software engineers) that is trying
to figure out how to tell if a web site is "working" by adding junk to
the HTML. It is then up to a monitor to parse the HTML and look for
certain tags or send certain params with every request to get the added
junk (or maybe even get a cookie first that tells the web server to send
debug junk on each request), etc, etc.

Please don't start up on this here. 1% of the work will catch 99% of the
actual web site errors - using http.monitor with Mon. If you code custom
server and client code, you'll put in a huge amount of effort for a very
small gain. Perhaps your work wants this (banking app *has* to work
right, for example) and is paying you to do this, but for most people
it's overkill.

Just my $0.02.
-- 
"I have never seen anything fill up a vacuum so fast and still suck."
 - Rob Pike, commenting on the X Window System.