I have need to check an oracle component called web cache. I was given a perl script from the company who had all of this set up, but i dont think they understand what the APM is actually doing so I am not sure the script will work to check this. This is what I was given to use in a linux/unix script monitor:
#!/usr/bin/perl
#-----------------------------------------
# checkWebCache.pl - LWP monitor
#-----------------------------------------
# include libraries use 5.6.0;
use warnings;
use strict;
use LWP::UserAgent;
use HTTP::Request::Common;
use Net::SMTP;
# set up variables
my ($server_url);
my ($ua, $result);
my ($content);
# set environment
$server_url = "">servername:7779/_oracle_http_server_webcache_static_.html";
print "monitoring ..\n";
# check the URL
#use LWP::Simple;
my $browser = LWP::UserAgent->new;
my $response = $browser->get($server_url);
print "monitoring .. $response\n";
if($response->is_success)
{
use LWP::Simple;
$content = get $server_url;
#die "Couldn't get $server_url" unless defined $content;
#print "$content \n";
# was the check successful?
# if so, write the current time to the uptime log
if($content =~ m/OracleAS Web Cache is up/i)
{
#print "$content \n";
my $time1 = localtime;
open (LOG, '>>/tmp/server-monitor.log');
print "$time1 - 200 - $server_url\n";
#page_failed(200, $server_url);
close LOG;
}
# if not, e-mail a notification and log the failure
else
{
my $time1 = localtime;
print "WebCache not responding .. $time1 - 404 - $server_url\n";
# call the page fail subroutine with the result code
}
}
else
{
my $time1 = localtime;
print "WebCache not responding .. $time1 - 404 - $server_url\n";
}
exit 0;
I am not a perl or oracle person so trying to get this time work is a bit over my head. anyone have any ideas?