[c-nsp] Standalone Web Site/Web Page Monitoring Device (SNMP
Capable)
Adam Maloney
adam at whee.org
Mon May 16 08:28:36 EDT 2005
On Sun, 15 May 2005, William Chu wrote:
> What I am looking for is a standalone device (e.g.
> like an appliance) that can be deployed at a remote
> location to monitor specific web sites and/or web
> pages. If the monitored web site/page becomes
> unavailable the device would then generate a SNMP trap
> to a network management station to alert the
> operators.
This shouldn't be terribly difficult to write in Perl using the SNMP and
HTTP modules from CPAN. (Forgive my perl, this is from the hip, and it
may suck)
open(URLS, "<urls.txt");
while (@allurls = push(chomp(<URLS>)));
close(URLS);
while (1) {
foreach $url (@allurls) {
http_get($url) || snmp_trap($url);
}
sleep 300;
}
There, now just read:
http://www.cpan.org/modules/by-module/SNMP/SNMP-4.2.0.readme
to construct the SNMP trap, and read the libwww-perl documentation on how
to perform the HTTP GET. Easy-peasy.
More information about the cisco-nsp
mailing list