zabbix+orabbix安装

zabbix + orabbix 监控oracle数据库

zabbix 监控搭建

一,LNMP环境搭建

LNMP环境搭建.md

二,zabbix服务端安装配置

(1)下载zabbix并安装
所有版本下载地址:http://www.zabbix.com/download.php

yum install mysql-dev gcc net-snmp-devel curl-devel perl-DBI php-gd php-mysql php-bcmath php-mbstring php-xm


./configure --prefix=/usr/local/zabbix-2.2.13/ --enable-server --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2

make && make install

(2)创建用户

groupadd zabbix
useradd -g zabbix zabbix

(3)初始化数据库

mysql -uroot -proot
create database zabbix default  charset utf8;
cd cd zabbix-2.2.13/database/mysql/
mysql -uroot -p zabbix < schema.sql
mysql -uroot -p zabbix < images.sql
mysql -uroot -p zabbix < data.sql

(4)配置zabbix

# mkdir /etc/zabbix
# cp config/zabbix_server.conf /etc/zabbix/
# vim /etc/zabbix/zabbix_server.conf
DBName=zabbix
DBUser=root
DBPassword=root
DBPort=3306

DBName 存放zabbix对象的数据库
DBUser 数据库名
DBPassword 数据库密码

(5)启动zabbix

  1. # /usr/local/zabbix-2.2.13/sbin/zabbix_server

默认端口10051

如果启动后显示不出10051监听或者进程单一,尝试修改/usr/local/zabbix-2.2.13/etc/zabbix_server.conf 安装目录下的配置文件

(6)zabbix网站管理配置 拷贝前端文件

  1. cp -rp frontends/php /usr/local/nginx/html/

浏览器打开进行图形配置

http://localhost/php

解决:

修改/usr/local/php/etc/php.ini

max_execution_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
max_input_time = 300
date.timezone = Asia/Shanghai

处理方法:安装Mysqli模块

 ###################
 # mysqli模块的安装 #
 ###################

原来在编译php的已经加了参数
–with-mysql=/usr/local/mysql \
–with-mysqli=/usr/local/mysql/bin/mysql_config \

mysqli是优化过的mysql函数库,MYSQL版本不能低于4.1.12

1.进入到mysqli的目录

无需专门下载mysqli,就在php安装包中!!!

  1. cd /root/php-5.5.38/ext/mysqli --- 解压的文件目录

2.使用phpize生成configure文件:

[root@mss_db_monitor mysqli]# /usr/local/php/bin/phpize 
Configuring for:
PHP Api Version:         20121113
Zend Module Api No:      20121212
Zend Extension Api No:   220121212
./configure --prefix=/usr/local/mysqli \
--with-php-config=/usr/local/php/bin/php-config \    --根据环境实际路径:find / -name php-config
--with-mysqli=/usr/local/mysql/bin/mysql_config    ---根据环境实际路径:find / -name mysql_config

make 
make test
[root@mss_db_monitor mysqli]# make install 
Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/
Installing header files:          /usr/local/php/include/php/
[root@mss_db_monitor mysqli]# 

3.然后在/usr/local/php/etc/php.ini
加上一句:

  1. extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/mysqli.so

4.重启php服务

[root@mss_db_monitor no-debug-non-zts-20121212]# /etc/init.d/php-fpm restart 
Gracefully shutting down php-fpm . done
Starting php-fpm  done

5.点击Retry OK

又有错误!!!

解决方法,见文章最后!

登陆zabbix,默认用户名:Admin,密码:zabbix

开头的红色提示,下面解决!!!

三,zabbix客户端安装配置

完全参考:http://www.1987.name/760.html

上传文件,或者是直接从服务端scp到客户端

用户组建立

groupadd -g 1006 zabbix
useradd -u 1006 -g 1006 -s /sbin/nologix -M zabbix

安装

tar zxvf zabbix-2.0.5.tar.gz && cd zabbix-2.0.5
./configure --prefix=/usr/local/zabbix --enable-agent
make && make install

添加服务端口和修改启动脚本

sed -i "/^# Local services/izabbix-agent    10050/tcp                       #Zabbix Agent" /etc/services
sed -i "/^# Local services/izabbix-agent    10050/udp                       #Zabbix Agent" /etc/services
cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
sed -i 's/BASEDIR=\/usr\/local\/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_agentd
chkconfig --add zabbix_agentd
chkconfig zabbix_agentd on

