check mk 监控 oracle

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了check mk 监控 oracle相关的知识,希望对你有一定的参考价值。

1、安装新版check_mk_agent,1.2.5i7版本以上并确定mk_oracle脚本已经安装完毕

从服务器端拷贝mk_oracle脚本到目标服务器

cp /usr/share/check-mk-agent/plugins/mk_oracle /usr/lib/check_mk_agent/plugins/
ls -lth /usr/lib/check_mk_agent/plugins/mk_oracle

2、数据库对check_mk用户赋权:
(1)授予select_catalog_role to check_mk

[email protected]# su - oracle
[email protected]:~> export ORACLE_SID=<SID of an Instance>
[email protected]:~> sqlplus / as sysdba
sqlplus> create user check_mk identified by secret_password;
sqlplus> grant select_catalog_role to check_mk;
sqlplus> connect check_mk/secret_password
sqlplus> exit
[email protected]:~> export ORACLE_SID=<SID of an Instance>

(2)ASM相关

[email protected]# su - oracle
[email protected]:~> ps ax | grep pmon | grep ASM
[email protected]:~> export ORACLE_SID=+ASM1
[email protected]:~> sqlplus / as sysasm
sqlplus> create user check_mk identified by secret_password;
sqlplus> grant sysdba to check_mk;
sqlplus> exit

3、修改/etc/check_mk/sqlplus.sh文件
vi /etc/check_mk/sqlplus.sh
修改为:

ORACLE_SID=$1
if [ -z "$ORACLE_SID" ] ; then
    echo "Usage: $0 ORACLE_SID" >&2
    exit 1
fi

su - oracle -c "
ORACLE_SID=$ORACLE_SID
ORAENV_ASK=NO
source /home/oracle/.bash_profile
sqlplus -s check_mk/password"

4、编辑/etc/check_mk/mk_oracle.cfg文件
vi /etc/check_mk/mk_oracle.cfg
添加:

#ASMUSER=check_mk:password:sysdba:hostname:port
#DBUSER=check_mk:password:sysdba:hostname:port
ASMUSER=check_mk:password
DBUSER=check_mk:password

拷贝tns文件到/etc/check_mk
cp /u01/app/oracle/11.2.0/dbhome_1/network/admin/tnsnames.ora /etc/check_mk/

5、编辑/etc/check_mk/sqlnet.ora

vi /etc/check_mk/sqlnet.ora
LOG_DIRECTORY_CLIENT = /var/log/check_mk/oracle_client
DIAG_ADR_ENABLED = OFF

SQLNET.WALLET_OVERRIDE = FALSE
WALLET_LOCATION =
 (SOURCE=
  (METHOD = FILE)
  (METHOD_DATA = (DIRECTORY=/etc/check_mk/oracle_wallet))
 )

6、执行验证语句:

export MK_CONFDIR="/etc/check_mk";/usr/lib/check_mk_agent/plugins/mk_oracle -t

export MK_CONFDIR="/etc/check-mk-agent";/usr/share/check-mk-agent/plugins/mk_oracle -t

输出:
[[email protected] check_mk]# export MK_CONFDIR="/etc/check_mk";/usr/lib/check_mk_agent/plugins/mk_oracle -t

<<<oracle_instance>>>
<<<oracle_sessions>>>
<<<oracle_logswitches>>>
<<<oracle_undostat>>>
<<<oracle_recovery_area>>>
<<<oracle_processes>>>
<<<oracle_recovery_status>>>
<<<oracle_longactivesessions>>>
<<<oracle_dataguard_stats>>>
<<<oracle_performance>>>
<<<oracle_tablespaces>>>
<<<oracle_rman>>>
<<<oracle_jobs>>>
<<<oracle_ts_quotas>>>
<<<oracle_resumable>>>
<<<oracle_locks>>>
<<<oracle_instance>>>
<<<oracle_asm_diskgroup>>>
-----------------------------------------------
Logincheck to Instance: hisdb  Version: 11.2
The Oracle base remains unchanged with value /u01/app/oracle
Login ok User: CHECK_MK on datahis

出现Login ok 字样,说明配置成功了

7、权限设定:

chmod 700 /etc/check_mk/sqlplus.sh
chmod 600 /etc/check_mk/mk_oracle.cfg
chown oracle.root /etc/check_mk/sqlplus.sh /etc/check_mk/mk_oracle.cfg

以上是关于check mk 监控 oracle的主要内容,如果未能解决你的问题,请参考以下文章

check mk 监控 jvm

check mk 监控 nginx

check mk 监控 HP服务器

1OMD安装(check mk+nagios+...) ,版本:RHEL7+OMD1.2.4p5

nagios监控插件 nagios_oracle_health+check_linux_stats.pl

OMD安装(check_mk+nagios+...)