Build precise queries to find exactly what you need
Press ESC to close
#!/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”}; }
We’ve completely redesigned the world’s largest repository of Nagios plugins and monitoring tools. Join thousands of users sharing monitoring solutions for servers, applications, and everything in between.
Due to our redesign, all existing accounts require a password reset to access your account again.
Ready to explore 6,100+ projects and contribute to the community?
Reset Password Create Account
Happy Monitoring!