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

How to use the nagios monitoring plug-in nagios_oracle_health+check_linux_stats.pl

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

Share

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

This article is about how to use the nagios monitoring plug-in nagios_oracle_health+check_linux_stats.pl. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

one。 Install the nagios_oracle_health plug-in

Project address: https://labs.consol.de/nagios/check_mysql_health/

1. Check to see if the perl package is installed.

[root@DB02 ~] # rpm-qa | grep perl

Perl-Test-Simple-0.92-136.el6.x86_64

Perl-ExtUtils-MakeMaker-6.55-136.el6.x86_64

Perl-version-0.77-136.el6.x86_64

Perl-ExtUtils-ParseXS-2.2003.0-136.el6.x86_64

Perl-libs-5.10.1-136.el6.x86_64

Perl-5.10.1-136.el6.x86_64

Perl-CGI-3.51-136.el6.x86_64

Perl-devel-5.10.1-136.el6.x86_64

Perl-Pod-Escapes-1.04-136.el6.x86_64

Perl-Pod-Simple-3.13-136.el6.x86_64

Perl-Test-Harness-3.17-136.el6.x86_64

Perl-Module-Pluggable-3.90-136.el6.x86_64

[root@DB02] # perl-v

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

Copyright 1987-2009, Larry Wall

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

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

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

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

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

From the execution of the above two commands, you can see that the perl package is installed normally

two。 Install DBI

Tar-zxvf DBI-1.636.tar.gz

Cd DBI-1.636

Perl Makefile.PL

Make all

Make install

3. Install DBD-Oracle

Tar-zxvf DBD-Oracle-1.74.tar.gz

Cd DBD-Oracle-1.74

Perl Makefile.PL

The error in executing the command is as follows:

[root@DB01 DBD-Oracle-1.74] # perl Makefile.PL

Multiple copies of Driver.xst found in: / usr/local/lib64/perl5/auto/DBI/ / usr/lib64/perl5/auto/DBI/ at Makefile.PL line 39

Using DBI 1.636 (for perl 5.010001 on x86_64-linux-thread-multi) installed in / usr/local/lib64/perl5/auto/DBI/

Configuring DBD::Oracle for perl 5.010001 on linux (x86_64-linux-thread-multi)

Remember to actually * READ* the README file! Especially if you have any problems.

Trying to find an ORACLE_HOME

Your LD_LIBRARY_PATH env var is set to''

The ORACLE_HOME environment variable is not set and I couldn't guess it.

It must be set to hold the path to an Oracle installation directory

On this machine (or a machine with a compatible architecture).

See the appropriate README file for your OS for more information.

ABORTED!

Solution: add the following code to the bash_profile of root # here is the configuration of the environment variables of the database on the existing network

ORACLE_BASE=/u01/oracle/app

ORACLE_HOME=$ORACLE_BASE/product/11g/dbhome_1

ORACLE_SID=kdzfw

LD_LIBRARY_PATH=$ORACLE_HOME/lib

PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin:$ORACLE_HOME/OPatch

Export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH PATH

Source .bash _ profile

Re-execute the command perl Makefile.PL

Make all

Make install

Log in to the database, set up a nagios account, and grant some permissions.

Create user nagios identified by oradbmon;grant create session to nagios;grant select any dictionary to nagios;grant select on V_$SYSSTAT to nagios;grant select on V_$INSTANCE to nagios;grant select on V_$LOG to nagios;grant select on SYS.DBA_DATA_FILES to nagios;grant select on SYS.DBA_FREE_SPACE to nagios

4. Install check_oracle_health

Tar-zxvf check_oracle_health-2.1.3.5.tar.gz

Cd check_oracle_health-2.1.3.5

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

Make all

Make install

5. Run the test script with the oracle user: the following output indicates that the plug-in is working properly.

. / check_oracle_health-connect=orcl-username=nagios-password= oradbmon-mode=tnsping

OK-connection established to orcl.

6. Copy the environment variables under oracle to bash_profile under root, and execute source bash_profile to make the configuration take effect immediately.

7. Define a service on the monitored machine, monitor the tablespace, and configure monitoring commands in the client's nrpe.cfg.

Commanded [check _ tablespace] = / usr/local/nagios/libexec/check_oracle_health-- connect kdzfw-- username nagios-- password oradbmon-- warning 95-- critical 98-- mode tablespace-usage

Note: the dont_blame_nrpe=1 in the nrpe.cfg configuration file allows the command to be followed by some parameters.

Using a script to monitor the tablespace in a local test, the display is normal, as shown below:

[oracle@DB01 libexec] $/ usr/local/nagios/libexec/check_oracle_health-connect kdzfw-username nagios-password oradbmon-warning 95-critical 98-mode tablespace-usage

OK-tbs VIPC usage is 0.005%, tbs USERS usage is 0.90%, tbs UNDOTBS1 usage is 0.05%, tbs TEMP usage is 0.01%, tbs SYSTEM usage is 2.65%, tbs SYSAUX usage is 2.65%, tbs SPTESTREADER usage is 0.005%, tbs SPTESTIM usage is 0.36%, tbs MAINTAIN usage is 0.05%, tbs INDX usage is 29.67%, tbs BTEST usage is 51.32% | 'tbs_vipc_usage_pct'=0.00%;95;98' tbs_vipc_usage'=1MB;31129;32112 Tbs_undotbs1_usage_pct'=0.05%;95;98 32767 'tbs_vipc_alloc'=1024MB;;;0;32767' tbs_users_usage_pct'=0.90%;95;98 'tbs_users_usage'=294MB;31129;32112;0;32767' tbs_users_alloc'=310MB;;;0;32767 'tbs_undotbs1_usage_pct'=0.05%;95;98' tbs_undotbs1_usage'=16MB;31129;32112;0;32767 'tbs_undotbs1_alloc'=825MB;;;0;32767' tbs_temp_usage_pct'=0.01%;95 98 'tbs_temp_usage'=2MB;31129;32112;0;32767' tbs_temp_alloc'=1203MB;;;0;32767 'tbs_system_usage_pct'=2.65%;95;98' tbs_system_usage'=869MB;31129;32112;0;32767 'tbs_system_alloc'=930MB;;;0;32767' tbs_sysaux_usage_pct'=2.65%;95;98 'tbs_sysaux_usage'=867MB;31129;32112;0;32767' tbs_sysaux_alloc'=920MB;;;0 32767 'tbs_sptestreader_usage_pct'=0.00%;95;98' tbs_sptestreader_usage'=1MB;31129;32112;0;32767 'tbs_sptestreader_alloc'=1024MB;;;0;32767' tbs_sptestim_usage_pct'=0.36%;95;98 'tbs_sptestim_usage'=119MB;31129;32112;0;32767' tbs_sptestim_alloc'=1024MB;;;0;32767 'tbs_maintain_usage_pct'=0.05%;95;98' tbs_maintain_usage'=1MB;1945;2007;0 2048 'tbs_maintain_alloc'=1024MB;;;0;2048' tbs_indx_usage_pct'=29.67%;95;98 'tbs_indx_usage'=9721MB;31129;32112;0;32767' tbs_indx_alloc'=11024MB;;;0;32767 'tbs_btest_usage_pct'=51.32%;95;98' tbs_btest_usage'=50451MB;93388;96337;0;98303 'tbs_btest_alloc'=71680MB;;;0;98303

8. The server uses nagiosql management tools, in which the corresponding services are configured.

The effect shown by 9.nagios:

two。 Install check_linux_stats.pl script

1. Install perl-UNIVERSAL-require-0.13-1.el6.rf.noarch.rpm first, here is the rpm package.

[root@DB02 huaxia] # rpm-ivh perl-UNIVERSAL-require-0.13-1.el6.rf.noarch.rpm

Warning: perl-UNIVERSAL-require-0.13-1.el6.rf.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 6b8d79e6: NOKEY

Preparing... # [100%]

1:perl-UNIVERSAL-require # # [100%]

[root@DB02 huaxia] # rpm-qa | grep perl-UNIVERSAL-require

Perl-UNIVERSAL-require-0.13-1.el6.rf.noarch

two。 Install Sys-Statistics-Linux

Tar-zxvf Sys-Statistics-Linux-0.66.tar.gz

Cd Sys-Statistics-Linux-0.66

[root@DB02 Sys-Statistics-Linux-0.66] # perl Makefile.PL

Checking if your kit is complete...

Looks good

Warning: prerequisite Time::HiRes 0 not found.# error!

Writing Makefile for Sys::Statistics::Linux

Solution: yum-y install perl-Time-HiRes

Re-execute:

[root@DB02 Sys-Statistics-Linux-0.66] # perl Makefile.PL

Writing Makefile for Sys::Statistics::Linux

Make all

Make install

3. Download the check_linux_stats.pl monitoring script and put it in the plug-in directory of / usr/local/nagios/libexec

Execute. / check_linux_stats.pl, and you can see that the script can monitor many parameters.

[oracle@DB02 libexec] $. / check_linux_stats.pl-- help

Check_linux_stats v1.3.1

Usage:. / check_linux_stats.pl-C |-P |-M |-N |-D |-I |-L |-F |-S |-W |-U-p-w-c [- s] [- u] [- V] [- h]

-h,-- help

Print this help message

-C,-- cpu=CPU USAGE

-P,-- procs

-M,-- memory=MEMORY USAGE

-N,-- network=NETWORK USAGE

-D,-- disk=DISK USAGE

-I-- io=DISK IO USAGE

-L-- load=LOAD AVERAGE

-F,-- file=FILE STATS

-S,-- socket=SOCKET STATS

-W,-- paging=PAGING AND SWAPPING STATS

-U-- uptime

-p,-- pattern

Eth0,eth2...sda1,sda2.../usr,/tmp

-W,-- warning

-c,-- critical

-s-- sleep

-u,-- unit

%, KB, MB or GB left on disk usage, default: MB

REQS OR BYTES on disk io statistics, default: REQS

-V-- version

Version number

Ex:

Memory usage: perl check_linux_stats.pl-M-w 90-c 95

Cpu usage: perl check_linux_stats.pl-C-w 90-c 95-s 5

Disk usage: perl check_linux_stats.pl-D-w 95-c 100-u%-p / tmp,/usr,/var

Load average: perl check_linux_stats.pl-L-w 10pr 8pr 5-c 20je 18jr 15

Paging statistics: perl check_linux_stats.pl-W-w 10pm 1000-c 20pm 2000-s 3

Process statistics: perl check_linux_stats.pl-P-w 100-c 200

I statistics on disk device: perl check_linux_stats.pl-I-w 10-c 5-p sda1,sda4,sda5,sda6

Network usage: perl check_linux_stats.pl-N-w 10000-c 100000000-p eth0

Processes virtual memory: perl check_linux_stats.pl-T-w 9551820-c 9551890-p / var/run/sendmail.pid

Uptime: perl check_linux_stats.pl-U-w 5

[oracle@DB02 libexec] $. / check_linux_stats.pl-M-w 90-c 9printer tested the lower memory and showed normal.

MEMORY CRITICAL: Mem used: 97.96%, Swap used: 0.96% | MemUsed=97.96%;90;95 SwapUsed=0.96;; MemCached=91.65 SwapCached=0.21 Active=60.85

4. Add several monitoring services to the client's nrpe.cfg.

Commanded [check _ HA_servhamachine] = / usr/local/nagios/libexec/check_procs-w $ARG1 $- c $ARG2 $- C $ARG3 $

Commanded [check _ linux_stats_root] = / usr/local/nagios/libexec/check_linux_stats.pl-D-w $ARG1 $- c $ARG2 $- p $ARG3 $

Commander [check _ linux_stats_load] = / usr/local/nagios/libexec/check_linux_stats.pl-L-w $ARG1 $- c $ARG2 $

Commanded [check _ linux_stats_cpu] = / usr/local/nagios/libexec/check_linux_stats.pl-C-w $ARG1 $- c $ARG2 $- s $ARG3 $

Commander [check _ linux_stats_mem] = / usr/local/nagios/libexec/check_linux_stats.pl-M-w $ARG1 $- c $ARG2 $

5. The server uses nagiosql, so add these monitoring items in it.

The display effect of the 6.nagios server.

Thank you for reading! This is the end of this article on "how to use the nagios monitoring plug-in nagios_oracle_health+check_linux_stats.pl". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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

Development

Wechat

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

12
Report