Error in Customized Ruby Check Ruby OCI8

Hi Experts,

I would like to get your assistance on an issue I am experiencing.

I am customizing my own check that queries to an Oracle Database using Ruby DBI OCI8. I’ve installed this plugin in our centos server and tried to execute the following by calling it and it executes fine with the desired results.

#! /usr/bin/env ruby

require ‘rubygems’

require ‘oci8’

oci = OCI8.new(‘GLOGOWNER’,‘Sh#reit1’,‘192.168.30.223:1521/orcl’)

oci.exec(‘select shipment_gid, shipment_xid, servprov_gid from shipment where rownum <= 1’) do |record|

puts record.join(’,’)

end

``

result:

DEMO.01064,01064,DEMO.DB_SCHENKER

``

But, somehow when I’m calling this script in sensu using check config file, I get an error result

/etc/sensu/conf.d/check.json

{

“checks”: {

“sql_check”: {

“command”: “/opt/sensu/embedded/bin/dbconnect.rb”,

“interval”: 60,

“standalone”: true,

“handlers”: [“event_stream”, “email”],

“subscribers”: [ “ALL” ]

}

}

}

``

error output:
/opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- oci8 (LoadError) from /opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:inrequire’ from /opt/sensu/embedded/bin/dbconnect.rb:3:in `’

``

Hoping you can assist me on this matter. Thank you!

Regards,

Peter

Do you have the oci8 gem installed in the sensu embedded ruby? Run /opt/sensu/embedded/bin/gem list | grep oci8 to make sure it’s there.

···

On Thu, May 25, 2017 at 11:15 PM, Peter Russy Alfafara peter.russy.alfafara@gmail.com wrote:

Hi Experts,

I would like to get your assistance on an issue I am experiencing.

I am customizing my own check that queries to an Oracle Database using Ruby DBI OCI8. I’ve installed this plugin in our centos server and tried to execute the following by calling it and it executes fine with the desired results.

#! /usr/bin/env ruby

require ‘rubygems’

require ‘oci8’

oci = OCI8.new(‘GLOGOWNER’,‘Sh#reit1’,‘192.168.30.223:1521/orcl’)

oci.exec(‘select shipment_gid, shipment_xid, servprov_gid from shipment where rownum <= 1’) do |record|

puts record.join(’,’)

end

``

result:

DEMO.01064,01064,DEMO.DB_SCHENKER

``

But, somehow when I’m calling this script in sensu using check config file, I get an error result

/etc/sensu/conf.d/check.json

{

“checks”: {

“sql_check”: {

“command”: “/opt/sensu/embedded/bin/dbconnect.rb”,

“interval”: 60,

“standalone”: true,

“handlers”: [“event_stream”, “email”],

“subscribers”: [ “ALL” ]

}

}

}

``

error output:
/opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- oci8 (LoadError) from /opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:inrequire’ from /opt/sensu/embedded/bin/dbconnect.rb:3:in `’

``

Hoping you can assist me on this matter. Thank you!

Regards,

Peter

Hi Eric,

It doesn’t seem to be installed in this directory.

#/opt/sensu/embedded/bin> /opt/sensu/embedded/bin/gem list | grep oci8

[oracle@otmdemox] -->orcl<-- 12R12

``

But I already installed it in the server using the following steps:

  1. download latest version from https://bintray.com/kubo/generic/ruby-oci8
  2. Move downloaded tar file to server using FileZilla
  3. Login to Server and go to directory where the tar is
  4. execute ‘gzip -dc ruby-oci8-2.2.3.tar.gz | tar xvf –‘
  5. execute ‘sudo su -l root’
  6. cd /home/oracle/ruby-oci8-2.2.3
  7. make
  8. make install

Are my installation steps incorrect?

Thank you again!

Regards,

Peter

···

On Saturday, May 27, 2017 at 1:06:05 AM UTC+8, Eric Heydrick wrote:

Do you have the oci8 gem installed in the sensu embedded ruby? Run /opt/sensu/embedded/bin/gem list | grep oci8 to make sure it’s there.

On Thu, May 25, 2017 at 11:15 PM, Peter Russy Alfafara peter.russ...@gmail.com wrote:

Hi Experts,

I would like to get your assistance on an issue I am experiencing.

I am customizing my own check that queries to an Oracle Database using Ruby DBI OCI8. I’ve installed this plugin in our centos server and tried to execute the following by calling it and it executes fine with the desired results.

#! /usr/bin/env ruby

require ‘rubygems’

require ‘oci8’

oci = OCI8.new(‘GLOGOWNER’,‘Sh#reit1’,‘192.168.30.223:1521/orcl’)

oci.exec(‘select shipment_gid, shipment_xid, servprov_gid from shipment where rownum <= 1’) do |record|

puts record.join(’,’)

end

``

result:

DEMO.01064,01064,DEMO.DB_SCHENKER

``

But, somehow when I’m calling this script in sensu using check config file, I get an error result

/etc/sensu/conf.d/check.json

{

“checks”: {

“sql_check”: {

“command”: “/opt/sensu/embedded/bin/dbconnect.rb”,

“interval”: 60,

“standalone”: true,

“handlers”: [“event_stream”, “email”],

“subscribers”: [ “ALL” ]

}

}

}

``

error output:
/opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- oci8 (LoadError) from /opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:inrequire’ from /opt/sensu/embedded/bin/dbconnect.rb:3:in `’

``

Hoping you can assist me on this matter. Thank you!

Regards,

Peter

You should install the ruby-oci8 gem into the sensu embedded ruby. To do that run “/opt/sensu/embedded/bin/gem install ruby-oci8”. According to the docs you need the oracle client installed and to set an environment variable that points at the client installation.

···

On Tue, May 30, 2017 at 8:49 PM, Peter Russy Alfafara peter.russy.alfafara@gmail.com wrote:

Hi Eric,

It doesn’t seem to be installed in this directory.

#/opt/sensu/embedded/bin> /opt/sensu/embedded/bin/gem list | grep oci8

[oracle@otmdemox] -->orcl<-- 12R12

``

But I already installed it in the server using the following steps:

  1. download latest version from https://bintray.com/kubo/generic/ruby-oci8
  2. Move downloaded tar file to server using FileZilla
  3. Login to Server and go to directory where the tar is
  4. execute ‘gzip -dc ruby-oci8-2.2.3.tar.gz | tar xvf –‘
  5. execute ‘sudo su -l root’
  6. cd /home/oracle/ruby-oci8-2.2.3
  7. make
  8. make install

Are my installation steps incorrect?

Thank you again!

Regards,

Peter

On Saturday, May 27, 2017 at 1:06:05 AM UTC+8, Eric Heydrick wrote:

Do you have the oci8 gem installed in the sensu embedded ruby? Run /opt/sensu/embedded/bin/gem list | grep oci8 to make sure it’s there.

On Thu, May 25, 2017 at 11:15 PM, Peter Russy Alfafara peter.russ...@gmail.com wrote:

Hi Experts,

I would like to get your assistance on an issue I am experiencing.

I am customizing my own check that queries to an Oracle Database using Ruby DBI OCI8. I’ve installed this plugin in our centos server and tried to execute the following by calling it and it executes fine with the desired results.

#! /usr/bin/env ruby

require ‘rubygems’

require ‘oci8’

oci = OCI8.new(‘GLOGOWNER’,‘Sh#reit1’,‘192.168.30.223:1521/orcl’)

oci.exec(‘select shipment_gid, shipment_xid, servprov_gid from shipment where rownum <= 1’) do |record|

puts record.join(’,’)

end

``

result:

DEMO.01064,01064,DEMO.DB_SCHENKER

``

But, somehow when I’m calling this script in sensu using check config file, I get an error result

/etc/sensu/conf.d/check.json

{

“checks”: {

“sql_check”: {

“command”: “/opt/sensu/embedded/bin/dbconnect.rb”,

“interval”: 60,

“standalone”: true,

“handlers”: [“event_stream”, “email”],

“subscribers”: [ “ALL” ]

}

}

}

``

error output:
/opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- oci8 (LoadError) from /opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:inrequire’ from /opt/sensu/embedded/bin/dbconnect.rb:3:in `’

``

Hoping you can assist me on this matter. Thank you!

Regards,

Peter

Hi Eric,

Thanks for the assistance!

I’ve followed the instructions in the link and I’m currently stuck at an error while I’m installing ruby:

#/home/oracle> sudo gem update

/usr/lib/ruby/site_ruby/1.8/rubygems.rb:11:in `require’: no such file to load – thread (LoadError)

from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:11

from /usr/bin/gem:8:in `require’

from /usr/bin/gem:8

``

Any ideas what’s causing this? Thank you for your prompt response btw :slight_smile:

Regards,

Peter

···

On Wednesday, May 31, 2017 at 12:16:37 PM UTC+8, Eric Heydrick wrote:

You should install the ruby-oci8 gem into the sensu embedded ruby. To do that run “/opt/sensu/embedded/bin/gem install ruby-oci8”. According to the docs you need the oracle client installed and to set an environment variable that points at the client installation.

On Tue, May 30, 2017 at 8:49 PM, Peter Russy Alfafara peter.russ...@gmail.com wrote:

Hi Eric,

It doesn’t seem to be installed in this directory.

#/opt/sensu/embedded/bin> /opt/sensu/embedded/bin/gem list | grep oci8

[oracle@otmdemox] -->orcl<-- 12R12

``

But I already installed it in the server using the following steps:

  1. download latest version from https://bintray.com/kubo/generic/ruby-oci8
  2. Move downloaded tar file to server using FileZilla
  3. Login to Server and go to directory where the tar is
  4. execute ‘gzip -dc ruby-oci8-2.2.3.tar.gz | tar xvf –‘
  5. execute ‘sudo su -l root’
  6. cd /home/oracle/ruby-oci8-2.2.3
  7. make
  8. make install

Are my installation steps incorrect?

Thank you again!

Regards,

Peter

On Saturday, May 27, 2017 at 1:06:05 AM UTC+8, Eric Heydrick wrote:

Do you have the oci8 gem installed in the sensu embedded ruby? Run /opt/sensu/embedded/bin/gem list | grep oci8 to make sure it’s there.

On Thu, May 25, 2017 at 11:15 PM, Peter Russy Alfafara peter.russ...@gmail.com wrote:

Hi Experts,

I would like to get your assistance on an issue I am experiencing.

I am customizing my own check that queries to an Oracle Database using Ruby DBI OCI8. I’ve installed this plugin in our centos server and tried to execute the following by calling it and it executes fine with the desired results.

#! /usr/bin/env ruby

require ‘rubygems’

require ‘oci8’

oci = OCI8.new(‘GLOGOWNER’,‘Sh#reit1’,‘192.168.30.223:1521/orcl’)

oci.exec(‘select shipment_gid, shipment_xid, servprov_gid from shipment where rownum <= 1’) do |record|

puts record.join(’,’)

end

``

result:

DEMO.01064,01064,DEMO.DB_SCHENKER

``

But, somehow when I’m calling this script in sensu using check config file, I get an error result

/etc/sensu/conf.d/check.json

{

“checks”: {

“sql_check”: {

“command”: “/opt/sensu/embedded/bin/dbconnect.rb”,

“interval”: 60,

“standalone”: true,

“handlers”: [“event_stream”, “email”],

“subscribers”: [ “ALL” ]

}

}

}

``

error output:
/opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- oci8 (LoadError) from /opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:inrequire’ from /opt/sensu/embedded/bin/dbconnect.rb:3:in `’

``

Hoping you can assist me on this matter. Thank you!

Regards,

Peter

When you run gem without the full path you get the system ruby. In this case it’s Ruby 1.8 which is end of life and you really don’t want to use it for performance and security reasons. Instead use the ruby that sensu ships as part of the omnibus package. To do that use the full path to the embedded gem command, /opt/sensu/embedded/bin/gem.

···

On Tue, May 30, 2017 at 11:36 PM, Peter Russy Alfafara peter.russy.alfafara@gmail.com wrote:

Hi Eric,

Thanks for the assistance!

I’ve followed the instructions in the link and I’m currently stuck at an error while I’m installing ruby:

#/home/oracle> sudo gem update

/usr/lib/ruby/site_ruby/1.8/rubygems.rb:11:in `require’: no such file to load – thread (LoadError)

from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:11

from /usr/bin/gem:8:in `require’

from /usr/bin/gem:8

``

Any ideas what’s causing this? Thank you for your prompt response btw :slight_smile:

Regards,

Peter

On Wednesday, May 31, 2017 at 12:16:37 PM UTC+8, Eric Heydrick wrote:

You should install the ruby-oci8 gem into the sensu embedded ruby. To do that run “/opt/sensu/embedded/bin/gem install ruby-oci8”. According to the docs you need the oracle client installed and to set an environment variable that points at the client installation.

On Tue, May 30, 2017 at 8:49 PM, Peter Russy Alfafara peter.russ...@gmail.com wrote:

Hi Eric,

It doesn’t seem to be installed in this directory.

#/opt/sensu/embedded/bin> /opt/sensu/embedded/bin/gem list | grep oci8

[oracle@otmdemox] -->orcl<-- 12R12

``

But I already installed it in the server using the following steps:

  1. download latest version from https://bintray.com/kubo/generic/ruby-oci8
  2. Move downloaded tar file to server using FileZilla
  3. Login to Server and go to directory where the tar is
  4. execute ‘gzip -dc ruby-oci8-2.2.3.tar.gz | tar xvf –‘
  5. execute ‘sudo su -l root’
  6. cd /home/oracle/ruby-oci8-2.2.3
  7. make
  8. make install

Are my installation steps incorrect?

Thank you again!

Regards,

Peter

On Saturday, May 27, 2017 at 1:06:05 AM UTC+8, Eric Heydrick wrote:

Do you have the oci8 gem installed in the sensu embedded ruby? Run /opt/sensu/embedded/bin/gem list | grep oci8 to make sure it’s there.

On Thu, May 25, 2017 at 11:15 PM, Peter Russy Alfafara peter.russ...@gmail.com wrote:

Hi Experts,

I would like to get your assistance on an issue I am experiencing.

I am customizing my own check that queries to an Oracle Database using Ruby DBI OCI8. I’ve installed this plugin in our centos server and tried to execute the following by calling it and it executes fine with the desired results.

#! /usr/bin/env ruby

require ‘rubygems’

require ‘oci8’

oci = OCI8.new(‘GLOGOWNER’,‘Sh#reit1’,‘192.168.30.223:1521/orcl’)

oci.exec(‘select shipment_gid, shipment_xid, servprov_gid from shipment where rownum <= 1’) do |record|

puts record.join(’,’)

end

``

result:

DEMO.01064,01064,DEMO.DB_SCHENKER

``

But, somehow when I’m calling this script in sensu using check config file, I get an error result

/etc/sensu/conf.d/check.json

{

“checks”: {

“sql_check”: {

“command”: “/opt/sensu/embedded/bin/dbconnect.rb”,

“interval”: 60,

“standalone”: true,

“handlers”: [“event_stream”, “email”],

“subscribers”: [ “ALL” ]

}

}

}

``

error output:
/opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- oci8 (LoadError) from /opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:inrequire’ from /opt/sensu/embedded/bin/dbconnect.rb:3:in `’

``

Hoping you can assist me on this matter. Thank you!

Regards,

Peter

Thanks again Eric.

I’m now in installing OCI8. But get the error:

Building native extensions. This could take a while…

ERROR: Error installing ruby-oci8:

ERROR: Failed to build gem native extension.

current directory: /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/ruby-oci8-2.2.3/ext/oci8

/opt/sensu/embedded/bin/ruby -r ./siteconf20170531-19867-1jij4uz.rb extconf.rb

checking for load library path…

LD_LIBRARY_PATH is not set.

checking ld.so.conf… no

checking for cc… ok

checking for gcc… yes

checking for LP64… yes

checking for sys/types.h… yes

checking for ruby header… ok

*** extconf.rb failed ***

Could not create Makefile due to some reason, probably lack of necessary

libraries and/or headers. Check the mkmf.log file for more details. You may

need configuration options.

Provided configuration options:

–with-opt-dir

–with-opt-include

–without-opt-include=${opt-dir}/include

–with-opt-lib

–without-opt-lib=${opt-dir}/lib

–with-make-prog

–without-make-prog

–srcdir=.

–curdir

–ruby=/opt/sensu/embedded/bin/$(RUBY_BASE_NAME)

–with-instant-client

–without-instant-client

/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:963:in `get_home’: RuntimeError (RuntimeError)

from /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:779:in `initialize’

from /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:320:in `new’

from /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:320:in `get’

from extconf.rb:22:in `’

···

Error Message:

Set the environment variable ORACLE_HOME if Oracle Full Client.

Append the path of Oracle client libraries to LD_LIBRARY_PATH if Oracle Instant Client.

The ‘sudo’ command unset some environment variables for security reasons.

Pass required varialbes as follows

sudo env LD_LIBRARY_PATH=$LD_LIBRARY_PATH /opt/sensu/embedded/bin/gem install ruby-oci8

or

sudo env ORACLE_HOME=$ORACLE_HOME /opt/sensu/embedded/bin/gem install ruby-oci8

Backtrace:

/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:963:in `get_home’

/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:779:in `initialize’

/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:320:in `new’

/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:320:in `get’

extconf.rb:22:in `’


See:

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/opt/sensu/embedded/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0/ruby-oci8-2.2.3/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/ruby-oci8-2.2.3 for inspection.

Results logged to /opt/sensu/embedded/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0/ruby-oci8-2.2.3/gem_make.out

``

The following are the steps I’ve made to configure this

    1.   Download Instant Client (Basic, JDK and SQL Plus) in
      

    http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html

    1.   Transfer all zip files to /opt/oracle using FileZilla
      
    2.   Login to Unix Server and go to /opt/oracle directory
      
    3.   Execute the following
      

    unzip instantclient-sdk-linux.x64-12.2.0.1.0.zip

    unzip instantclient-sqlplus-linux.x64-12.2.0.1.0.zip

    unzip instantclient-basic-linux.x64-12.2.0.1.0.zip

    1.   cd instantclient12_2
      
    2.   sudo su -l root
      
    3.   yum install libaio (prompted that it is already installed)
      
    4.   sudo env LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2
      
    5.   export LD_LIBRARY_PATH
      
    6. sqlplus /

    7. sudo /opt/sensu/embedded/bin/gem install ruby-oci8

I very much appreciate your assistance

Regards,

Peter

On Wednesday, May 31, 2017 at 3:08:43 PM UTC+8, Eric Heydrick wrote:

When you run gem without the full path you get the system ruby. In this case it’s Ruby 1.8 which is end of life and you really don’t want to use it for performance and security reasons. Instead use the ruby that sensu ships as part of the omnibus package. To do that use the full path to the embedded gem command, /opt/sensu/embedded/bin/gem.

On Tue, May 30, 2017 at 11:36 PM, Peter Russy Alfafara peter.russ...@gmail.com wrote:

Hi Eric,

Thanks for the assistance!

I’ve followed the instructions in the link and I’m currently stuck at an error while I’m installing ruby:

#/home/oracle> sudo gem update

/usr/lib/ruby/site_ruby/1.8/rubygems.rb:11:in `require’: no such file to load – thread (LoadError)

from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:11

from /usr/bin/gem:8:in `require’

from /usr/bin/gem:8

``

Any ideas what’s causing this? Thank you for your prompt response btw :slight_smile:

Regards,

Peter

On Wednesday, May 31, 2017 at 12:16:37 PM UTC+8, Eric Heydrick wrote:

You should install the ruby-oci8 gem into the sensu embedded ruby. To do that run “/opt/sensu/embedded/bin/gem install ruby-oci8”. According to the docs you need the oracle client installed and to set an environment variable that points at the client installation.

On Tue, May 30, 2017 at 8:49 PM, Peter Russy Alfafara peter.russ...@gmail.com wrote:

Hi Eric,

It doesn’t seem to be installed in this directory.

#/opt/sensu/embedded/bin> /opt/sensu/embedded/bin/gem list | grep oci8

[oracle@otmdemox] -->orcl<-- 12R12

``

But I already installed it in the server using the following steps:

  1. download latest version from https://bintray.com/kubo/generic/ruby-oci8
  2. Move downloaded tar file to server using FileZilla
  3. Login to Server and go to directory where the tar is
  4. execute ‘gzip -dc ruby-oci8-2.2.3.tar.gz | tar xvf –‘
  5. execute ‘sudo su -l root’
  6. cd /home/oracle/ruby-oci8-2.2.3
  7. make
  8. make install

Are my installation steps incorrect?

Thank you again!

Regards,

Peter

On Saturday, May 27, 2017 at 1:06:05 AM UTC+8, Eric Heydrick wrote:

Do you have the oci8 gem installed in the sensu embedded ruby? Run /opt/sensu/embedded/bin/gem list | grep oci8 to make sure it’s there.

On Thu, May 25, 2017 at 11:15 PM, Peter Russy Alfafara peter.russ...@gmail.com wrote:

Hi Experts,

I would like to get your assistance on an issue I am experiencing.

I am customizing my own check that queries to an Oracle Database using Ruby DBI OCI8. I’ve installed this plugin in our centos server and tried to execute the following by calling it and it executes fine with the desired results.

#! /usr/bin/env ruby

require ‘rubygems’

require ‘oci8’

oci = OCI8.new(‘GLOGOWNER’,‘Sh#reit1’,‘192.168.30.223:1521/orcl’)

oci.exec(‘select shipment_gid, shipment_xid, servprov_gid from shipment where rownum <= 1’) do |record|

puts record.join(’,’)

end

``

result:

DEMO.01064,01064,DEMO.DB_SCHENKER

``

But, somehow when I’m calling this script in sensu using check config file, I get an error result

/etc/sensu/conf.d/check.json

{

“checks”: {

“sql_check”: {

“command”: “/opt/sensu/embedded/bin/dbconnect.rb”,

“interval”: 60,

“standalone”: true,

“handlers”: [“event_stream”, “email”],

“subscribers”: [ “ALL” ]

}

}

}

``

error output:
/opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- oci8 (LoadError) from /opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:inrequire’ from /opt/sensu/embedded/bin/dbconnect.rb:3:in `’

``

Hoping you can assist me on this matter. Thank you!

Regards,

Peter

Append the path of Oracle client libraries to LD_LIBRARY_PATH if Oracle Instant Client.

The ‘sudo’ command unset some environment variables for security reasons.

Pass required varialbes as follows

sudo env LD_LIBRARY_PATH=$LD_LIBRARY_PATH /opt/sensu/embedded/bin/gem install ruby-oci8

or

sudo env ORACLE_HOME=$ORACLE_HOME /opt/sensu/embedded/bin/gem install ruby-oci8

``

This tells you to append the library path.

    1.   sudo env LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2
      
  1.   export LD_LIBRARY_PATH
    

If I’m not mistaken though, you are replacing it here instead of appending another value to it.

···

On Wednesday, May 31, 2017 at 9:42:56 AM UTC+2, Peter Russy Alfafara wrote:

Hi All,

This has been resolved. Thank you very much for all your support! :slight_smile:

Regards,

Peter

···

On Wednesday, May 31, 2017 at 9:46:54 PM UTC+8, Alexander Skiba wrote:

On Wednesday, May 31, 2017 at 9:42:56 AM UTC+2, Peter Russy Alfafara wrote:

Append the path of Oracle client libraries to LD_LIBRARY_PATH if Oracle Instant Client.

The ‘sudo’ command unset some environment variables for security reasons.

Pass required varialbes as follows

sudo env LD_LIBRARY_PATH=$LD_LIBRARY_PATH /opt/sensu/embedded/bin/gem install ruby-oci8

or

sudo env ORACLE_HOME=$ORACLE_HOME /opt/sensu/embedded/bin/gem install ruby-oci8

``

This tells you to append the library path.

    1.   sudo env LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2
      
  1.   export LD_LIBRARY_PATH
    

If I’m not mistaken though, you are replacing it here instead of appending another value to it.