zabbix利用orabbix监控oracle

Orabbix 是一个用来监控 Oracle 数据库实例的 Zabbix 插件。(插件安装在zabbix-server端)

下载地址:http://www.smartmarmot.com/product/orabbix/download/

zabbix-server上操作

Orabbix是通过JDBC去连接oracle数据库,然后过滤想要的数据,所以需要jdk环境

我测试过jdk1.7和1.8都可以,直接yum安装,或者下载rpm包,rpm -ivh安装,都可以

这里,我是直接rpm安装的,


1

2

3

4

5

[[email protected] ~]# rpm -ivh jdk-8u102-linux-x64.rpm

Preparing...                ########################################### [100%]

   1:jdk1.8.0_102           ########################################### [100%]

在/opt目录下新建一个orabbix目录:


1

[[email protected] orabbix]#midir -p /opt/orabbix

(建议在此目录下,如果放置其他目录稍后需要更改orabbix的启动文件orabbix,启动文件默认写在opt/orabbix目录下 )

[[email protected] opt]# cd orabbix/

上传orabbix-1.2.3.zip


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

[[email protected] orabbix]# ls

orabbix-1.2.3.zip

解压

[[email protected] orabbix]# unzip -q orabbix-1.2.3.zip

[[email protected] orabbix]# ls

conf  init.d       lib      orabbix-1.2.3.zip  orabbixw.exe  run.sh    uninstall.cmd

doc   install.cmd  orabbix-1.2.3.jar  orabbix.exe        run.bat       template

授权

[[email protected] orabbix]# cd ..

[[email protected] opt]# chmod -R a+x orabbix/

[[email protected] ~]# cd /opt/orabbix/conf/

[[email protected] conf]# ls

config.props    log4j.properties    query_a_1.props  query_b.props     query.props

config.props.sample  log4j.properties.sample  query_a.props  query - Copy.props  query.props.sample

[[email protected] conf]# cp config.props.sample config.props

编辑配置文件:

[[email protected] conf]# vim config.props

源配置文件


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

[[email protected] conf]# egrep "^[a-Z,1-9]" config.props.sample

ZabbixServerList=ZabbixServer1,ZabbixServer2

ZabbixServer1.Address=IP_ADDRESS_OF_ZABBIX_SERVER

ZabbixServer1.Port=PORT_OF_ZABBIX_SERVER

ZabbixServer2.Address=IP_ADDRESS_OF_ZABBIX_SERVER

ZabbixServer2.Port=PORT_OF_ZABBIX_SERVER

OrabbixDaemon.PidFile=./logs/orabbix.pid

OrabbixDaemon.Sleep=300

OrabbixDaemon.MaxThreadNumber=100

DatabaseList=DB1,DB2,DB3

DatabaseList.MaxActive=10

DatabaseList.MaxWait=100

DatabaseList.MaxIdle=1

DB1.Url=jdbc:oracle:thin:@server.domain.example.com:<LISTENER_PORT>:DB1

DB1.User=zabbix

DB1.Password=zabbix_password

DB1.MaxActive=10

DB1.MaxWait=100

DB1.MaxIdle=1

DB1.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

修改之后


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

[[email protected] conf]# egrep "^[a-Z,1-9]" config.props

ZabbixServerList=ZabbixServer1   #(zabbixserver的名字,下行中address和port都引用到了这个名字,所以下面两行的前缀名字要与这里的名字保持一致)

ZabbixServer1.Address=127.0.0.1    #我这里就是在zabbix server上面操作的,所以这里是127.0.0.1

ZabbixServer1.Port=10051   #zabbix server的服务端口

OrabbixDaemon.PidFile=./logs/orabbix.pid

OrabbixDaemon.Sleep=300

OrabbixDaemon.MaxThreadNumber=100

DatabaseList=172.20.10.183-oracle,192.168.56.99-oracle   #这里很重要,跟下面的对应上

DatabaseList.MaxActive=10

DatabaseList.MaxWait=100

DatabaseList.MaxIdle=1

172.20.10.183-oracle.Url=jdbc:oracle:thin:@172.20.10.183:1521:orcl      #172.20.10.183 oracle数据库的地址,1521端口,orcl数据库实例名

172.20.10.183-oracle.User=zabbix      #授权的账号

172.20.10.183-oracle.Password=zabbix   #授权的密码