修改zabbix_agent配置文件

vim /usr/local/zabbix/etc/zabbix_agentd.conf
Server=192.168.1.140
Hostname=linux server1
PidFile=/var/tmp/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log

创建日志

>mkdir /var/log/zabbix
touch /var/log/zabbix/zabbix_agentd.log
chown -R zabbix.zabbix /var/log/zabbix

启动

  1. /etc/init.d/zabbix_agentd start

四,orabbix安装配置

参考:http://denghaibin.blog.51cto.com/4128215/1556816
http://www.smartmarmot.com/wiki/index.php/Orabbix

官方文档参考:https://www.zabbix.com/documentation/2.4/manual/installation/install

服务端
http://www.smartmarmot.com/product/orabbix/download/

#mkdir /opt/orabbix
#mv orabbix-1.2.3.zip /opt/orabbix
#cd /opt/orabbit
#unzip orabbix-1.2.3.zip
  1. #chmod a+x /opt/orabbix -R
  1. cat /opt/orabbix/conf/config.props.sample | grep -v "#" > /opt/orabbix/conf/config.props
[root@localhost orabbix]# cat config.props 

ZabbixServerList=ZabbixServer1

ZabbixServer1.Address=192.168.9.127
ZabbixServer1.Port=10051

#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=p0cdb001,p0cap001,10.140.4.14,p5cwfdbb02,p5cwfdbb03

DatabaseList.MaxActive=10
DatabaseList.MaxWait=100
DatabaseList.MaxIdle=1

p0cdb001.Url=jdbc:oracle:thin:@192.168.68.51:1521:MDM1
#ZabbixServer2.Port=PORT_OF_ZABBIX_SERVER

OrabbixDaemon.PidFile=./logs/orabbix.pid
OrabbixDaemon.Sleep=300
OrabbixDaemon.MaxThreadNumber=100

DatabaseList=p0cdb001,p0cap001,10.140.4.14,p5cwfdbb02,p5cwfdbb03

DatabaseList.MaxActive=10
DatabaseList.MaxWait=100
DatabaseList.MaxIdle=1

p0cdb001.Url=jdbc:oracle:thin:@192.168.68.51:1521:MDM1
p0cdb001.User=zabbix
p0cdb001.Password=zabbix
p0cdb001.MaxActive=10
p0cdb001.MaxWait=100
p0cdb001.MaxIdle=1
p0cdb001.QueryListFile=./conf/query.props

p0cap001.Url=jdbc:oracle:thin:@192.168.68.52:1521:MDM2
p0cap001.User=zabbix
p0cap001.Password=zabbix
p0cap001.MaxActive=10
p0cap001.MaxWait=100
p0cap001.MaxIdle=1
p0cap001.QueryListFile=./conf/query.props

10.140.4.14.Url=jdbc:oracle:thin:@10.140.4.14:1521:p5cwfb1
10.140.4.14.User=zabbix
10.140.4.14.Password=zabbix
10.140.4.14.MaxActive=10
10.140.4.14.MaxWait=100
10.140.4.14.MaxIdle=1
10.140.4.14.QueryListFile=./conf/query.props


p5cwfdbb02.Url=jdbc:oracle:thin:@10.140.4.15:1521:p5cwfb2
p5cwfdbb02.User=zabbix
p5cwfdbb02.Password=zabbix
p5cwfdbb02.MaxActive=10
p5cwfdbb02.MaxWait=100
p5cwfdbb02.MaxIdle=1
p5cwfdbb02.QueryListFile=./conf/query.props

p5cwfdbb03.Url=jdbc:oracle:thin:@10.140.4.16:1521:p5cwfb3
p5cwfdbb03.User=zabbix
p5cwfdbb03.Password=zabbix
p5cwfdbb03.MaxActive=10
p5cwfdbb03.MaxWait=100
p5cwfdbb03.MaxIdle=1
p5cwfdbb03.QueryListFile=./conf/query.props

注意:DatabaseList 中的名字和下面对应具体属性的名字一定要相同,并且和监控界面中显示的名字要相同,否则可能不能正常显示

客户端

