Orabbix安装帮助文档
安装和使用
本文记录了在使用Orabbix1.2.3安装过程中遇到的问题和解决方法,安装过程中主要参考了渣渣辉大佬的博文,实现的是对单实例的监控。Zabbix利用Orabbix监控Oracle。
试验环境
整个试验环境分为以下几个部分:
- zabbix ,使用的是3.4.15;
- orabbix,使用的是orabbix1.2.3,orabbix和zabbix-server安装在同一台服务器上,下载地址:http://www.smartmarmot.com/product/orabbix/download/;
- oracle,使用的是oracle11g;
-
网络环境:
在zabbix-server上安装orabbix
Orabbix通过JDBC链接Oracle数据库,需要jdk环境,因为我的centos7自带了jdk1.8,跳过了这个步骤。如果没有jdk环境可以下载rpm包或者yum安装。
[root@zabbix-server ~]# java -version
openjdk version "1.8.0_102"
OpenJDK Runtime Environment (build 1.8.0_102-b14)
OpenJDK 64-Bit Server VM (build 25.102-b14, mixed mode)
具体安装步骤可以参考渣渣辉的帖子,下面是我的config.props配置
[root@zabbix-server conf]# cat config.props
#comma separed list of Zabbix servers
#ZabbixServerList=ZabbixServer1,ZabbixServer2
ZabbixServerList=ZabbixServer1
ZabbixServer1.Address=192.168.31.111
ZabbixServer1.Port=10051
#ZabbixServer2.Address=IP_ADDRESS_OF_ZABBIX_SERVER
#ZabbixServer2.Port=PORT_OF_ZABBIX_SERVER
#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=DB1,DB2,DB3
DatabaseList=192.168.31.250oracle
#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
192.168.31.250oracle.Url=jdbc:oracle:thin:@192.168.31.250:1521:orcl
192.168.31.250oracle.User=zabbix
192.168.31.250oracle.Password=zabbix
#Those values are optionals if not specified Orabbix is going to use the general values
192.168.31.250oracle.MaxActive=10
192.168.31.250oracle.MaxWait=100
192.168.31.250oracle.MaxIdle=1
192.168.31.250oracle.QueryListFile=./conf/query.props
#DB2.Url=jdbc:oracle:thin:@server2.domain.example.com:<LISTENER_PORT>:DB2
#DB2.User=zabbix
#DB2.Password=zabbix_password
#DB2.QueryListFile=./conf/query.props
#DB3.Url=jdbc:oracle:thin:@server3.domain.example.com:<LISTENER_PORT>:DB3
#DB3.User=zabbix
#DB3.Password=zabbix_password
#DB3.QueryListFile=./conf/query.props
遇到的问题和解决方法
orabbix服务启动报错1:orabbix的日志显示
[root@zabbix-server orabbix]# tailf /opt/orabbix/logs/orabbix.log
2020-04-03 00:17:20,455 [main] INFO Orabbix - maxIdleSize=1
2020-04-03 00:17:20,455 [main] INFO Orabbix - maxIdleTime=1800000ms
2020-04-03 00:17:20,455 [main] INFO Orabbix - poolTimeout=100
2020-04-03 00:17:20,455 [main] INFO Orabbix - timeBetweenEvictionRunsMillis=-1
2020-04-03 00:17:20,455 [main] INFO Orabbix - numTestsPerEvictionRun=3
2020-04-03 00:17:25,981 [main] ERROR Orabbix - Error on Configurator for database 192.168.31.250oracle -->IO Error:The Network Adapter could not establish the connection
2020-04-03 00:17:25,982 [main] INFO Orabbix - This Database 192.168.31.250oracle removed
2020-04-03 00:17:25,982 [main] ERROR Orabbix - ERROR on main - Connections is empty
故障原因:oracle监听服务没建立起链接,oracle和server网络不通,ping了一下果然不通。重新设置了oracle服务器和server服务器的网络,再启动。
orabbix服务启动报错2:日志显示
[root@zabbix-server orabbix]# systemctl restart orabbix
[root@zabbix-server orabbix]# tailf /opt/orabbix/logs/orabbix.log
2020-04-03 00:17:20,455 [main] INFO Orabbix - maxIdleTime=1800000ms
2020-04-03 00:17:20,455 [main] INFO Orabbix - poolTimeout=100
2020-04-03 00:17:20,455 [main] INFO Orabbix - timeBetweenEvictionRunsMillis=-1
2020-04-03 00:17:20,455 [main] INFO Orabbix - numTestsPerEvictionRun=3
2020-04-03 00:17:25,981 [main] ERROR Orabbix - Error on Configurator for database 192.168.31.250oracle -->ORA-01033: ORACLE initialization or shutdown in progress
2020-04-03 00:17:25,982 [main] INFO Orabbix - This Database 192.168.31.250oracle removed
2020-04-03 00:17:25,982 [main] ERROR Orabbix - ERROR on main - Connections is empty
这个报错与启动报错1现象类似,但至少链接建立起来了。只是初始化没完成,可能是域名没解析出来。
查了一下oracle服务器和server服务器的解析文件,果然如此:
先看看resolv.conf文件
[root@zabbix-server orabbix]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 202.103.24.68
再看看网卡文件
[root@zabbix-server network-scripts]# cat ifcfg-ens160
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens160
UUID=a3bc4f8e-0b19-4acf-a066-a30490616cfc
DEVICE=ens160
ONBOOT=yes
DNS1=202.103.24.68
IPADDR=192.168.31.111
PREFIX=24
GATEWAY=192.168.31.1
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_PRIVACY=no
OK,把本地的域名都加上
resolv.conf
[root@zabbix-server orabbix]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 202.103.24.68
nameserver 192.168.31.1
nameserver 114.114.114.114
网卡文件
[root@zabbix-server network-scripts]# cat ifcfg-ens160
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens160
UUID=a3bc4f8e-0b19-4acf-a066-a30490616cfc
DEVICE=ens160
ONBOOT=yes
DNS1=202.103.24.68
DNS2=192.168.31.1
DNS3=114.114.114.114
DNS4=8.8.8.8
IPADDR=192.168.31.111
PREFIX=24
GATEWAY=192.168.31.1
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_PRIVACY=no
再次启动Orabbix
启动成功的提示
2020-04-03 00:32:53,490 [main] INFO Orabbix - Starting Orabbix Version 1.2.3
2020-04-03 00:32:58,533 [main] INFO Orabbix - Orabbix started with pid:6036
2020-04-03 00:32:58,533 [main] INFO Orabbix - PidFile -> ./logs/orabbix.pid
2020-04-03 00:32:58,649 [main] INFO Orabbix - DB Pool created: org.apache.commons.dbcp.datasources.SharedPoolDataSource@1963006a
2020-04-03 00:32:58,649 [main] INFO Orabbix - URL=jdbc:oracle:thin:@192.168.31.250:1521:orcl
2020-04-03 00:32:58,649 [main] INFO Orabbix - maxPoolSize=10
2020-04-03 00:32:58,649 [main] INFO Orabbix - maxIdleSize=1
2020-04-03 00:32:58,649 [main] INFO Orabbix - maxIdleTime=1800000ms
2020-04-03 00:32:58,649 [main] INFO Orabbix - poolTimeout=100
2020-04-03 00:32:58,649 [main] INFO Orabbix - timeBetweenEvictionRunsMillis=-1
2020-04-03 00:32:58,649 [main] INFO Orabbix - numTestsPerEvictionRun=3
2020-04-03 00:33:11,469 [main] INFO Orabbix - Connected as ZABBIX
2020-04-03 00:33:11,478 [main] INFO Orabbix - --------- on Database -> orcl
2020-04-03 00:33:14,776 [pool-1-thread-1] INFO Orabbix - Done with dbJob on database 192.168.31.250oracle QueryList elapsed time 2983 ms
2020-04-03 00:34:11,818 [pool-1-thread-2] INFO Orabbix - Done with dbJob on database 192.168.31.250oracle QueryList elapsed time 16 ms