cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 11

Oracle Instance Monitoring

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.

0 Kudos
4 Replies
Level 9

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:

https://support.solarwinds.com/SuccessCenter/s/article/Configure-SAM-to-monitor-an-Oracle-Database-S...

0 Kudos

SAM is the only way to go and works great for Oracle.

0 Kudos
Level 11

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"};
}

0 Kudos
Level 11

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"};
}

0 Kudos