Re: Monitor a wireless network

2006-03-11 Thread Jim Trocki

On Sat, 11 Mar 2006, Lee Sanders wrote:


Is that all there is to it, any hints/tips ?


very close.

the first line of output from the monitor script is the summary of all
the failures, usually a list of hosts from the hostgroup that failed,
or alternatively some text that would be suitable to be put into the
subject of an email, or something sent to an alphanumeric pager.

have a look at the slides from the mon talk for some examples:

ftp://ftp.kernel.org/pub/software/admin/mon/mon-talk-0.4.tar.gz

___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon


Re: Monitor a wireless network

2006-03-11 Thread Lee Sanders
Doesn't matter I worked it out.. I think.

Testing the attached now. If anyone wants to glance it over it feel free to 
give feedback. Please excuse my rusty Perl.

Regards,
Lee


#!/usr/bin/perl
#
# Scan wireless interfaces for available networks.
# Requires SSID broadcast is turned on in the AP
#
# Version 1.00 (10 March 2006)
#
# Copyright 2002, Lee Sanders [EMAIL PROTECTED]
#
# License: GNU GPL v2, see http://www.gnu.org/copyleft/gpl.html
#
# Some inspiration is taked from other mon monitors, specifically:
# bgp.monitor by Marc Hauswirth, Safe Host SA [EMAIL PROTECTED]
# fping.monitor by Jim Trocki, [EMAIL PROTECTED]


use strict;
use warnings;
use Getopt::Std;

my %opt;
getopts (h:s:T, \%opt);

sub usage
{
print EOF;
usage: scanwireless.monitor [-h] -s ssid interface ...

-h  Print this help page
-s ssid The SSID of the wireless network to search for

EOF

exit;
}

usage if ($opt{h});

my $network = $opt{s} || die SSID Not specified with -s ssid;
my $found=0;
my @scan;
my $line;

foreach my $interface (@ARGV) {
@scan = `iwlist $interface scan`;   # scan the wireless interface 
for networks

# Parse the scan for our network on the
for $line (@scan) {
if ($line =~ /^\s+ESSID:(.*)\s*$/) {
my $sid = $1;
if ($sid eq $network) {
   $found=1;
}
}
}

}
if ($#ARGV = 0) {
if (!$found) {
print -  Scan for SSID $network  
---\n;
print @scan\n;
print 
--\n;
exit 1;
}
} 


exit 0;
##


On Sat, 11 Mar 2006 10:44 pm, Jim Trocki wrote:
 On Sat, 11 Mar 2006, Lee Sanders wrote:
  Is that all there is to it, any hints/tips ?

 very close.

 the first line of output from the monitor script is the summary of all
 the failures, usually a list of hosts from the hostgroup that failed,
 or alternatively some text that would be suitable to be put into the
 subject of an email, or something sent to an alphanumeric pager.

 have a look at the slides from the mon talk for some examples:

 ftp://ftp.kernel.org/pub/software/admin/mon/mon-talk-0.4.tar.gz

___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon