Home Directory

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

Directory

bangers

Reviews(1)
bybangers, October 30, 2014
This plugin is very good in the way that you don't need the Oracle client. I did change the script to suit my needs: split the checks, add perfdata and variable thresholds.


$host = $ARGV[0];
$port = $ARGV[1];
$sid = $ARGV[2];
$user = $ARGV[3];
$pass = $ARGV[4];
$check = $ARGV[5];
$thresholdw = $ARGV[6];
$thresholdc = $ARGV[7];

$ENV{LD_LIBRARY_PATH} = "/etc/oracle";
$sqlplus = '/etc/oracle/sqlplus';

sub trim($);
my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3);

my %checks = (
'dictionary' => 0,
'library' => 1,
'blockbuffer' => 2,
'latch' => 3,
'disk' => 4,
'rollback' => 5,
'dispatcher' => 6,
);

my @param_array = (
[">","Dictionary Cache Hit Ratio",'SELECT (1 - (Sum(getmisses)/(Sum(gets) + Sum(getmisses)))) * 100 FROM v\$rowcache;'],
[">","Library Cache Hit Ratio",'SELECT (1 -(Sum(reloads)/(Sum(pins) + Sum(reloads)))) * 100 FROM v\$librarycache;'],
[">","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\';'],
[">","Latch Hit Ratio",'SELECT (1 - (Sum(misses) / Sum(gets))) * 100 FROM v\$latch;'],
[" "unless (".$results.$param_array[$checks{$check}][0].$thresholdw.") {print\"".$param_array[$checks{$check}][1]." on ".$sid." is WARNING ($results !$param_array[$checks{$check}][0] $thresholdw)\\n| $perfcounter\"; exit ".$ERRORS{"WARNING"}.";}";

print "$param_array[$checks{$check}][1] on $sid is OK ($results $param_array[$checks{$check}][0] $thresholdw)|$perfcounter";
exit $ERRORS{"OK"};

} else {print "Bad check - values are: dictionary,library,blockbuffer,latch,disk,rollback,dispatcher\n "; exit $ERRORS{"UNKNOWN"};}