orabbix_orabbix监控oracle数据库状态例子

更新时间:2019-11-01    来源:Oracle教程    手机版     字体:

【www.bbyears.com--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
下面是我的一个配置:
注意DatabaseList大小写敏感,并且与zabbix上面的hostname一致。

[root@iZ23snm97y9Z orabbix]# cat conf/config.props
#comma separed list of Zabbix servers
ZabbixServerList=ZabbixServer1

ZabbixServer1.Address=127.0.0.1
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=DB68

#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
DB68.Url=jdbc:oracle:thin:@10.168.xx.xx:1521:test
DB68.User=zabbix
DB68.Password=zabbix
#Those values are optionals if not specified Orabbix is going to use the general values
DB68.MaxActive=10
DB68.MaxWait=100
DB68.MaxIdle=1
DB68.QueryListFile=./conf/query.props

#DB2.Url=jdbc:oracle:thin:@server2.domain.example.com::DB2
#DB2.User=zabbix
#DB2.Password=zabbix_password
#DB2.QueryListFile=./conf/query.props
#
#DB3.Url=jdbc:oracle:thin:@server3.domain.example.com::DB3
#DB3.User=zabbix
#DB3.Password=zabbix_password
#DB3.QueryListFile=./conf/query.props
#
#


4 在oracle数据库上面添加权限:

 CREATE USER ZABBIX
 IDENTIFIED BY zabbix
 DEFAULT TABLESPACE SYSTEM
 TEMPORARY TABLESPACE TEMP
 PROFILE DEFAULT
 ACCOUNT UNLOCK;
 – 2 Roles for ZABBIX
 GRANT CONNECT TO ZABBIX;
 GRANT RESOURCE TO ZABBIX;
 ALTER USER ZABBIX DEFAULT ROLE ALL;
 – 5 System Privileges for ZABBIX
 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;
 ```

 11g的话执行一下存储过程

 ```
  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;


用下面的语句来测试:


select utl_inaddr.get_host_name("127.0.0.1") from dual;

5 加入开机自启动:

chkconfig --add orabbix
1
6 启动orabbix

/etc/init.d/orabbix start
1
观察logs/orabbix.log
出现下面的输出代表orabbix运行正常:

 2015-05-08 10:57:44,343 [pool-1-thread-1] INFO  Orabbix - Done with dbJob on da
tabase DB68 QueryList elapsed time 1125 ms
1
2
否则则要看具体报错信息,一般可能是权限不对等引起连不上数据库
orabbix 是通过java程序连oracle,所以需要安装java环境。

7 zabbix上面导入xml的模板

在template目录下面有Orabbix_export_full.xml ,导入他就ok了。

8 zabbix添加主机

这里要注意的是不用添加linux的模板,只添加刚刚导入的oracle模板即可。

9 End

至此,oracle添加完毕,可以用zabbix的图里看到oracle的运行状态。图就不截了

本文来源:http://www.bbyears.com/shujuku/76738.html