Page 1 of 1

Oracle wizard needs slight adjustment

Posted: Thu Feb 23, 2017 6:07 pm
by vAJ
Wanted to file a small bug with the Oracle DB Wizard. Looks like this is exposed by Perl 5.14
https://metacpan.org/pod/release/RJBS/p ... arentheses

check_oracle_health works (doesn't fail), but throws this error:

Code: Select all

[Use of qw(...) as parentheses is deprecated at /usr/local/nagios/libexec/check_oracle_health line 4162.
Use of qw(...) as parentheses is deprecated at /usr/local/nagios/libexec/check_oracle_health line 6166.]
Updating those sections of code by adding another set of () around the quote word functions to:

Code: Select all

sub add_nagios {
  my $self = shift;
  my $level = shift;
  my $message = shift;
  push(@{$self->{nagios}->{messages}->{$level}}, $message);
  # recalc current level
  foreach my $llevel (qw(CRITICAL WARNING UNKNOWN OK)) {
    if (scalar(@{$self->{nagios}->{messages}->{$ERRORS{$llevel}}})) {
      $self->{nagios_level} = $ERRORS{$llevel};
    }
  }
}
and

Code: Select all

if (exists $commandline{runas}) {
  # remove the runas parameter
  # exec sudo $0 ... the remaining parameters
  $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)) {
    if ($ENV{$important_env} && ! scalar(grep { /^$important_env=/ }
        keys %{$commandline{environment}})) {
      $commandline{environment}->{$important_env} = $ENV{$important_env};
      printf STDERR "add important --environment %s=%s\n",
          $important_env, $ENV{$important_env} if $DBD::Oracle::Server::verbose;
    }
  }
}
Removes the deprecation message.

Re: Oracle wizard needs slight adjustment

Posted: Fri Feb 24, 2017 10:24 am
by mcapra
Thanks for sharing your fix! Since we don't directly maintain that plugin, it may be best to contact the developers with this fix directly:
https://labs.consol.de/

Re: Oracle wizard needs slight adjustment

Posted: Fri Feb 24, 2017 10:34 am
by SteveBeauchemin
I believe the new version of that check already has those changes. And more.

https://labs.consol.de/nagios/check_ora ... index.html

Also - something cool - The new version can run state based checks on multiple mod_gearman hosts without losing the state. I submitted a change to Gerhard that added redis awareness to the Oracle script. Normally you do not want to run any state based checks on mod_gearman hosts because you never know which host will run the test in the next cycle. There is a Nagios KB document somewhere that recommends against using mod_gearman hosts to run Interface tests and other tests that store a small file remembering the counter data of the previous test. The Consol Labs Oracle test makes a ton of temporary files with state data. Look in /var... But now you can tell it you have a redis master and slave, and it uses those to store the state data. I was able to offload a ton of work from my Nagios core server as a result. Also most if not all my Router and Switch tests have been made a little better by adding redis awareness. I have Redis master running on my Gearman host, and Redis slaves on all my Mod_gearman. All the switch and router tests run on the Mod_gearman with no fear.

In any case, the Nagios version of check_oracle_health just needs to be updated from the source. It is a drop in replacement.

Code: Select all

./check_oracle_health -V
check_oracle_health (3.1)
Thanks

Steve B

Re: Oracle wizard needs slight adjustment

Posted: Fri Feb 24, 2017 10:54 am
by dwhitfield
@vaj, thanks for sharing the fix. Are we ready to lock this up?