请选择 进入手机版 | 继续访问电脑版

使用Zabbix监控Oracle数据库实例(orabbix插件)

[复制链接]
丁翼 发表于 2021-1-2 19:01:16 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题
效果如下



情况先容

172.16.0.168 centos6.9 Oracle11g
172.16.0.21 zabbix3.4.15 MariaDB5.5.68 zabbix和数据库同一台呆板
一、zabbix-mysql搭建

  1. 修改主机名,到场一个zabbix国内源hostnamectl set-hostname zabbixcd /etc/yum.repos.d/vim zabbix.repo##repo源内容如下[zabbix]name=Zabbix Official Repository - $basearchbaseurl=https://mirrors.aliyun.com/zabbix/zabbix/3.4/rhel/7/$basearch/enabled=1gpgcheck=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591[zabbix-non-supported]name=Zabbix Official Repository non-supported - $basearchbaseurl=https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/$basearch/enabled=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIXgpgcheck=0mariadb安装设置yum makecacheyum install -y mariadb mariadb-server zabbix-server-mysqlcd /usr/share/mysql/cp my-huge.cnf /etc/my.cnfvim /etc/my.cnf#修改如下内容61 server-id   = 2162 log_slave_updates63 binlog-ignore-db = mysql64 datadir = /data/mysqlmkdir -p /data/mysqlchown -R mysql:mysql /data/mysql/systemctl start mariadbsystemctl enable mariadb创建zabbix数据库并授权mysql -u root -pMariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;MariaDB [(none)]> grant all on zabbix.* to zabbix@&#39;localhost&#39; identified by &#39;12345&#39;;MariaDB [(none)]> grant all on zabbix.* to zabbix@&#39;172.16.%&#39; identified by &#39;12345&#39;;MariaDB [(none)]> flush privileges;MariaDB [(none)]> quitcd /usr/share/doc/zabbix-server-mysql-3.4.15/gunzip create.sql.gzmysql zabbix < create.sql##查抄zabbix的表是否导入乐成mysql -u zabbixMariaDB [zabbix]> show tables;