create user zabbix identified by "zabbix" default tablespace users temporary tablespace temp profile default account unlock;
grant alter session to zabbix;
grant create session to zabbix;
grant connect to zabbix;
alter user zabbix default role all;
grant select on v_$instance to zabbix;
grant select on dba_users to zabbix;
grant select on v_$log_history to zabbix;
grant select on v_$parameter to zabbix;
grant select on sys.dba_audit_session to zabbix;
grant select on v_$lock to zabbix;
grant select on dba_registry to zabbix;
grant select on v_$librarycache to zabbix;
grant select on v_$sysstat to zabbix;
grant select on v_$parameter to zabbix;
grant select on v_$latch to zabbix;
grant select on v_$pgastat to zabbix;
grant select on v_$sgastat to zabbix;
grant select on v_$librarycache to zabbix;
grant select on v_$process to zabbix;
grant select on dba_data_files to zabbix;
grant select on dba_temp_files to zabbix;
grant select on dba_free_space to zabbix;
grant select on v_$system_event to 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;

服务端操作

#cp -a /opt/orabbix/init.d/orabbix /etc/init.d/orabbix
#/etc/init.d/orabbix start
Starting Orabbix service:
# ps aux |grep orabbix

在图形界面上导入模板

模板在/opt/orabbix/template目录中

Orabbix_export_full.xml 全部导入(图表 监控项 触发器)
Orabbix_export_graphs.xml 图表
Orabbix_export_items.xml 监控项
Orabbix_export_triggers.xml 触发器

如有报错请先查看日志:

  1. [root@oracle orabbix]# tail -f /opt/orabbix/logs/orabbix.log

遇到的问题和解决方案


查看确实的库文件:

解决:
加入环境变量

  1. export LD_LIBRARY_PATH=/usr/lib64:/lib64:/usr/local/mysql/lib

让环境变量生效!

再次查看依赖包情况:

启动

成功!


解决:/usr/local/nginx/html/php 没有权限创建文件,分别修改各目录的权限,然后执行Retry

如果修改权限后依然不行,那么点击Download configuration file,把配置文件下载下来,然后再复制到/usr/local/nginx/html/php/conf/

报错原因:
配置php的时候没有加–with-gettext参数

yum install gettext-devel

解决办法:
重新编译gettext
http://xingxing5421.blog.163.com/blog/static/11944631920131213314768/

在php的源文件中进入/ext/gettext目录

[root@mss_db_monitor ~]# cd php-5.5.38/ext/gettext/

[root@mss_db_monitor gettext]# /usr/local/php/bin/phpize 
Configuring for:
PHP Api Version:         20121113
Zend Module Api No:      20121212
Zend Extension Api No:   220121212

[root@mss_db_monitor gettext]# ./configure -with-php-config=/usr/local/php/bin/php-config

[root@mss_db_monitor gettext]# make && make install

[root@mss_db_monitor gettext]# make test 


[root@mss_db_monitor ~]# vi /usr/local/php/etc/php.ini 
加上下面内容
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/gettext.so

解决:
查看日志

修改端口号:

原来是10051


上面问题未解决,但是关联上再去掉关联不清理在下拉选项里依然存在主机的选项

—————————2016-09-18 21:27:41 星期日—————————————*

orabbix取不到数据,查看日志报如下错误:
[root@mss_db_monitor ~]# tail -f /opt/orabbix/logs/orabbix.log

取不到数据一定是配置文件config.props的问题

这个参数的端口号应该是zabbix server的端口号,应该为10051,原来为10050 ,修改完成后,重启orabbix进程,恢复正常!





posted @   hao_xiaoyu  阅读(1035)  评论(0编辑  收藏  举报
编辑推荐:
· ASP.NET Core - 日志记录系统(二)
· .NET 依赖注入中的 Captive Dependency
· .NET Core 对象分配(Alloc)底层原理浅谈
· 聊一聊 C#异步 任务延续的三种底层玩法
· 敏捷开发:如何高效开每日站会
阅读排行:
· 终于决定:把自己家的能源管理系统开源了!
· C#实现 Winform 程序在系统托盘显示图标 & 开机自启动
· 了解 ASP.NET Core 中的中间件
· 实现windows下简单的自动化窗口管理
· 【C语言学习】——命令行编译运行 C 语言程序的完整流程
点击右上角即可分享
微信分享提示