Changes of Revision 23
[-] | Changed | nagios-plugins-oracle.changes |
1
2 ------------------------------------------------------------------- 3 +Sat Feb 23 11:43:36 UTC 2013 - cs@linux-administrator.com 4 + 5 +- update to verson 1.7.7.3 6 + 7 +------------------------------------------------------------------- 8 Fri Sep 30 08:35:55 UTC 2011 - cs@linux-administrator.com 9 10 - update to version 1.7.3 11 |
||
[-] | Changed | nagios-plugins-oracle.spec ^ |
9 1
2 %define pkg_name check_oracle_health 3 Name: nagios-plugins-oracle 4 -Version: 1.7.3 5 +Version: 1.7.7.3 6 Release: 1 7 Summary: Oracle health check plugins for Nagios 8 Group: Applications/System 9 |
||
[+] | Changed | check_oracle_health-1.7.7.3.tar.bz2/ChangeLog ^ |
@@ -2,6 +2,37 @@ # Changelog of the check_oracle_health plugin # ############################################### +1.7.7.3 - 2013-02-21 +- bugfix in add_nagios, raising a deprecated-message in perl. (Thanks Philip Griesbacher) + +1.7.7.2 - 2013-01-22 +- optimized tablespace-can-allocate-next (Thanks Thomas Koerblein) + +1.7.7.1 - 2013-01-14 +- bugfix in sqlplus connect with a sys user + +1.7.7 - 2012-11-29 +- add parameter --mitigation and --notemp and --noreadonly + +1.7.6.1 - 2012-11-19 +- fix a bug with --extra-opts and --environ + +1.7.6 - 2012-11-10 +- implemented all sorts of thresholds (Thanks Simon Meggle) + +1.7.5.1 +- fix a bug in sga-library-cache-reloads (thresholds compared against pinhits) (Thanks claney) +- fix a bug in calcmeth which only is visible with --environ (Thanks Pullistricker) + +1.7.5 +- restrict rman problems to backup-operations (not list, report..) (Thanks marekel) + +1.7.4 - 2012-03-15 +- bugfix in timeout-alarm handling under windows (Thanks Marian Jamrich) +- bugfix in invalid-objects. No longer counts subpartitions (Thanks Teijo Lallukka) +- bugfix in session-usage (Thanks Bauchi) +- add mode sql-runtime + 1.7.3 - 2011 09-29 - mode sql now correctly handles dml sql errors like missing tables etc. - single ticks around the --name argument under Windows CMD will be removed automatically | ||
[+] | Changed | check_oracle_health-1.7.7.3.tar.bz2/configure ^ |
@@ -1,7 +1,7 @@ #! /bin/sh # From configure.in . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for check_oracle_health 1.7.3. +# Generated by GNU Autoconf 2.59 for check_oracle_health 1.7.7.3. # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation @@ -268,8 +268,8 @@ # Identity of this package. PACKAGE_NAME='check_oracle_health' PACKAGE_TARNAME='check_oracle_health' -PACKAGE_VERSION='1.7.3' -PACKAGE_STRING='check_oracle_health 1.7.3' +PACKAGE_VERSION='1.7.7.3' +PACKAGE_STRING='check_oracle_health 1.7.7.3' PACKAGE_BUGREPORT='' ac_default_prefix=/usr/local/nagios @@ -722,7 +722,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures check_oracle_health 1.7.3 to adapt to many kinds of systems. +\`configure' configures check_oracle_health 1.7.7.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -788,7 +788,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of check_oracle_health 1.7.3:";; + short | recursive ) echo "Configuration of check_oracle_health 1.7.7.3:";; esac cat <<\_ACEOF @@ -897,7 +897,7 @@ test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -check_oracle_health configure 1.7.3 +check_oracle_health configure 1.7.7.3 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -911,7 +911,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by check_oracle_health $as_me 1.7.3, which was +It was created by check_oracle_health $as_me 1.7.7.3, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1554,7 +1554,7 @@ # Define the identity of the package. PACKAGE='check_oracle_health' - VERSION='1.7.3' + VERSION='1.7.7.3' cat >>confdefs.h <<_ACEOF @@ -2725,7 +2725,7 @@ } >&5 cat >&5 <<_CSEOF -This file was extended by check_oracle_health $as_me 1.7.3, which was +This file was extended by check_oracle_health $as_me 1.7.7.3, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -2780,7 +2780,7 @@ cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -check_oracle_health config.status 1.7.3 +check_oracle_health config.status 1.7.7.3 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" | ||
[+] | Changed | check_oracle_health-1.7.7.3.tar.bz2/configure.in ^ |
@@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_REVISION ($Revision: 1.150 $) AC_PREREQ(2.58) -AC_INIT(check_oracle_health,1.7.3) +AC_INIT(check_oracle_health,1.7.7.3) AM_INIT_AUTOMAKE([1.9 tar-pax]) AC_CANONICAL_HOST | ||
[+] | Changed | check_oracle_health-1.7.7.3.tar.bz2/plugins-scripts/Makefile.am ^ |
@@ -20,6 +20,7 @@ Nagios/DBD/Oracle/Server/Instance/Enqueue.pm \ Nagios/DBD/Oracle/Server/Instance/Sysstat.pm \ Nagios/DBD/Oracle/Server/Instance.pm \ + Nagios/DBD/Oracle/Server/Database/User.pm \ Nagios/DBD/Oracle/Server/Database/FlashRecoveryArea.pm \ Nagios/DBD/Oracle/Server/Database/Tablespace/Datafile.pm \ Nagios/DBD/Oracle/Server/Database/Tablespace/Segment.pm \ | ||
[+] | Changed | check_oracle_health-1.7.7.3.tar.bz2/plugins-scripts/Makefile.in ^ |
@@ -147,6 +147,7 @@ Nagios/DBD/Oracle/Server/Instance/Enqueue.pm \ Nagios/DBD/Oracle/Server/Instance/Sysstat.pm \ Nagios/DBD/Oracle/Server/Instance.pm \ + Nagios/DBD/Oracle/Server/Database/User.pm \ Nagios/DBD/Oracle/Server/Database/FlashRecoveryArea.pm \ Nagios/DBD/Oracle/Server/Database/Tablespace/Datafile.pm \ Nagios/DBD/Oracle/Server/Database/Tablespace/Segment.pm \ | ||
[+] | Changed | check_oracle_health-1.7.7.3.tar.bz2/plugins-scripts/Nagios/DBD/Oracle/Server.pm ^ |
@@ -108,6 +108,12 @@ $self->{instance} = DBD::Oracle::Server::Instance->new(%params); } elsif ($params{mode} =~ /^server::database/) { $self->{database} = DBD::Oracle::Server::Database->new(%params); + } elsif ($params{mode} =~ /^server::sqlruntime/) { + $self->set_local_db_thresholds(%params); + my $tic = Time::HiRes::time(); + @{$self->{genericsql}} = + $self->{handle}->fetchrow_array($params{selectname}); + $self->{runtime} = Time::HiRes::time() - $tic; } elsif ($params{mode} =~ /^server::sql/) { $self->set_local_db_thresholds(%params); if ($params{regexp}) { @@ -214,6 +220,15 @@ $self->add_perfdata(sprintf "connection_time=%.4f;%d;%d", $self->{connection_time}, $self->{warningrange}, $self->{criticalrange}); + } elsif ($params{mode} =~ /^server::sqlruntime/) { + $self->add_nagios( + $self->check_thresholds($self->{runtime}, 1, 5), + sprintf "%.2f seconds to execute %s", + $self->{runtime}, + $params{name2} ? $params{name2} : $params{selectname}); + $self->add_perfdata(sprintf "sql_runtime=%.4f;%d;%d", + $self->{runtime}, + $self->{warningrange}, $self->{criticalrange}); } elsif ($params{mode} =~ /^server::sql/) { if ($params{regexp}) { if (substr($params{name2}, 0, 1) eq '!') { @@ -312,17 +327,47 @@ $self->{warningrange} : $defaultwarningrange; $self->{criticalrange} = defined $self->{criticalrange} ? $self->{criticalrange} : $defaultcriticalrange; - if ($self->{warningrange} !~ /:/ && $self->{criticalrange} !~ /:/) { - # warning = 10, critical = 20, warn if > 10, crit if > 20 - $level = $ERRORS{WARNING} if $value > $self->{warningrange}; - $level = $ERRORS{CRITICAL} if $value > $self->{criticalrange}; - } elsif ($self->{warningrange} =~ /(\d+):/ && - $self->{criticalrange} =~ /(\d+):/) { - # warning = 98:, critical = 95:, warn if < 98, crit if < 95 - $self->{warningrange} =~ /(\d+):/; - $level = $ERRORS{WARNING} if $value < $1; - $self->{criticalrange} =~ /(\d+):/; - $level = $ERRORS{CRITICAL} if $value < $1; + if ($self->{warningrange} =~ /^(\d+)$/) { + # warning = 10, warn if > 10 or < 0 + $level = $ERRORS{WARNING} + if ($value > $1 || $value < 0); + } elsif ($self->{warningrange} =~ /^(\d+):$/) { + # warning = 10:, warn if < 10 + $level = $ERRORS{WARNING} + if ($value < $1); + } elsif ($self->{warningrange} =~ /^~:(\d+)$/) { + # warning = ~:10, warn if > 10 + $level = $ERRORS{WARNING} + if ($value > $1); + } elsif ($self->{warningrange} =~ /^(\d+):(\d+)$/) { + # warning = 10:20, warn if < 10 or > 20 + $level = $ERRORS{WARNING} + if ($value < $1 || $value > $2); + } elsif ($self->{warningrange} =~ /^@(\d+):(\d+)$/) { + # warning = @10:20, warn if >= 10 and <= 20 + $level = $ERRORS{WARNING} + if ($value >= $1 && $value <= $2); + } + if ($self->{criticalrange} =~ /^(\d+)$/) { + # critical = 10, crit if > 10 or < 0 + $level = $ERRORS{CRITICAL} + if ($value > $1 || $value < 0); + } elsif ($self->{criticalrange} =~ /^(\d+):$/) { + # critical = 10:, crit if < 10 + $level = $ERRORS{CRITICAL} + if ($value < $1); + } elsif ($self->{criticalrange} =~ /^~:(\d+)$/) { + # critical = ~:10, crit if > 10 + $level = $ERRORS{CRITICAL} + if ($value > $1); + } elsif ($self->{criticalrange} =~ /^(\d+):(\d+)$/) { + # critical = 10:20, crit if < 10 or > 20 + $level = $ERRORS{CRITICAL} + if ($value < $1 || $value > $2); + } elsif ($self->{criticalrange} =~ /^@(\d+):(\d+)$/) { + # critical = @10:20, crit if >= 10 and <= 20 + $level = $ERRORS{CRITICAL} + if ($value >= $1 && $value <= $2); } return $level; # @@ -336,7 +381,7 @@ my $message = shift; push(@{$self->{nagios}->{messages}->{$level}}, $message); # recalc current level - foreach my $llevel qw(CRITICAL WARNING UNKNOWN OK) { + foreach my $llevel (qw(CRITICAL WARNING UNKNOWN OK)) { if (scalar(@{$self->{nagios}->{messages}->{$ERRORS{$llevel}}})) { $self->{nagios_level} = $ERRORS{$llevel}; } @@ -916,14 +961,17 @@ eval { require DBI; use POSIX ':signal_h'; - local $SIG{'ALRM'} = sub { - die "alarm\n"; - }; - my $mask = POSIX::SigSet->new( SIGALRM ); - my $action = POSIX::SigAction->new( - sub { die "alarm\n" ; }, $mask); - my $oldaction = POSIX::SigAction->new(); - sigaction(SIGALRM ,$action ,$oldaction ); + if ($^O =~ /MSWin/) { + local $SIG{'ALRM'} = sub { + die "alarm\n"; + }; + } else { + my $mask = POSIX::SigSet->new( SIGALRM ); + my $action = POSIX::SigAction->new( + sub { die "alarm\n" ; }, $mask); + my $oldaction = POSIX::SigAction->new(); + sigaction(SIGALRM ,$action ,$oldaction ); + } alarm($self->{timeout} - 1); # 1 second before the global unknown timeout my $dsn = sprintf "DBI:Oracle:%s", $self->{connect}; my $connecthash = { RaiseError => 0, AutoCommit => $self->{commit}, PrintError => 0 }; @@ -1214,7 +1262,12 @@ } elsif ($self->{connect} && $self->{username} && $self->{password}) { # --connect bba --username nagios --password oradbmon $self->{sid} = $self->{connect}; - $self->{loginstring} = "traditional"; + if ($self->{username} eq "sys") { + delete $ENV{TWO_TASK}; + $self->{loginstring} = "sys"; + } else { + $self->{loginstring} = "traditional"; + } } else { $self->{errstr} = "Please specify database, username and password"; return undef; @@ -1356,10 +1409,11 @@ } use POSIX ':signal_h'; - local $SIG{'ALRM'} = sub { - die "timeout\n"; - }; - if ($^O !~ /MSWin/) { + if ($^O =~ /MSWin/) { + local $SIG{'ALRM'} = sub { + die "alarm\n"; + }; + } else { my $mask = POSIX::SigSet->new( SIGALRM ); my $action = POSIX::SigAction->new( sub { die "alarm\n" ; }, $mask); @@ -1663,14 +1717,17 @@ eval { require DBI; use POSIX ':signal_h'; - local $SIG{'ALRM'} = sub { - die "alarm\n"; - }; - my $mask = POSIX::SigSet->new( SIGALRM ); - my $action = POSIX::SigAction->new( - sub { die "alarm\n" ; }, $mask); - my $oldaction = POSIX::SigAction->new(); - sigaction(SIGALRM ,$action ,$oldaction ); + if ($^O =~ /MSWin/) { + local $SIG{'ALRM'} = sub { + die "alarm\n"; + }; + } else { + my $mask = POSIX::SigSet->new( SIGALRM ); + my $action = POSIX::SigAction->new( + sub { die "alarm\n" ; }, $mask); + my $oldaction = POSIX::SigAction->new(); + sigaction(SIGALRM ,$action ,$oldaction ); + } alarm($self->{timeout} - 1); # 1 second before the global unknown timeout if ($self->{handle} = DBI->connect( sprintf("DBI:SQLRelay:host=%s;port=%d;socket=%s", $self->{host}, $self->{port}, $self->{socket}), | ||
[+] | Changed | check_oracle_health-1.7.7.3.tar.bz2/plugins-scripts/Nagios/DBD/Oracle/Server/Database.pm ^ |
@@ -25,6 +25,7 @@ tablespaces => [], num_datafiles => undef, num_datafiles_max => undef, + dbusers => [], }; bless $self, $class; $self->init(%params); @@ -68,6 +69,14 @@ ! defined $self->{num_datafiles}) { $self->add_nagios_critical("unable to get number of datafiles"); } + } elsif ($params{mode} =~ /server::database::expiredpw/) { + DBD::Oracle::Server::Database::User::init_users(%params); + if (my @users = + DBD::Oracle::Server::Database::User::return_users()) { + $self->{users} = \@users; + } else { + $self->add_nagios_critical("unable to aquire user info"); + } } } @@ -96,7 +105,7 @@ $self->{handle}->fetchrow_array(q{ SELECT COUNT(*) FROM dba_ind_partitions - WHERE status <> 'USABLE' + WHERE status <> 'USABLE' AND status <> 'N/A' }); # should be only VALID $self->{invalidobjects}->{invalid_registry_components} = @@ -243,6 +252,11 @@ $self->{num_datafiles_max} / 100 * $self->{warningrange}, $self->{num_datafiles_max} / 100 * $self->{criticalrange}, $self->{num_datafiles_max}); + } elsif ($params{mode} =~ /server::database::expiredpw/) { + foreach (@{$self->{users}}) { + $_->nagios(%params); + $self->merge_nagios($_); + } } } } | ||
[+] | Changed | check_oracle_health-1.7.7.3.tar.bz2/plugins-scripts/Nagios/DBD/Oracle/Server/Database/Tablespace.pm ^ |
@@ -224,6 +224,8 @@ } foreach (@tablespaceresult) { my ($name, $status, $type, $extentmgmt, $bytes, $bytes_max, $bytes_free) = @{$_}; + next if $params{notemp} && ($type eq "UNDO" || $type eq "TEMPORARY"); + next if $params{noreadonly} && ($status eq "READ ONLY"); if ($params{regexp}) { next if $params{selectname} && $name !~ /$params{selectname}/; } else { @@ -395,30 +397,33 @@ $self->{real_bytes_free} = $self->{bytes_free}; $self->{percent_as_bar} = '____________________'; } else { - # (total - free) / total * 100 = % used - # (used + free - free) / ( used + free) - if ($self->{bytes_max} == 0) { - $self->{percent_used} = - ($self->{bytes} - $self->{bytes_free}) / $self->{bytes} * 100; - $self->{real_bytes_max} = $self->{bytes}; - $self->{real_bytes_free} = $self->{bytes_free}; - } elsif ($self->{bytes_max} > $self->{bytes}) { - $self->{percent_used} = - ($self->{bytes} - $self->{bytes_free}) / $self->{bytes_max} * 100; - $self->{real_bytes_max} = $self->{bytes_max}; - $self->{real_bytes_free} = $self->{bytes_free} + ($self->{bytes_max} - $self->{bytes}); - } else { - # alter tablespace USERS add datafile 'users02.dbf' - # size 5M autoextend on next 200K maxsize 6M; - # bytes = 5M, maxbytes = 6M - # ..... data arriving...until ORA-01652: unable to extend temp segment - # bytes = 6M, maxbytes = 6M - # alter database datafile 5 resize 8M; - # bytes = 8M, maxbytes = 6M - $self->{percent_used} = - ($self->{bytes} - $self->{bytes_free}) / $self->{bytes} * 100; - $self->{real_bytes_max} = $self->{bytes}; - $self->{real_bytes_free} = $self->{bytes_free}; + if ($params{calcmeth} eq "classic") { + # (total - free) / total * 100 = % used + # (used + free - free) / ( used + free) + if ($self->{bytes_max} == 0) { + $self->{percent_used} = + ($self->{bytes} - $self->{bytes_free}) / $self->{bytes} * 100; + $self->{real_bytes_max} = $self->{bytes}; + $self->{real_bytes_free} = $self->{bytes_free}; + } elsif ($self->{bytes_max} > $self->{bytes}) { + $self->{percent_used} = + ($self->{bytes} - $self->{bytes_free}) / $self->{bytes_max} * 100; + $self->{real_bytes_max} = $self->{bytes_max}; + $self->{real_bytes_free} = $self->{bytes_free} + ($self->{bytes_max} - $self->{bytes}); + } else { + # alter tablespace USERS add datafile 'users02.dbf' + # size 5M autoextend on next 200K maxsize 6M; + # bytes = 5M, maxbytes = 6M + # ..... data arriving...until ORA-01652: unable to extend temp segment + # bytes = 6M, maxbytes = 6M + # alter database datafile 5 resize 8M; + # bytes = 8M, maxbytes = 6M + $self->{percent_used} = + ($self->{bytes} - $self->{bytes_free}) / $self->{bytes} * 100; + $self->{real_bytes_max} = $self->{bytes}; + $self->{real_bytes_free} = $self->{bytes_free}; + } + } elsif ($params{calcmeth} eq "vigna") { } } $self->{percent_free} = 100 - $self->{percent_used}; @@ -501,11 +506,13 @@ if (! $self->{bytes_max}) { $self->check_thresholds($self->{percent_used}, "90", "98"); if ($self->{status} eq 'offline') { - $self->add_nagios_warning( + $self->add_nagios( + defined $params{mitigation} ? $params{mitigation} : 1, sprintf("tbs %s is offline", $self->{name}) ); } else { - $self->add_nagios_critical( + $self->add_nagios( + defined $params{mitigation} ? $params{mitigation} : 2, sprintf("tbs %s has has a problem, maybe needs recovery?", $self->{name}) ); } @@ -570,6 +577,17 @@ if (! $self->{bytes_max}) { $self->check_thresholds($self->{percent_used}, "5:", "2:"); if ($self->{status} eq 'offline') { + $self->add_nagios( + defined $params{mitigation} ? $params{mitigation} : 1, + sprintf("tbs %s is offline", $self->{name}) + ); + } else { + $self->add_nagios( + defined $params{mitigation} ? $params{mitigation} : 2, + sprintf("tbs %s has has a problem, maybe needs recovery?", $self->{name}) + ); + } + if ($self->{status} eq 'offline') { $self->add_nagios_warning( sprintf("tbs %s is offline", $self->{name}) ); @@ -624,12 +642,14 @@ $self->{criticalrange} .= ':'; $self->check_thresholds($self->{real_bytes_free}, "5242880:", "1048576:"); if ($self->{status} eq 'offline') { - $self->add_nagios_warning( + $self->add_nagios( + defined $params{mitigation} ? $params{mitigation} : 1, sprintf("tbs %s is offline", $self->{name}) ); } else { - $self->add_nagios_critical( - sprintf("tbs %s has a problem, maybe needs recovery?", $self->{name}) + $self->add_nagios( + defined $params{mitigation} ? $params{mitigation} : 2, + sprintf("tbs %s has has a problem, maybe needs recovery?", $self->{name}) ); } } else { | ||
[+] | Changed | check_oracle_health-1.7.7.3.tar.bz2/plugins-scripts/Nagios/DBD/Oracle/Server/Database/Tablespace/Segment.pm ^ |
@@ -44,7 +44,7 @@ } elsif ($params{mode} =~ /server::database::tablespace::segment::extendspace/) { my @tablespaceresult = $params{handle}->fetchall_array(q{ - SELECT /*+ RULE */ + SELECT -- tablespace, segment, extent -- aber dadurch, dass nur das letzte extent selektiert wird -- werden praktisch nur tablespace und segmente ausgegeben | ||
[+] | Added | check_oracle_health-1.7.7.3.tar.bz2/plugins-scripts/Nagios/DBD/Oracle/Server/Database/User.pm ^ |
@@ -0,0 +1,127 @@ +package DBD::Oracle::Server::Database::User; + +use strict; + +our @ISA = qw(DBD::Oracle::Server::Database); + +my %ERRORS=( OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 ); +my %ERRORCODES=( 0 => 'OK', 1 => 'WARNING', 2 => 'CRITICAL', 3 => 'UNKNOWN' ); + +{ + my @users = (); + my $initerrors = undef; + + sub add_user { + push(@users, shift); + } + + sub return_users { + return reverse + sort { $a->{name} cmp $b->{name} } @users; + } + + sub init_users { + my %params = @_; + my $num_users = 0; + if (($params{mode} =~ /server::database::expiredpw/)) { + my @pwresult = $params{handle}->fetchall_array(q{ + SELECT + username, expiry_date - sysdate, account_status + FROM + dba_users + }); + foreach (@pwresult) { + my ($name, $valid_days, $status) = @{$_}; + if ($params{regexp}) { + next if $params{selectname} && $name !~ /$params{selectname}/; + } else { + next if $params{selectname} && lc $params{selectname} ne lc $name; + } + my %thisparams = %params; + $thisparams{name} = $name; + $thisparams{valid_days} = $valid_days; + $thisparams{status} = $status; + my $user = DBD::Oracle::Server::Database::User->new( + %thisparams); + add_user($user); + $num_users++; + } + if (! $num_users) { + $initerrors = 1; + return undef; + } + } + } +} + +sub new { + my $class = shift; + my %params = @_; + my $self = { + handle => $params{handle}, + warningrange => $params{warningrange}, + criticalrange => $params{criticalrange}, + name => $params{name}, + valid_days => $params{valid_days}, + status => $params{status}, + }; + bless $self, $class; + $self->init(%params); + return $self; +} + +sub init { + my $self = shift; + $self->init_nagios(); +} + +sub nagios { + my $self = shift; + if ($self->{status} eq "EXPIRED") { + $self->add_nagios_critical(sprintf "password of user %s has expired", + $self->{name}); + } elsif ($self->{status} eq "EXPIRED (GRACE)") { + $self->add_nagios_warning(sprintf "password of user %s soon expires", + $self->{name}); + } elsif ($self->{status} eq "LOCKED (TIMED)") { + $self->add_nagios_warning(sprintf "user %s is temporarily locked", + $self->{name}); + } elsif ($self->{status} eq "LOCKED") { + $self->add_nagios_critical(sprintf "user %s is locked", + $self->{name}); + } elsif ($self->{status} eq "EXPIRED & LOCKED(TIMED)") { + $self->add_nagios_critical(sprintf "password of user %s has expired and is temporarily locked", + $self->{name}); + } elsif ($self->{status} eq "EXPIRED(GRACE) & LOCKED(TIMED)") { + $self->add_nagios_warning(sprintf "password of user %s soon expires and is temporarily locked", + $self->{name}); + } elsif ($self->{status} eq "EXPIRED & LOCKED") { + $self->add_nagios_critical(sprintf "password of user %s has expired and is locked", + $self->{name}); + } elsif ($self->{status} eq "EXPIRED(GRACE) & LOCKED") { + $self->add_nagios_critical(sprintf "password of user %s soon expires and is locked", + $self->{name}); + } + if ($self->{status} eq "OPEN") { + if (defined $self->{valid_days}) { + $self->add_nagios( + $self->check_thresholds($self->{valid_days}, "7:", "3:"), + sprintf("password of user %s will expire in %d days", + $self->{name}, $self->{valid_days})); + $self->add_perfdata(sprintf "\'pw_%s_valid\'=%.2f;%s;%s", + lc $self->{name}, $self->{valid_days}, + $self->{warningrange}, $self->{criticalrange}); + } else { + $self->add_nagios_ok(sprintf "password of user %s will never expire", + $self->{name}); + $self->add_perfdata(sprintf "\'pw_%s_valid\'=0;0;0", + lc $self->{name}); + } + } +} + +1; + + + + | ||
[+] | Changed | check_oracle_health-1.7.7.3.tar.bz2/plugins-scripts/Nagios/DBD/Oracle/Server/Instance.pm ^ |
@@ -62,15 +62,21 @@ }); } elsif ($params{mode} =~ /server::instance::rman::backup::problems/) { $self->{rman_backup_problems} = $self->{handle}->fetchrow_array(q{ - SELECT COUNT(*) FROM v$rman_status WHERE status != 'COMPLETED' + SELECT COUNT(*) FROM v$rman_status + WHERE + operation = 'BACKUP' + AND + status != 'COMPLETED' AND - status != 'RUNNING' - AND start_time > sysdate-3 + status != 'RUNNING' + AND + start_time > sysdate-3 }); } elsif ($params{mode} =~ /server::instance::sessionusage/) { $self->{session_usage} = $self->{handle}->fetchrow_array(q{ SELECT current_utilization/limit_value*100 - FROM v$resource_limit WHERE resource_name LIKE '%sessions%' + FROM v$resource_limit WHERE resource_name = 'sessions' + -- FROM v$resource_limit WHERE resource_name LIKE '%sessions%' }); } elsif ($params{mode} =~ /server::instance::processusage/) { $self->{process_usage} = $self->{handle}->fetchrow_array(q{ | ||
[+] | Changed | check_oracle_health-1.7.7.3.tar.bz2/plugins-scripts/Nagios/DBD/Oracle/Server/Instance/SGA/SharedPool/LibraryCache.pm ^ |
@@ -96,7 +96,7 @@ } elsif ($params{mode} =~ /server::instance::sga::sharedpool::librarycache::reloads/) { $self->add_nagios( - $self->check_thresholds($self->{pin_hitratio}, "10", "100"), + $self->check_thresholds($self->{reload_rate}, "10", "100"), sprintf "SGA library cache reloads %.2f/sec", $self->{reload_rate}); $self->add_perfdata(sprintf "sga_library_cache_reloads_per_sec=%.2f;%s;%s", $self->{reload_rate}, $self->{warningrange}, $self->{criticalrange}); | ||
[+] | Changed | check_oracle_health-1.7.7.3.tar.bz2/plugins-scripts/Nagios/Extraopts.pm ^ |
@@ -21,7 +21,7 @@ sub prepare_file_and_section { my $self = shift; - if (! defined $self->{file}) { + if (! defined $self->{file} || ! $self->{file}) { # ./check_stuff --extra-opts $self->{section} = basename($0); $self->{file} = $self->get_default_file(); | ||
[+] | Changed | check_oracle_health-1.7.7.3.tar.bz2/plugins-scripts/check_oracle_health.pl ^ |
@@ -36,6 +36,9 @@ ['server::connectiontime', 'connection-time', undef, 'Time to connect to the server' ], + ['server::database::expiredpw', + 'password-expiration', undef, + 'Check the password expiry date for users' ], ['server::instance::connectedusers', 'connected-users', undef, 'Number of currently connected users' ], @@ -180,6 +183,9 @@ ['server::sql', 'sql', undef, 'any sql command returning a single number' ], + ['server::sqlruntime', + 'sql-runtime', undef, + 'the time an sql command needs to run' ], ['server::database::tablespace::listtablespaces', 'list-tablespaces', undef, 'convenience function which lists all tablespaces' ], @@ -256,6 +262,10 @@ Tablespace-related modes check all tablespaces in one run by default. If only a single tablespace should be checked, use the --name parameter. The same applies to datafile-related modes. + If an additional --regexp is added, --name's argument will be interpreted + as a regular expression. + The parameter --mitigation lets you classify the severity of an offline + tablespace. tablespace-remaining-time will take historical data into account. The number of days in the past can be given with the --lookback parameter. (Default: 30) @@ -331,6 +341,10 @@ "tablespace=s", "datafile=s", "waitevent=s", + "offlineok", + "mitigation=s", + "notemp", + "noreadonly", "name=s", "name2=s", "regexp", @@ -342,6 +356,7 @@ "basis", "lookback|l=i", "environment|e=s%", + "calcmeth=s", "method=s", "runas|r=s", "scream", @@ -429,6 +444,16 @@ $commandline{commit} = 0; } +if (exists $commandline{calcmeth}) { + if ($commandline{calcmeth} ne "classic" && $commandline{calcmeth} ne "sap" && $commandline{calcmeth} ne "classic") { + printf "Parameter calcmeth must be classic (which is the default), sap or java\n"; + print_help(); + exit $ERRORS{OK}; + } +} else { + $commandline{calcmeth} = "classic"; +} + if (exists $commandline{'with-mymodules-dyn-dir'}) { $DBD::Oracle::Server::my_modules_dyn_dir = $commandline{'with-mymodules-dyn-dir'}; } else { @@ -461,8 +486,8 @@ $needs_restart = 1; # if the calling script has a path for shared libs and there is no --environment # parameter then the called script surely needs the variable too. - foreach my $important_env qw(LD_LIBRARY_PATH SHLIB_PATH - ORACLE_HOME TNS_ADMIN ORA_NLS ORA_NLS33 ORA_NLS10) { + foreach my $important_env (qw(LD_LIBRARY_PATH SHLIB_PATH + ORACLE_HOME TNS_ADMIN ORA_NLS ORA_NLS33 ORA_NLS10)) { if ($ENV{$important_env} && ! scalar(grep { /^$important_env=/ } keys %{$commandline{environment}})) { $commandline{environment}->{$important_env} = $ENV{$important_env}; @@ -490,6 +515,13 @@ push(@newargv, sprintf "--%s", $option); push(@newargv, sprintf "%s", $commandline{$option}); } + } elsif (grep { /^$option/ && /:/ } @params) { + if ($commandline{$option}) { + push(@newargv, sprintf "--%s", $option); + push(@newargv, sprintf "%s", $commandline{$option}); + } else { + push(@newargv, sprintf "--%s", $option); + } } else { push(@newargv, sprintf "--%s", $option); } @@ -597,6 +629,10 @@ tablespace => $commandline{tablespace}, datafile => $commandline{datafile}, basis => $commandline{basis}, + offlineok => $commandline{offlineok}, + mitigation => $commandline{mitigation}, + notemp => $commandline{notemp}, + noreadonly => $commandline{noreadonly}, selectname => $commandline{name} || $commandline{tablespace} || $commandline{datafile}, regexp => $commandline{regexp}, name => $commandline{name}, @@ -608,6 +644,7 @@ verbose => $commandline{verbose}, report => $commandline{report}, commit => $commandline{commit}, + calcmeth => $commandline{calcmeth}, ); my $server = undef; |