复制代码
二、LAMP情况搭建

  1. yum install -y httpd php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhashvim /etc/httpd/conf/httpd.conf DirectoryIndex index.php index.html ed  1  CREATE USER ZABBIX  --创建zabbix用户  2  IDENTIFIED BY zabbix   --暗码zabbix  3  DEFAULT TABLESPACE SYSTEM    --生存到system表空间  4  TEMPORARY TABLESPACE TEMP    --分配暂时表空间  5  PROFILE DEFAULT    --设置文件默认  6* ACCOUNT UNLOCK    --解锁账户SYS@prod>/--分配两个脚色给zabbixSYS@prod>GRANT CONNECT TO ZABBIX; --赋予毗连权限Grant succeeded.SYS@prod>GRANT RESOURCE TO ZABBIX; --赋予存储过程调用权限Grant succeeded.SYS@prod>ALTER USER ZABBIX DEFAULT ROLE ALL; --生效脚色权限User altered.--分配4个系统权限给zabbixSYS@prod>GRANT SELECT ANY TABLE TO ZABBIX; --查询权限Grant succeeded.SYS@prod>GRANT CREATE SESSION TO ZABBIX; --创建会话权限Grant succeeded.SYS@prod>GRANT SELECT ANY DICTIONARY TO ZABBIX; --查询数据字典权限Grant succeeded.SYS@prod>GRANT UNLIMITED TABLESPACE TO ZABBIX;  --不限制表空间配额Grant succeeded.SYS@prod>conn zabbix/zabbixConnected.--验证权限列表ZABBIX@prod>select * from user_role_privs;USERNAME                       GRANTED_ROLE                   ADM DEF OS_------------------------------ ------------------------------ --- --- ---ZABBIX                         CONNECT                        NO  YES NOZABBIX                         RESOURCE                       NO  YES NO--调用2个存储过程,清除abbix用户ACL限制SYS@prod>exec dbms_network_acl_admin.create_acl(acl => &#39;resolve.xml&#39;,description => &#39;resolve acl&#39;, principal =>&#39;ZABBIX&#39;, is_grant => true, privilege => &#39;resolve&#39;);PL/SQL procedure successfully completed.SYS@prod>exec dbms_network_acl_admin.assign_acl(acl => &#39;resolve.xml&#39;, host =>&#39;*&#39;);PL/SQL procedure successfully completed.SYS@prod>commit;Commit complete.--验证效果SYS@prod>select utl_inaddr.get_host_name(&#39;127.0.0.1&#39;) from dual;UTL_INADDR.GET_HOST_NAME(&#39;127.0.0.1&#39;)--------------------------------------localhost
复制代码
五、Orabbix收罗器安装

  1. orabbix安装wget https://jaist.dl.sourceforge.net/project/orabbix/orabbix-1.2.3.zipunzip -q orabbix-1.2.3.zip -d /opt/orabbix/cp /opt/orabbix/init.d/orabbix /etc/init.d/orabbixchmod +x /etc/init.d/orabbixchmod +x /opt/orabbix/run.shvim /opt/orabbix/conf/config.props.sample  2 ZabbixServerList=zabbix  4 zabbix.Address=127.0.0.1  5 zabbix.Port=1005118 DatabaseList=oracle11g31 oracle11g.Url=jdbc:oracle:thin:@172.16.0.167:1521:prod32 oracle11g.User=zabbix33 oracle11g.Password=zabbix35 oracle11g.MaxActive=1036 oracle11g.MaxWait=10037 oracle11g.MaxIdle=138 oracle11g.QueryListFile=./conf/query.props生成orabbix设置文件cp config.props.sample config.props在oracle和zabbix两台服务器中写入hostsvim /etc/hosts172.16.0.167    oracle11g.com   oracle11g172.16.0.21     zabbix.com      zabbix添加启动项:chkconfig --add orabbix启动orabbix[root@zabbix orabbix]# /etc/init.d/orabbix startStarting orabbix (via systemctl):                          [  OK  ]查察日志less /opt/orabbix/logs/orabbix.log如果显示如下内容说明乐成2020-12-31 18:12:03,977 [main] INFO  Orabbix - Starting Orabbix Version 1.2.32020-12-31 18:12:03,991 [main] INFO  Orabbix - Orabbix started with pid:40722020-12-31 18:12:03,991 [main] INFO  Orabbix - PidFile -> ./logs/orabbix.pid2020-12-31 18:12:04,207 [main] INFO  Orabbix - DB Pool created: org.apache.commons.dbcp.datasources.SharedPoolDataSource@38cccef2020-12-31 18:12:04,207 [main] INFO  Orabbix - URL=jdbc:oracle:thin:@172.16.0.167:1521:prod2020-12-31 18:12:04,207 [main] INFO  Orabbix - maxPoolSize=102020-12-31 18:12:04,207 [main] INFO  Orabbix - maxIdleSize=12020-12-31 18:12:04,207 [main] INFO  Orabbix - maxIdleTime=1800000ms2020-12-31 18:12:04,207 [main] INFO  Orabbix - poolTimeout=1002020-12-31 18:12:04,207 [main] INFO  Orabbix - timeBetweenEvictionRunsMillis=-12020-12-31 18:12:04,207 [main] INFO  Orabbix - numTestsPerEvictionRun=32020-12-31 18:12:04,560 [main] INFO  Orabbix - Connected as ZABBIX2020-12-31 18:12:04,562 [main] INFO  Orabbix - --------- on Database -> prod2020-12-31 18:12:04,769 [pool-1-thread-1] INFO  Orabbix - Done with dbJob on database oracle11g QueryList elapsed time 173 ms导入orabbix监控模板,一共四个,导入full的就行位置:/opt/orabbix/template/Orabbix_export_full.xml    Orabbix_export_items.xmlOrabbix_export_graphs.xml  Orabbix_export_triggers.xml收罗器只提供oracle实例的相关信息:如SGA,PGA,SESSION,逻辑IO,物理IO等信息需要监控oracle服务器等信息需要安装zabbix-agent
复制代码
总结

没啥总结,挺简单的
遇到问题的话留言吧,瞥见就会解答


来源:https://blog.csdn.net/weixin_37644222/article/details/112058927
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则


专注素材教程免费分享
全国免费热线电话

18768367769

周一至周日9:00-23:00

反馈建议

27428564@qq.com 在线QQ咨询

扫描二维码关注我们

Powered by Discuz! X3.4© 2001-2013 Comsenz Inc.( 蜀ICP备2021001884号-1 )