在客户端
一,配置zabbix_agentd,参考文档《zabbix客户端安装》
创建ORACLE 监控账户
1.登录ORACLE 命令行
su– oracale
sqlplus/ as sydba
selectinstance_name from v$instance; # 查看实例
2、创建用户
CREATE USER C##ZABBIX
IDENTIFIED BY ZABBIX
DEFAULT TABLESPACE SYSTEM
TEMPORARY TABLESPACE TEMP
PROFILE DEFAULT
ACCOUNT UNLOCK;
3、赋予角色权限
GRANT CONNECT TO C##ZABBIX;
GRANT RESOURCE TO C##ZABBIX;
ALTER USER C##ZABBIX DEFAULT ROLE ALL;
4、赋予系统权限
GRANT SELECT ANY TABLE TO C##ZABBIX;
GRANT CREATE SESSION TO C##ZABBIX;
GRANT SELECT ANY DICTIONARY TO C##ZABBIX;
GRANT UNLIMITED TABLESPACE TO C##ZABBIX;
GRANT SELECT ANY DICTIONARY TO C##ZABBIX;
启动oracle监听
[oracle@oracle-test ~]$ lsnrctl
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 24-FEB-2017 00:50:24
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> start
Starting /opt/oracle/112/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 12.1.0.2.0 - Production
System parameter file is /opt/oracle/112/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/oracle-test/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.244.156)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.244.156)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 24-FEB-2017 00:50:27
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/112/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/oracle-test/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.244.156)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.244.156)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 24-FEB-2017 00:50:27
Uptime 0 days 0 hr. 2 min. 7 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/112/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/oracle-test/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.244.156)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=oracle-test)(PORT=5500))(Security=(my_wallet_directory=/opt/oracle/admin/orcl/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "pdborcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handle
[root@oracle-test ~]# netstat -nutpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 192.168.244.156:1521 0.0.0.0:* LISTEN 3763/tnslsnr
LISTEN 2104/master
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 2147/zabbix_agentd
服务端配置
安装并配置jdk环境变量
[root@zabbix ~]# vim .bash_profile
export PATH
export JAVA_HOME=/jdk/jdk1.7.0_79
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
[root@zabbix ~]# source .bash_profile
二,创建目录及监控信息
1)创建目录并解压插件
[root@zabbix Desktop]# mkdir /opt/orabbix
[root@zabbix Desktop]# mv orabbix-1.2.3.zip /opt/orabbix
[root@zabbix Desktop]# ls /opt/orabbix/
orabbix-1.2.3.zip
[root@zabbix Desktop]# cd /opt/orabbix/
[root@zabbix orabbix]# unzip orabbix-1.2.3.zip
2)授予文件可执行的权限
[root@zabbix orabbix]# chmod a+x /opt/orabbix -R
3)创建一个名为config.props文件,有模板可以参考
[root@zabbix orabbix]# cp /opt/orabbix/conf/config.props.sample config.props
4)修改confi.props配置文件,仅需修改如下内容即可。
[root@zabbix conf]# pwd
/opt/orabbix/conf
[root@zabbix conf]# vim config.props
#comma separed list of Zabbix servers
ZabbixServerList=zabbix ---以下三处要一致
zabbix.Address=192.168.244.155
zabbix.Port=10051
#pidFile
OrabbixDaemon.PidFile=./logs/orabbix.pid
#frequency of item's refresh
OrabbixDaemon.Sleep=300
#MaxThreadNumber should be >= than the number of your databases
OrabbixDaemon.MaxThreadNumber=100
#put here your databases in a comma separated list
DatabaseList=oracle-test -----随便填,但是必须与下面涉及到的名称一致,如粗体字部分
#Configuration of Connection pool
#if not specified Orabbis is going to use default values (hardcoded)
#Maximum number of active connection inside pool
DatabaseList.MaxActive=10
#The maximum number of milliseconds that the pool will wait
#(when there are no available connections) for a connection to be returned
#before throwing an exception, or <= 0 to wait indefinitely.
DatabaseList.MaxWait=100
DatabaseList.MaxIdle=1
#define here your connection string for each database
oracle-test.Url=jdbc:oracle:thin:@192.168.244.156:1521:orcl ----客户端的IP及实例名
oracle-test.User=c##zabbix ----数据库的用户
oracle-test.Password=zabbix ------数据库的密码
#Those values are optionals if not specified Orabbix is going to use the general values
oracle-test.MaxActive=10
oracle-test.MaxWait=100
oracle-test.MaxIdle=1
oracle-test.QueryListFile=./conf/query.props
5)设置启动脚本
[root@zabbix ~]# cp /opt/orabbix/init.d/orabbix /etc/init.d/orabbix
[root@zabbix ~]# chmod +x /etc/init.d/orabbix
[root@zabbix ~]# chkconfig orabbix on
6)启动服务的时候可能会报错
[root@zabbix ~]# /etc/init.d/orabbix restart
Stopping Orabbix service:cat: /opt/orabbix/logs/orabbix.pid: No such file or directory
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
Starting Orabbix service:
[root@zabbix ~]# /opt/orabbix/run.sh: line 1: java: command not found
解决办法:[root@zabbix ~]# touch /opt/orabbix/logs/orabbix.pid
[root@zabbix ~]# vim /opt/orabbix/run.sh
把里面的java替换成/jdk/jdk1.7.0_79/bin/java
重新启动[root@zabbix ~]# /etc/init.d/orabbix start
Starting Orabbix service:
OK,按以上的步骤,这样的话,Orabbix服务器端就配置完成啦~~现在去zabbix的WEB页面去导入ORACLE的监测模板吧,在orabbix目录的template内,只要在configurationàTemplatesàImport Template,然后选中/opt/orabbix/template/Orabbix_export_full.xml就OK啦~~