172.20.10.183-oracle.MaxActive=10

172.20.10.183-oracle.MaxWait=100

172.20.10.183-oracle.MaxIdle=1

172.20.10.183-oracle.QueryListFile=./conf/query.props    #要查询的语句都在这定义的,不满意自己改

oracle主机上操作(这步可以省略,只要知道数据库实例,账号,密码)

下面是oracle 11g的(12c 语法不一样)授权语句如下,创用户,授权,这些操作,我都是在oracle数据库的sqlplus下执行的


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

[[email protected] ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.3.0 Production on Wed Sep 7 18:01:54 2016

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>

CREATE USER ZABBIX IDENTIFIED BY zabbix DEFAULT TABLESPACE SYSTEM TEMPORARY TABLESPACE TEMP PROFILE DEFAULT ACCOUNT UNLOCK;

GRANT CONNECT TO ZABBIX;

GRANT RESOURCE TO ZABBIX;

ALTER USER ZABBIX DEFAULT ROLE ALL;

GRANT SELECT ANY TABLE TO ZABBIX;

GRANT CREATE SESSION TO ZABBIX;

GRANT SELECT ANY DICTIONARY TO ZABBIX;

GRANT UNLIMITED TABLESPACE TO ZABBIX;

GRANT SELECT ANY DICTIONARY TO ZABBIX;

GRANT SELECT ON V_$SESSION TO ZABBIX;

GRANT SELECT ON V_$SYSTEM_EVENT TO ZABBIX;

GRANT SELECT ON V_$EVENT_NAME TO ZABBIX;

GRANT SELECT ON V_$RECOVERY_FILE_DEST TO ZABBIX;

启动orabbix

[[email protected] orabbix]# cp init.d/orabbix /etc/init.d/

[[email protected] orabbix]# ll /etc/init.d/orabbix

-rwxr-xr-x 1 root root 1693 Sep 14 21:40 /etc/init.d/orabbix

[[email protected] orabbix]# /etc/init.d/orabbix start

Starting Orabbix service:

报错的话,检查配置文件,数据库地址,端口,实例名,账号,密码是否正确,需要验证对于不懂oracle的怎么办,搜命令呗,我也是一路过来,各种坑~~~~~

然后里面看日志

[[email protected] orabbix]# tailf /opt/orabbix/logs/orabbix.log

[main] INFO  Orabbix - --------- on Database -> orcl

[pool-1-thread-1] WARN  Orabbix - Error while executing ->dbversion- on database ->172.20.10.183-oracle- Exception received ORA-24247: network access denied by access control list (ACL)

ORA-06512: at "SYS.UTL_INADDR", line 4

ORA-06512: at "SYS.UTL_INADDR", line 35

ORA-06512: at line 1

出现这些日志,不影响后面的操作,如果你是完美主义者,满足你

在oracle数据库的sqlplus下执行下面三条命令

exec dbms_network_acl_admin.create_acl(acl => ‘resolve.xml‘,description =>‘resolve acl‘, principal =>‘ZABBIX‘, is_grant => true, privilege =>‘resolve‘);

exec dbms_network_acl_admin.assign_acl(acl=> ‘resolve.xml‘, host =>‘*‘);

commit;

到此,安装配置完成,则通过web页面访问监控界面直接导入模板即可

模版放置在/opt/orabbix/template下
Orabbix_export_full.xml          #只需要导入这个一个模板就好

添加主机

然后链接oracle的模板

添加完成之后的效果

查看最新数据

这时候图也有了

常见错误

[[email protected] orabbix]# tailf /opt/orabbix/logs/orabbix.log

[main] ERROR Orabbix - Error on Configurator for database 172.20.10.183 oracle -->ORA-01017: invalid username/password; logon denied

config.props配置文件中,数据库账号密码不对,或者在oracle数据库没授权这个用户

原文地址:https://www.cnblogs.com/youngerger/p/9037485.html

时间: 2024-08-02 19:29:59

zabbix利用orabbix监控oracle的相关文章

Zabbix通过Orabbix监控Oracle数据库

一.背景 公司业务使用的是一直Oracle数据库,因为多次出现表空间满的时候不能及时发现,每次都是业务组的人员通知处理,这样下来DBA这边就比较被动,所以老大要求监控表空间剩余大小并且当剩余过小时能够及时报警.刚想出来的方案是通过写脚本获取表空间的数据,通脚本中使用expect自动输入密码登陆oracle用户然后再登陆数据库查询数据返回给zabbix_server.但是由于脚本运行时间大概12秒左右,zabbix获取数据总是超时,在网上搜索中发现zabbix插件orabbix,原理是通过orab

zabbix使用pyora监控oracle数据库

前段时间使用Orabbix监控oracle数据库,发现可以实现对oracel数据库实行监控,但是最近部署Orabbix监控oracle数据库,发现始终无法获取到数据库的内容......由于Orabbix是基于java实现的,使用的是jdbc连接oracle数据库,获取到的值传递给zabbix捕捉器来捕捉,这个过程我不是很熟悉......始终无法调试出图来...最后终于放弃,寻找Orabbix的替代品.在zabbix官网找了一遍,发现使用python实现的pyora这个脚本还不错,最大的优势就是能

orabbix监控oracle数据库

orabbix监控oracle数据库 1 下载 下载地址: http://www.smartmarmot.com/product/orabbix/download/ 2 授予文件可执行的权限 #chmod +x /opt/orabbix -R #chmod +x /opt/orabbix/run.sh 3 创建一个名为config.props文件,有模板可以参考. #cp /opt/orabbix/conf/config.props.sample config.props 下面是我的一个配置:

Zabbix 3.2.6 通过Orabbix监控Oracle数据库

一.背景 公司业务使用的是一直Oracle数据库,因为多次出现表空间满的时候不能及时发现,每次都是业务组的人员通知处理,这样下来DBA这边就比较被动,所以老大要求监控表空间剩余大小并且当剩余过小时能够及时报警.刚想出来的方案是通过写脚本获取表空间的数据,通脚本中使用expect自动输入密码登陆oracle用户然后再登陆数据库查询数据返回给zabbix_server.但是由于脚本运行时间大概12秒左右,zabbix获取数据总是超时,在网上搜索中发现zabbix插件orabbix,原理是通过orab

Zabbix利用JMX监控多实例Tomcat运行状态

自使用Zabbix监控系统以来,一直想用JMX来监控Tomcat,但是一直都没配置成功,总有一些问题,监控端的报错又很抽象,搜索网上大都是复制粘贴之产物,或者是缺斤短两之网文,但是一直都没放弃,至今终于配置成功,并且成功获取数据,形成图形,现在把自己解决问题的过程和配置的一些心得整理成文. 环境介绍: Centos 6.5 Zabbix 2.2.15 Tomcat 7.0.68 监控JMX配置步骤 1.在zabbix服务器上安装配置zabbix-java-gateway,并且配置相关参数. 2.

Zabbix利用orabbix插件监控Oracle数据库(增强版)

按照网上的一些资料进行安装最后发现问题挺多的,于是自己修复了一些问题便记录了下来. 一.jdk的安装(Orabbix Server) 1.软件解压,放到固定位置 tar zxf jdk-8u51-linux-x64.tar.gz mv jdk1.8.0_51/ /usr/local/ 2.设置系统变量,编辑/etc/profile在末尾增加 export JAVA_HOME=/usr/local/jdk1.8.0_51 exportCLASSPATH=$JAVA_HOME/lib/dt.jar:

Zabbix 3.2.6通过Orabbix监控Oracle数据库

参考文档:http://www.smartmarmot.com/wiki/index.php?title=Orabbix

Orabbix 监控oracle表空间 Low Level Discovery

在被监控端创建脚本,此脚本用于获取表空间及空间使用信息,此脚本由oracle用户下创建 vim mornitor_tbs.sh #!/bin/bash source /home/oracle/.bash_profile sqlplus -s zabbix/zabbix > /tmp/tablespace.log<<EOF set linesize 140 pagesize 10000 col "Status" for a10 col "Name" 

zabbix 使用spool监控oracle锁表

说明 由于spool直接执行sql v$locked_object lo, dba_objects ao, v$session ,无法识别$符号,使用斜杠转义也是无效,所以sqlplus bol/bol @/opt/bolck_table.sh执行 没有问题 执行脚本#[[email protected] opt]# cat /opt/bolck_table_oracle.sh #!/bin/bashsqlplus bol/bol @/opt/bolck_table.sh #sql语句脚本,将结