Oracle wizard needs slight adjustment

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
vAJ
Posts: 456
Joined: Thu Nov 08, 2012 5:09 pm
Location: Austin, TX

Oracle wizard needs slight adjustment

Post 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.
Andrew J. - Do you even grok?
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Oracle wizard needs slight adjustment

Post 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/
Former Nagios employee
https://www.mcapra.com/
SteveBeauchemin
Posts: 524
Joined: Mon Oct 14, 2013 7:19 pm

Re: Oracle wizard needs slight adjustment

Post 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
XI 5.7.3 / Core 4.4.6 / NagVis 1.9.8 / LiveStatus 1.5.0p11 / RRDCached 1.7.0 / Redis 3.2.8 /
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Oracle wizard needs slight adjustment

Post by dwhitfield »

@vaj, thanks for sharing the fix. Are we ready to lock this up?
Locked