Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Check_oracle_health Monitoring oracle

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

I. preparatory work

1. Create a user on the database and grant permissions (DBA cooperate with operation; user, password to be determined; only monitor native database TNS, SID)

CREATE USER nagios IDENTIFIED BY XXXX

GRANT CREATE SESSIONTO nagios

GRANT SELECT anydictionary TO nagios

GRANT SELECT ONV_$SYSSTAT TO nagios

GRANT SELECT ONV_$INSTANCE TO nagios

GRANT SELECT ON V_$LOGTO nagios

GRANT SELECT ONSYS.DBA_DATA_FILES TO nagios

GRANT SELECT ONSYS.DBA_FREE_SPACE TO nagios

GRANT SELECT ONsys.dba_tablespaces TO nagios

GRANT SELECT ONdba_temp_files TO nagios

GRANT SELECT ONsys.v_$Temp_extent_pool TO nagios

GRANT SELECT ONsys.v_$TEMP_SPACE_HEADER TO nagios

GRANT SELECT ONsys.v_$session TO nagios

two。 Add nagios to the oinstall group

Usermod-a-G oinstall nagios

Second, check to see if perl is installed under monitoring. And the monitored computer installs DBI and DBD.

1. [root@D-MDB-90] # perl-v

This is perl, v5.10.1 (*) built forx86_64-linux-thread-multi

Copyright 1987-2009, Larry Wall

Perl may be copied only under theterms of either the Artistic License or the

GNU General Public License, which maybe found in the Perl 5 source kit.

Complete documentation for Perl,including FAQ lists, should be found on

This system using "manperl" or "perldoc perl". If you have access to the

Internet, point your browser at http://www.perl.org/, the Perl Home Page.

two。 Download DBI

Wget http://www.cpan.org/authors/id/T/TI/TIMB/DBI-1.636.tar.gz

3. Decompress DBI

[root@D-MDB-90 src] # tar zxvf DBI-1.636.tar.gz

4. Install DBI

[root@D-MDB-90 src] # cd DBI-1.636

[root@D-MDB-90 DBI-1.636] # perlMakefile.PL

[root@D-MDB-90 DBI-1.636] # make all

[root@D-MDB-90 DBI-1.636] # make install

5. Download and install DBD-Oracle

[root@D-MDB-90 src] # wget http://mirrors.neusoft.edu.cn/cpan/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.74.tar.gz

[root@D-MDB-90 src] # tar zxvf DBD-Oracle-1.74.tar.gz

[root@D-MDB-90 src] # cd DBD-Oracle-1.74

[root@D-MDB-90DBD-Oracle-1.74] # perl Makefile.PL

6. Installation errors will be encountered here

Switch to oracle user: su-oracle

View the ORACLE_HOME path: echo $ORACLE_HOME

[root@D-MDB-90libexec] # echo $ORACLE_HOME / oracle/app/oracle/products/11.2.0.3/db # remember this oracle_home environment

7. Switch back to root:ctrl+d or su-root to set the environment variable [root@D-MDB-90DBD-Oracle-1.74] # export ORACLE_HOME=/oracle/app/oracle/products/11.2.0.3/db

[root@D-MDB-90 DBD-Oracle-1.74] # perl Makefile.PL

[root@D-MDB-90DBD-Oracle-1.74] # make & & make install

Download and install check_oracle_health

1. [root@D-MDB-90 src] # wget https://labs.consol.de/assets/downloads/nagios/check_oracle_health-2.1.3.5.tar.gz

2. [root@D-MDB-90 src] # tar-zxvfcheck_oracle_health-2.1.3.5.tar.gz

3. [root@D-MDB-90 src] # cd check_oracle_health-2.1.3.5

4. / configure-- prefix=/usr/local/nagios--with-nagios-user=nagios-- with-nagios-group=nagios--with-mymodules-dir=/usr/local/nagios/libexec-- with-mymodules-dyndir=/usr/local/nagios/libexec

5. [root@D-MDB-90 src] make all

6. [root@D-MDB-90 src] make install

7.chown nagios:nagios/usr/local/nagios/libexec/check_oracle_health

8.chmod 775/usr/local/nagios/libexec/check_oracle_health

IV. Testing

1. Execute the command after installation: / usr/local/nagios/libexec/check_oracle_health-- connect=oracle_SID-- user=oracle user-- password=oracle user password-- mode=connected-users

If the prompt is wrong: such as

Solution:

[root@D-MDB-90libexec] # ldd / usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so (missing file path for installation)

No libclntsh.so.11.1 found.

[root@D-MDB-90libexec] # locate libclntsh.so.11.1

[root@D-MDB-90 libexec] # ln-s / oracle/app/oracle/products/11.2.0.3/db/lib/libclntsh.so.11.1 (spaces) / lib/libclntsh.so.11.1

[root@D-MDB-90 libexec] # vim / etc/ld.so.conf

Add

Include ld.so.conf.d/*.conf

/ oracle/app/oracle/products/11.2.0.3/db/lib # the path here is related to the path of libclntsh.so.11.1

[root@D-MDB-90 libexec] # ldconfig

[root@D-MDB-90 libexec] # ldd/usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so

2. [root@D-MDB-90 libexec] # / usr/local/nagios/libexec/check_oracle_health-connect=pomoho-user=nagios-password=oradbmon-mode=tnsping

Results output OK-connection established to pomoho.

3. Modify / usr/local/nagios/etc/nrpe.cfg

Add the IP of the local machine and the monitoring host after the allowed_hosts

Finally, add a command [check _ oracle_health] = / usr/local/nagios/libexec/check_oracle_health-- connect=oracle_SID-- user=oracle user-- password=oracle user password-- mode=tnsping

4. Restart nrpe

5./usr/local/nagios/libexec/check_nrpe-H your monitored computer IP address-c check_oracle_health

If the result is also OK-connectionestablished to pomoho, then OK

5. Modify the / usr/local/nagios/etc/objects/services.cfg of the monitoring host

Add

# XX-XXX-XXcheck_oracle_health##

Define service {

Host_name XX-XXX-XX

Service_description check_oracle_health_tnsping

Check_command check_nrpe!check_oracle_health

Max_check_attempts 5

Normal_check_interval 5

Retry_check_interval 2

Check_period 24x7

Notification_interval 10

Notification_period 24x7

Notification_options w,u,c,r

Contact_groups yunwei

}

Check if the configuration is correct / usr/local/nagios/bin/nagios-v / usr/local/nagios/etc/nagios.cfg

Reload nagios: service nagios reload

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report