監控 Oracle DB Server
特點:
系統需求:
參閱這篇 SSH 加密連線(免密碼登入)。
上傳附件檔 check_remote_oracle 至 Nagios 主機上的目錄 /usr/lib64/nagios/plugins/。
chmod 0755 /usr/lib64/nagios/plugins/check_remote_oracle
測試 DB 監控
# su - nagios -c "/usr/lib64/nagios/plugins/check_remote_oracle -H oracle_server.mycompany.com --tns ORCL" OK - reply time 0 msec from ORCL # su - nagios -c "/usr/lib64/nagios/plugins/check_remote_oracle -H oracle_server.mycompany.com --db ORCL" ORCL OK - 1 PMON process(es) running # su - nagios -c "/usr/lib64/nagios/plugins/check_remote_oracle -H oracle_server.mycompany.com --cache ORCL 90 95" ORCL OK - Cache Hit Rates: 99.86% Lib -- 99.49% Buff|lib=99.86%;95;90;0;100 buffer=99.49%;95;90;0;100 # su - nagios -c "/usr/lib64/nagios/plugins/check_remote_oracle -H oracle_server.mycompany.com --tablespace ORCL SYSTEM 95 90" ORCL : SYSTEM CRITICAL - 97.60% used [ 22 / 900 MB available ]|SYSTEM=97.60%;90;95;0;100
NOTE:
* plugin 目錄可能因為版本不同,路徑也會不同。
* ORCL 是 Oracle SID ,有區分大小寫
編輯 commands.cfg
# Check Oracle define command{ command_name check_ora_tns command_line $USER1$/check_remote_oracle -H $HOSTADDRESS$ --tns $ARG1$ } define command{ command_name check_ora_db command_line $USER1$/check_remote_oracle -H $HOSTADDRESS$ --db $ARG1$ }
NOTE:
$USER1$ 路徑必須與儲存 check_remote_oracle 位置相同,這個路徑定義在 resource.cfg
編輯 server.cfg
## Host define host{ use generic-host ; Name of host template to use host_name fdc_db01 alias ODD DB Server(Oracle) address 192.168.200.230 check_command check-host-alive max_check_attempts 10 check_period 24x7 notification_interval 120 notification_period 24x7 notification_options d,r contact_groups adm-alang notifications_enabled 1 ;0=disable, 1=enable process_perf_data 0 } ## Service define service{ use generic-service host_name fdc_db01 service_description Oracle-TNS-oddfdc contact_groups adm-alang notifications_enabled 1 check_command check_ora_tns!oddfdc } define service{ use generic-service host_name fdc_db01 service_description Oracle-DB-oddfdc contact_groups adm-alang notifications_enabled 1 check_command check_ora_db!oddfdc }
NOTE:
oddfdc 是要被監控的 Oracle SID,有區分大小寫
A: Oracle DB 主機檢查 /etc/oratab,是否有包含這行文字
# $ORACLE_SID:$ORACLE_HOME:<N|Y> oddmes:/opt/oracle/product/10.2.0/db_1:N
執行 check_remote_oracle -H 123.123.123.123 --tns oddmes 出現錯誤
A:
1. 從 Oracle DB 主機執行
su - oracle tnsping <my-sid>
2. Oracle DB 主機檢查 $ORACLE_HOME/network/admin/tnsnames.ora,如沒有必須加上,內容參考如下
ODDMES = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = tycoddovm-db02.my.domain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = oddmes) ) )
Images 0 | ||
---|---|---|
No images to display in the gallery. |