Changes of Revision 20
[-] | Changed | nagios-plugins-oracle.changes |
1
2 ------------------------------------------------------------------- 3 +Mon Aug 22 21:19:15 UTC 2011 - cs@linux-administrator.com 4 + 5 +- update to version 1.7.1 6 + 7 +------------------------------------------------------------------- 8 Sat Jun 18 19:41:16 UTC 2011 - cs@linux-administrator.com 9 10 - update to version 1.6.9 11 |
||
[-] | Changed | nagios-plugins-oracle.spec ^ |
9 1
2 %define pkg_name check_oracle_health 3 Name: nagios-plugins-oracle 4 -Version: 1.6.9 5 +Version: 1.7.1 6 Release: 1 7 Summary: Oracle health check plugins for Nagios 8 Group: Applications/System 9 |
||
[+] | Changed | check_oracle_health-1.7.1.tar.bz2/ChangeLog ^ |
@@ -2,6 +2,16 @@ # Changelog of the check_oracle_health plugin # ############################################### +1.7.1 - 2001-08-17 +- add option --commit (Thanks Ovidiu) + +1.7.0 - 2011-08-16 +- add error handling for unwritable status files +- fix a bug with statefilesdir and capital letters +- enhance stale statistics +- enhance invalid objects (Thanks Yannick Charton) +- fix a bug in open cmdcmd (only affects method sqlplus) + 1.6.9 - 2011-06-16 - sites in an OMD (http://omdistro.org) environment have now private statefile directories - add mode session-usage, process-usage, rman-backup-problems, corrupted-blocks (Thanks Ovidiu Marcu) | ||
[+] | Changed | check_oracle_health-1.7.1.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.6.9. +# Generated by GNU Autoconf 2.59 for check_oracle_health 1.7.1. # # 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.6.9' -PACKAGE_STRING='check_oracle_health 1.6.9' +PACKAGE_VERSION='1.7.1' +PACKAGE_STRING='check_oracle_health 1.7.1' 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.6.9 to adapt to many kinds of systems. +\`configure' configures check_oracle_health 1.7.1 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.6.9:";; + short | recursive ) echo "Configuration of check_oracle_health 1.7.1:";; 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.6.9 +check_oracle_health configure 1.7.1 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.6.9, which was +It was created by check_oracle_health $as_me 1.7.1, 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.6.9' + VERSION='1.7.1' cat >>confdefs.h <<_ACEOF @@ -2725,7 +2725,7 @@ } >&5 cat >&5 <<_CSEOF -This file was extended by check_oracle_health $as_me 1.6.9, which was +This file was extended by check_oracle_health $as_me 1.7.1, 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.6.9 +check_oracle_health config.status 1.7.1 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" | ||
[+] | Changed | check_oracle_health-1.7.1.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.6.9) +AC_INIT(check_oracle_health,1.7.1) AM_INIT_AUTOMAKE([1.9 tar-pax]) AC_CANONICAL_HOST | ||
[+] | Changed | check_oracle_health-1.7.1.tar.bz2/plugins-scripts/Nagios/DBD/Oracle/Server.pm ^ |
@@ -47,6 +47,7 @@ verbose => $params{verbose}, ident => $params{ident}, report => $params{report}, + commit => $params{commit}, version => 'unknown', instance => undef, database => undef, @@ -602,13 +603,13 @@ my $self = shift; my %params = @_; my $extension = ""; - if ($params{connect} =~ /(\w+)\/(\w+)@(\w+)/) { + my $mode = $params{mode}; + if ($params{connect} && $params{connect} =~ /(\w+)\/(\w+)@(\w+)/) { $params{connect} = $3; - } else { + } elsif ($params{connect}) { # just to be sure $params{connect} =~ s/\//_/g; } - my $mode = $params{mode}; if ($^O =~ /MSWin/) { $mode =~ s/::/_/g; $params{statefilesdir} = $self->system_vartmpdir(); @@ -621,12 +622,11 @@ } if ($@ || ! -w $params{statefilesdir}) { $self->add_nagios($ERRORS{CRITICAL}, - sprintf "statefilesdir %s does not exist or is not writable\n", + sprintf "statefilesdir %s does not exist or is not writable", $params{statefilesdir}); return; } - my $statefile = sprintf "%s/%s_%s", - $params{statefilesdir}, $params{connect}, $mode; + my $statefile = sprintf "%s_%s", $params{connect}, $mode; $extension .= $params{differenciator} ? "_".$params{differenciator} : ""; $extension .= $params{tablespace} ? "_".$params{tablespace} : ""; $extension .= $params{datafile} ? "_".$params{datafile} : ""; @@ -638,12 +638,17 @@ $extension =~ s/\s/_/g; $statefile .= $extension; $statefile = lc $statefile; - open(STATE, ">$statefile"); - if ((ref($params{save}) eq "HASH") && exists $params{save}->{timestamp}) { - $params{save}->{localtime} = scalar localtime $params{save}->{timestamp}; + $statefile = sprintf "%s/%s", $params{statefilesdir}, $statefile; + if (open(STATE, ">$statefile")) { + if ((ref($params{save}) eq "HASH") && exists $params{save}->{timestamp}) { + $params{save}->{localtime} = scalar localtime $params{save}->{timestamp}; + } + printf STATE Data::Dumper::Dumper($params{save}); + close STATE; + } else { + $self->add_nagios($ERRORS{CRITICAL}, + sprintf "statefile %s is not writable", $statefile); } - printf STATE Data::Dumper::Dumper($params{save}); - close STATE; $self->debug(sprintf "saved %s to %s", Data::Dumper::Dumper($params{save}), $statefile); } @@ -652,18 +657,18 @@ my $self = shift; my %params = @_; my $extension = ""; - if ($params{connect} =~ /(\w+)\/(\w+)@(\w+)/) { + my $mode = $params{mode}; + if ($params{connect} && $params{connect} =~ /(\w+)\/(\w+)@(\w+)/) { $params{connect} = $3; - } else { + } elsif ($params{connect}) { + # just to be sure $params{connect} =~ s/\//_/g; } - my $mode = $params{mode}; if ($^O =~ /MSWin/) { $mode =~ s/::/_/g; $params{statefilesdir} = $self->system_vartmpdir(); } - my $statefile = sprintf "%s/%s_%s", - $params{statefilesdir}, $params{connect}, $mode; + my $statefile = sprintf "%s_%s", $params{connect}, $mode; $extension .= $params{differenciator} ? "_".$params{differenciator} : ""; $extension .= $params{tablespace} ? "_".$params{tablespace} : ""; $extension .= $params{datafile} ? "_".$params{datafile} : ""; @@ -675,13 +680,15 @@ $extension =~ s/\s/_/g; $statefile .= $extension; $statefile = lc $statefile; + $statefile = sprintf "%s/%s", $params{statefilesdir}, $statefile; if ( -f $statefile) { our $VAR1; eval { require $statefile; }; if($@) { -printf "rumms\n"; + $self->add_nagios($ERRORS{CRITICAL}, + sprintf "statefile %s is corrupt", $statefile); } $self->debug(sprintf "load %s", Data::Dumper::Dumper($VAR1)); return $VAR1; @@ -832,6 +839,7 @@ username => $params{username}, password => $params{password}, verbose => $params{verbose}, + commit => $params{commit}, tnsadmin => $ENV{TNS_ADMIN}, oraclehome => $ENV{ORACLE_HOME}, handle => undef, @@ -915,9 +923,9 @@ 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 => 0, PrintError => 0 }; + my $connecthash = { RaiseError => 0, AutoCommit => $self->{commit}, PrintError => 0 }; if ($self->{username} eq "sys" || $self->{username} eq "sysdba") { - $connecthash = { RaiseError => 0, AutoCommit => 0, PrintError => 0, + $connecthash = { RaiseError => 0, AutoCommit => $self->{commit}, PrintError => 0, #ora_session_mode => DBD::Oracle::ORA_SYSDBA ora_session_mode => 0x0002 }; $dsn = sprintf "DBI:Oracle:"; @@ -1130,13 +1138,19 @@ } } } - my ($tempfile_handle, $tempfile) = - tempfile($template, SUFFIX => ".temp", UNLINK => 1, - DIR => $self->system_tmpdir() ); - close $tempfile_handle; - ($self->{sql_commandfile} = $tempfile) =~ s/temp$/sql/; - ($self->{sql_resultfile} = $tempfile) =~ s/temp$/out/; - ($self->{sql_outfile} = $tempfile) =~ s/temp$/err/; + eval { + my ($tempfile_handle, $tempfile) = + tempfile($template, SUFFIX => ".temp", UNLINK => 1, + DIR => $self->system_tmpdir() ); + close $tempfile_handle; + ($self->{sql_commandfile} = $tempfile) =~ s/temp$/sql/; + ($self->{sql_resultfile} = $tempfile) =~ s/temp$/out/; + ($self->{sql_outfile} = $tempfile) =~ s/temp$/err/; + }; + if ($@) { + $self->{errstr} = sprintf "cannot create a temporary file in %s", + $self->system_tmpdir(); + } if ($self->{mode} =~ /^server::tnsping/) { if (! $self->{connect}) { $self->{errstr} = "Please specify a database"; @@ -1536,15 +1550,18 @@ sub DESTROY { my $self = shift; $self->trace("try to clean up command and result files"); - unlink $self->{sql_commandfile} if -f $self->{sql_commandfile}; - unlink $self->{sql_resultfile} if -f $self->{sql_resultfile}; - unlink $self->{sql_outfile} if -f $self->{sql_outfile}; + unlink $self->{sql_commandfile} + if $self->{sql_commandfile} && -f $self->{sql_commandfile}; + unlink $self->{sql_resultfile} + if $self->{sql_resultfile} && -f $self->{sql_resultfile}; + unlink $self->{sql_outfile} if + $self->{sql_outfile} && -f $self->{sql_outfile}; } sub create_commandfile { my $self = shift; my $sql = shift; - open CMDCMD, "> $self->{sql_commandfile}"; + open CMDCMD, "> $self->{sql_commandfile}"; printf CMDCMD "SET HEADING OFF\n"; printf CMDCMD "SET PAGESIZE 0\n"; printf CMDCMD "SET LINESIZE 32767\n"; @@ -1554,7 +1571,7 @@ printf CMDCMD "SET TRIMSPOOL ON\n"; printf CMDCMD "SET NUMFORMAT 9.999999EEEE\n"; printf CMDCMD "SPOOL %s\n", $self->{sql_resultfile}; -# printf CMDCMD "ALTER SESSION SET NLS_NUMERIC_CHARACTERS='.,';\n/\n"; + # printf CMDCMD "ALTER SESSION SET NLS_NUMERIC_CHARACTERS='.,';\n/\n"; printf CMDCMD "%s\n/\n", $sql; printf CMDCMD "SPOOL OFF\n", $sql; printf CMDCMD "EXIT\n"; @@ -1637,7 +1654,7 @@ sprintf("DBI:SQLRelay:host=%s;port=%d;socket=%s", $self->{host}, $self->{port}, $self->{socket}), $self->{username}, $self->{password}, - { RaiseError => 1, AutoCommit => 0, PrintError => 1 })) { + { RaiseError => 1, AutoCommit => $self->{commit}, PrintError => 1 })) { $self->{handle}->do(q{ ALTER SESSION SET NLS_NUMERIC_CHARACTERS=".," }); $retval = $self; | ||
[+] | Changed | check_oracle_health-1.7.1.tar.bz2/plugins-scripts/Nagios/DBD/Oracle/Server/Database.pm ^ |
@@ -87,21 +87,21 @@ # should be only N/A or VALID $self->{invalidobjects}->{invalid_indexes} = $self->{handle}->fetchrow_array(q{ - SELECT COUNT(DISTINCT STATUS) + SELECT COUNT(*) FROM dba_indexes WHERE status <> 'VALID' AND status <> 'N/A' }); # should be only USABLE $self->{invalidobjects}->{invalid_ind_partitions} = $self->{handle}->fetchrow_array(q{ - SELECT COUNT(DISTINCT STATUS) + SELECT COUNT(*) FROM dba_ind_partitions WHERE status <> 'USABLE' }); # should be only VALID $self->{invalidobjects}->{invalid_registry_components} = $self->{handle}->fetchrow_array(q{ - SELECT COUNT(DISTINCT STATUS) + SELECT COUNT(*) FROM dba_registry WHERE status <> 'VALID' }); @@ -120,6 +120,7 @@ if ($self->version_is_minimum("10.x")) { $self->{staleobjects} = $self->{handle}->fetchrow_array(q{ SELECT COUNT(*) FROM sys.dba_tab_statistics WHERE stale_stats = 'YES' + AND owner NOT IN ('SYS','SYSTEM','EXFSYS','DBSNMP','CTXSYS','DMSYS','MDDATA','MDSYS','OLAPSYS','ORDSYS','TSMSYS','WMSYS') }); } else { # oracle9 + sqlplus nix gut | ||
[+] | Changed | check_oracle_health-1.7.1.tar.bz2/plugins-scripts/check_oracle_health.pl ^ |
@@ -244,6 +244,8 @@ and for specifying thresholds for mode=tablespace-free --ident outputs instance and database names + --commit + turns on autocommit for the dbd::oracle module Tablespace-related modes check all tablespaces in one run by default. If only a single tablespace should be checked, use the --name parameter. @@ -346,6 +348,7 @@ "statefilesdir=s", "with-mymodules-dyn-dir=s", "report=s", + "commit", "extra-opts:s"); if (! GetOptions(\%commandline, @params)) { @@ -414,6 +417,12 @@ $commandline{report} = "long"; } +if (exists $commandline{commit}) { + $commandline{commit} = 1; +} else { + $commandline{commit} = 0; +} + if (exists $commandline{'with-mymodules-dyn-dir'}) { $DBD::Oracle::Server::my_modules_dyn_dir = $commandline{'with-mymodules-dyn-dir'}; } else { @@ -587,6 +596,7 @@ ident => $commandline{ident}, verbose => $commandline{verbose}, report => $commandline{report}, + commit => $commandline{commit}, ); my $server = undef; |