Hello,
I'm being asked to monitor an Oracle instance running on a Linux server. They want to be alerted when it goes down. I do not have DPA, I wish I did, but we're cheap 🐣. I don't know much about Oracle and so I'm reaching out to my SolarWinds brothers and sisters to see what you are doing. Are you using a template or did you script something out. Anything guidance will be very helpful. Thank you all in advance.
We are using the out of the box templates for Oracle.
You just need to install the Oracle drivers on the main solarwinds application server which you can get from the portal and make sure that you have the connection details and it can run oracle queries against that oracle db.
You can then create an alert which says if that Application Template is Down or Unknown to alert which i think would capture that.
i think the below url might help explain most of the above:
SAM is the only way to go and works great for Oracle.
I used this script:
#! /usr/bin/perl -w
use strict;
use DBI;
use Getopt::Std;
my %options=();
getopts("n:", \%options);
# test for the existence of the options on the command line.
# in a normal program you'd do more than just print these.
my $server_name=$options{n};
my @row ;
my $tnsname="(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = IPADDRESS)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = $server_name)))";
my $username="monitor_user";
my $password="password";
my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2);
my $result="";
my $flag="0";
my $dbh=DBI->connect("dbi:Oracle:$tnsname", $username, $password) or die "Cannot conenct db: $DBI::errstr\n";
#print "I have connected to the Oracle database!\n";
my $sth=$dbh->prepare("select inst_id,active_state from gv\$instance" );
$sth->execute();
while (@row = $sth->fetchrow_array()) {
my $inst_id=$row[0];
my $active_state=$row[1];
if($active_state ne "NORMAL"){
$result=$result." ".$inst_id.":".$active_state;
$flag="2";
}else{
$result=$result." ".$inst_id.":".$active_state;
}
}
$dbh->disconnect or warn "DB disconnect failed: $DBI::errstr\n";
#print "Disconnected from Oracle databae!\n";
if($flag eq "0"){
print "OK $result";
# $result="OK\n";
# print "$result";
exit $ERRORS{"OK"};
}else{
print "$result";
exit $ERRORS{"CRITICAL"};
}
I'm using this script:
#! /usr/bin/perl -w
use strict;
use DBI;
use Getopt::Std;
my %options=();
getopts("n:", \%options);
# test for the existence of the options on the command line.
# in a normal program you'd do more than just print these.
my $server_name=$options{n};
my @row ;
my $tnsname="(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = IPADDRESS)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = $server_name)))";
my $username="monitor_user";
my $password="password";
my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2);
my $result="";
my $flag="0";
my $dbh=DBI->connect("dbi:Oracle:$tnsname", $username, $password) or die "Cannot conenct db: $DBI::errstr\n";
#print "I have connected to the Oracle database!\n";
my $sth=$dbh->prepare("select inst_id,active_state from gv\$instance" );
$sth->execute();
while (@row = $sth->fetchrow_array()) {
my $inst_id=$row[0];
my $active_state=$row[1];
if($active_state ne "NORMAL"){
$result=$result." ".$inst_id.":".$active_state;
$flag="2";
}else{
$result=$result." ".$inst_id.":".$active_state;
}
}
$dbh->disconnect or warn "DB disconnect failed: $DBI::errstr\n";
#print "Disconnected from Oracle databae!\n";
if($flag eq "0"){
print "OK $result";
# $result="OK\n";
# print "$result";
exit $ERRORS{"OK"};
}else{
print "$result";
exit $ERRORS{"CRITICAL"};
}
SolarWinds solutions are rooted in our deep connection to our user base in the THWACK® online community. More than 150,000 members are here to solve problems, share technology and best practices, and directly contribute to our product development process.