AI智能
改变未来

Orabbix配合Zabbix实现对Oracle的实例监控

Orabbix安装帮助文档

  • 安装和使用
  • 试验环境
  • 在zabbix-server上安装orabbix
  • 遇到的问题和解决方法
  • 再次启动Orabbix

安装和使用

本文记录了在使用Orabbix1.2.3安装过程中遇到的问题和解决方法,安装过程中主要参考了渣渣辉大佬的博文,实现的是对单实例的监控。Zabbix利用Orabbix监控Oracle。

试验环境

整个试验环境分为以下几个部分:

  1. zabbix ,使用的是3.4.15;
  2. orabbix,使用的是orabbix1.2.3,orabbix和zabbix-server安装在同一台服务器上,下载地址:http://www.smartmarmot.com/product/orabbix/download/;
  3. oracle,使用的是oracle11g;
  4. 网络环境

在zabbix-server上安装orabbix

Orabbix通过JDBC链接Oracle数据库,需要jdk环境,因为我的centos7自带了jdk1.8,跳过了这个步骤。如果没有jdk环境可以下载rpm包或者yum安装。

[root@zabbix-server ~]# java -versionopenjdk 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,ZabbixServer2ZabbixServerList=ZabbixServer1ZabbixServer1.Address=192.168.31.111ZabbixServer1.Port=10051#ZabbixServer2.Address=IP_ADDRESS_OF_ZABBIX_SERVER#ZabbixServer2.Port=PORT_OF_ZABBIX_SERVER#pidFileOrabbixDaemon.PidFile=./logs/orabbix.pid#frequency of item\'s refreshOrabbixDaemon.Sleep=300#MaxThreadNumber should be >= than the number of your databasesOrabbixDaemon.MaxThreadNumber=100#put here your databases in a comma separated list#DatabaseList=DB1,DB2,DB3DatabaseList=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 poolDatabaseList.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=100DatabaseList.MaxIdle=1#define here your connection string for each database192.168.31.250oracle.Url=jdbc:oracle:thin:@192.168.31.250:1521:orcl192.168.31.250oracle.User=zabbix192.168.31.250oracle.Password=zabbix#Those values are optionals if not specified Orabbix is going to use the general values192.168.31.250oracle.MaxActive=10192.168.31.250oracle.MaxWait=100192.168.31.250oracle.MaxIdle=1192.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.log2020-04-03 00:17:20,455 [main] INFO  Orabbix - maxIdleSize=12020-04-03 00:17:20,455 [main] INFO  Orabbix - maxIdleTime=1800000ms2020-04-03 00:17:20,455 [main] INFO  Orabbix - poolTimeout=1002020-04-03 00:17:20,455 [main] INFO  Orabbix - timeBetweenEvictionRunsMillis=-12020-04-03 00:17:20,455 [main] INFO  Orabbix - numTestsPerEvictionRun=32020-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 connection2020-04-03 00:17:25,982 [main] INFO  Orabbix - This Database 192.168.31.250oracle removed2020-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.log2020-04-03 00:17:20,455 [main] INFO  Orabbix - maxIdleTime=1800000ms2020-04-03 00:17:20,455 [main] INFO  Orabbix - poolTimeout=1002020-04-03 00:17:20,455 [main] INFO  Orabbix - timeBetweenEvictionRunsMillis=-12020-04-03 00:17:20,455 [main] INFO  Orabbix - numTestsPerEvictionRun=32020-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 progress2020-04-03 00:17:25,982 [main] INFO  Orabbix - This Database 192.168.31.250oracle removed2020-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 NetworkManagernameserver 202.103.24.68

再看看网卡文件

[root@zabbix-server network-scripts]# cat ifcfg-ens160TYPE=EthernetBOOTPROTO=noneDEFROUTE=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_FAILURE_FATAL=noIPV6_ADDR_GEN_MODE=stable-privacyNAME=ens160UUID=a3bc4f8e-0b19-4acf-a066-a30490616cfcDEVICE=ens160ONBOOT=yesDNS1=202.103.24.68IPADDR=192.168.31.111PREFIX=24GATEWAY=192.168.31.1IPV6_PEERDNS=yesIPV6_PEERROUTES=yesIPV6_PRIVACY=no

OK,把本地的域名都加上
resolv.conf

[root@zabbix-server orabbix]# cat /etc/resolv.conf# Generated by NetworkManagernameserver 202.103.24.68nameserver 192.168.31.1nameserver 114.114.114.114

网卡文件

[root@zabbix-server network-scripts]# cat ifcfg-ens160TYPE=EthernetBOOTPROTO=noneDEFROUTE=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_FAILURE_FATAL=noIPV6_ADDR_GEN_MODE=stable-privacyNAME=ens160UUID=a3bc4f8e-0b19-4acf-a066-a30490616cfcDEVICE=ens160ONBOOT=yesDNS1=202.103.24.68DNS2=192.168.31.1DNS3=114.114.114.114DNS4=8.8.8.8IPADDR=192.168.31.111PREFIX=24GATEWAY=192.168.31.1IPV6_PEERDNS=yesIPV6_PEERROUTES=yesIPV6_PRIVACY=no

再次启动Orabbix

启动成功的提示

2020-04-03 00:32:53,490 [main] INFO  Orabbix - Starting Orabbix Version 1.2.32020-04-03 00:32:58,533 [main] INFO  Orabbix - Orabbix started with pid:60362020-04-03 00:32:58,533 [main] INFO  Orabbix - PidFile -> ./logs/orabbix.pid2020-04-03 00:32:58,649 [main] INFO  Orabbix - DB Pool created: org.apache.commons.dbcp.datasources.SharedPoolDataSource@1963006a2020-04-03 00:32:58,649 [main] INFO  Orabbix - URL=jdbc:oracle:thin:@192.168.31.250:1521:orcl2020-04-03 00:32:58,649 [main] INFO  Orabbix - maxPoolSize=102020-04-03 00:32:58,649 [main] INFO  Orabbix - maxIdleSize=12020-04-03 00:32:58,649 [main] INFO  Orabbix - maxIdleTime=1800000ms2020-04-03 00:32:58,649 [main] INFO  Orabbix - poolTimeout=1002020-04-03 00:32:58,649 [main] INFO  Orabbix - timeBetweenEvictionRunsMillis=-12020-04-03 00:32:58,649 [main] INFO  Orabbix - numTestsPerEvictionRun=32020-04-03 00:33:11,469 [main] INFO  Orabbix - Connected as ZABBIX2020-04-03 00:33:11,478 [main] INFO  Orabbix - --------- on Database -> orcl2020-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 ms2020-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
赞(0) 打赏
未经允许不得转载:爱站程序员基地 » Orabbix配合Zabbix实现对Oracle的实例监控