標籤:賦權 group inux 1.2 roc login dir $1 jobs
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 sysdbasqlplus> create user check_mk identified by secret_password;sqlplus> grant select_catalog_role to check_mk;sqlplus> connect check_mk/secret_passwordsqlplus> 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 sysasmsqlplus> 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=$1if [ -z "$ORACLE_SID" ] ; then echo "Usage: $0 ORACLE_SID" >&2 exit 1fisu - oracle -c "ORACLE_SID=$ORACLE_SIDORAENV_ASK=NOsource /home/oracle/.bash_profilesqlplus -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:portASMUSER=check_mk:passwordDBUSER=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.oraLOG_DIRECTORY_CLIENT = /var/log/check_mk/oracle_clientDIAG_ADR_ENABLED = OFFSQLNET.WALLET_OVERRIDE = FALSEWALLET_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 -texport 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.2The Oracle base remains unchanged with value /u01/app/oracleLogin ok User: CHECK_MK on datahis
出現Login ok 字樣,說明配置成功了
7、許可權設定:
chmod 700 /etc/check_mk/sqlplus.shchmod 600 /etc/check_mk/mk_oracle.cfgchown oracle.root /etc/check_mk/sqlplus.sh /etc/check_mk/mk_oracle.cfg
check mk 監控 oracle