Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Directory
dbunduki
bydbunduki, July 22, 2011
1 of 1 people found this review helpful
#!/usr/bin/perl -w
my $host = $ARGV[0];
my $port = $ARGV[1];
my $sid = $ARGV[2];
my $user = $ARGV[3];
my $pass = $ARGV[4];
### point this to your sqlplus binary
my $sqlplus = "/usr/local/src/instantclient_11_2/sqlplus";
### point this to your sqlplus directory
$ENV{"LD_LIBRARY_PATH"} = "/usr/local/src/instantclient_11_2/";
sub trim($);
my @result;
my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2);
my @param_array = (
[90,">","Dictionary Cache Hit Ratio",'SELECT (1 - (Sum(getmisses)/(Sum(gets) + Sum(getmisses)))) * 100 FROM v\$rowcache;'],
[99,">","Library Cache Hit Ratio",'SELECT (1 -(Sum(reloads)/(Sum(pins) + Sum(reloads)))) * 100 FROM v\$librarycache;'],
[89,">","DB Block Buffer Cache Hit Ratio",'SELECT (1 - (phys.value / (db.value + cons.value))) * 100 FROM v\$sysstat phys,v\$sysstat db,v\$sysstat cons WHERE phys.name = \'physical reads\' AND db.name = \'db block gets\' AND cons.name = \'consistent gets\';'],
[98,">","Latch Hit Ratio",'SELECT (1 - (Sum(misses) / Sum(gets))) * 100 FROM v\$latch;'],
[5,"\)\)\)\" |");
while ( my $res = ) {
if ($res =~ /^(ORA-\d{5})/) {
return $1;
}
}
}
if (logon() eq "ORA-01017" ){
for (my $i=0; $iumformat 999.999
$param_array[$i][3]
exit
EOF |") or die;
while ( my $res = ) {
#print trim($res)."\n";
if ( $res =~/^\s*\S+/ ) {
push(@results,trim($res));
}
}
}
for (my $i=0; $is OK";
exit $ERRORS{"OK"};
} else {
print "Unable to connect to $sid database!";
exit $ERRORS{"CRITICAL"};
}
my $host = $ARGV[0];
my $port = $ARGV[1];
my $sid = $ARGV[2];
my $user = $ARGV[3];
my $pass = $ARGV[4];
### point this to your sqlplus binary
my $sqlplus = "/usr/local/src/instantclient_11_2/sqlplus";
### point this to your sqlplus directory
$ENV{"LD_LIBRARY_PATH"} = "/usr/local/src/instantclient_11_2/";
sub trim($);
my @result;
my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2);
my @param_array = (
[90,">","Dictionary Cache Hit Ratio",'SELECT (1 - (Sum(getmisses)/(Sum(gets) + Sum(getmisses)))) * 100 FROM v\$rowcache;'],
[99,">","Library Cache Hit Ratio",'SELECT (1 -(Sum(reloads)/(Sum(pins) + Sum(reloads)))) * 100 FROM v\$librarycache;'],
[89,">","DB Block Buffer Cache Hit Ratio",'SELECT (1 - (phys.value / (db.value + cons.value))) * 100 FROM v\$sysstat phys,v\$sysstat db,v\$sysstat cons WHERE phys.name = \'physical reads\' AND db.name = \'db block gets\' AND cons.name = \'consistent gets\';'],
[98,">","Latch Hit Ratio",'SELECT (1 - (Sum(misses) / Sum(gets))) * 100 FROM v\$latch;'],
[5,"\)\)\)\" |");
while ( my $res = ) {
if ($res =~ /^(ORA-\d{5})/) {
return $1;
}
}
}
if (logon() eq "ORA-01017" ){
for (my $i=0; $iumformat 999.999
$param_array[$i][3]
exit
EOF |") or die;
while ( my $res = ) {
#print trim($res)."\n";
if ( $res =~/^\s*\S+/ ) {
push(@results,trim($res));
}
}
}
for (my $i=0; $is OK";
exit $ERRORS{"OK"};
} else {
print "Unable to connect to $sid database!";
exit $ERRORS{"CRITICAL"};
}