zabbix
更新时间:2024-06-03 19:19:02 阅读量: 综合文库 文档下载
For MySQL
http://sourceforge.net/projects/zabbix/?source=typ_redirect 下载zabbix-2.4.2.tar.gz源码文件
或者http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/ 下载rpm包 环境
root@ogg1:/var/www/html/zabbix-->hostname ogg1
root@ogg1:/var/www/html/zabbix-->cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.4 (Santiago)
root@ogg1:/var/www/html/zabbix-->cat /etc/oracle-release Oracle Linux Server release 6.4
root@ogg1:/var/www/html/zabbix-->uname -a
Linux ogg1 2.6.39-400.17.1.el6uek.x86_64 #1 SMP Fri Feb 22 18:16:18 PST 2013 x86_64 x86_64 x86_64 GNU/Linux
##zabbix server安装配置
安装相关的软件httpd mysql 等
root@ogg1:/root-->yum -y install gcc gcc-c++ autoconf php httpd httpd-manual php-mysql \\
php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-bcmath net-snmp-devel curl curl-devel\\
mysql-devel mysql-connector-odbc
root@ogg1:/root-->tar -zxvf zabbix-2.4.2.tar.gz root@ogg1:/root-->cd zabbix-2.4.2 root@ogg1:/root/zabbix-2.4.2-->ls
aclocal.m4 bin ChangeLog conf config.sub configure.ac database frontends INSTALL m4 Makefile.in misc NEWS src
AUTHORS build compile config.guess configure COPYING depcomp include install-sh Makefile.am man missing README upgrades
root@ogg1:/root/zabbix-2.4.2-->service httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.6.182 for ServerName
[ OK ] root@ogg1:/root/zabbix-2.4.2-->groupadd zabbix
root@ogg1:/root/zabbix-2.4.2-->useradd -g zabbix -d /home/zabbix zabbix root@ogg1:/root/zabbix-2.4.2-->passwd zabbix
root@ogg1:/root/zabbix-2.4.2-->su - mysql
mysql@ogg1:/home/mysql||-->>mysql -uroot -p test mysql> create database zabbix character set utf8;
Query OK, 1 row affected (0.07 sec)
mysql> grant all on zabbix.* to 'zabbix'@'localhost' identified by \Query OK, 0 rows affected (0.09 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)
root@ogg1:/root/zabbix-2.4.2/database/mysql-->cp *.sql /home/mysql/ root@ogg1:/root/zabbix-2.4.2/database/mysql-->su - mysql
mysql@ogg1:/home/mysql||-->>mysql -uzabbix -pzabbix zabbix root@ogg1:/root/zabbix-2.4.2-->./configure --prefix=/home/zabbix/zabbix --enable-agent --with-mysql --with-net-snmp --with-libcurl root@ogg1:/root/zabbix-2.4.2-->make root@ogg1:/root/zabbix-2.4.2-->make install root@ogg1:/root/zabbix-2.4.2-->chown -R zabbix:zabbix /home/zabbix/zabbix/ root@ogg1:/root/zabbix-2.4.2-->vim /etc/services ##add for zabbix zabbix-agent 10050/tcp #zabbix agent zabbix-agent 10050/udp #zabbix agent zabbix-trapper 10051/tcp #zabbix trapper zabbix-trapper 10051/udp #zabbix trapper zabbix@ogg1:/home/zabbix/zabbix/etc-->vim zabbix_server.conf 修改LogFile PidFile DBHost DBName DBUser DBPassword ##创建开机启动脚本zabbix_server --enable-server root@ogg1:/root/zabbix-2.4.2/misc/init.d/fedora/core-->cp zabbix_server /etc/init.d/ root@ogg1:/root/zabbix-2.4.2/misc/init.d/fedora/core-->chmod +x /etc/init.d/zabbix_server root@ogg1:/root/zabbix-2.4.2/misc/init.d/fedora/core-->chown zabbix:zabbix /etc/init.d/zabbix_server ##启动zabbix_server zabbix@ogg1:/home/zabbix-->service zabbix_server start Starting zabbix_server: [ OK ] touch: cannot touch `/var/lock/subsys/zabbix_server': Permission denied 查看/tmp/zabbix_server.log日志发现报错,错误信息如下: root@ogg1:/root/zabbix-2.4.2/misc/init.d/fedora/core-->tail /tmp/zabbix_server.log 23869:20141217:135931.546 ****************************** 23869:20141217:135931.546 using configuration file: /home/zabbix/zabbix/etc/zabbix_server.conf 23869:20141217:135931.548 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 23869:20141217:135931.548 database is down: reconnecting in 10 seconds 23869:20141217:135941.548 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 23869:20141217:135941.548 database is down: reconnecting in 10 seconds 23869:20141217:135951.548 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 23869:20141217:135951.549 database is down: reconnecting in 10 seconds 23869:20141217:140001.549 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 23869:20141217:140001.549 database is down: reconnecting in 10 seconds 原因很简单,没连上mysql库,于是修改了 zabbix@ogg1:/home/zabbix/zabbix/etc-->vim zabbix_server.conf 把DBHost=localhost 改成DBHost=127.0.0.1 然后重启zabbix_server服务: zabbix@ogg1:/home/zabbix/zabbix/etc-->service zabbix_server restart Shutting down zabbix_server: [ OK ] Starting zabbix_server: [ OK ] touch: cannot touch `/var/lock/subsys/zabbix_server': Permission denied 再查看日志,成功了! zabbix@ogg1:/home/zabbix/zabbix/etc-->tail /tmp/zabbix_server.log 24038:20141217:140120.752 server #2 started [db watchdog #1] 24056:20141217:140120.754 server #20 started [history syncer #1] 24037:20141217:140120.756 server #1 started [configuration syncer #1] 24067:20141217:140120.761 server #21 started [history syncer #2] 24068:20141217:140120.761 server #22 started [history syncer #3] 24069:20141217:140120.762 server #23 started [history syncer #4] 24070:20141217:140120.762 server #24 started [escalator #1] 24071:20141217:140120.763 server #25 started [proxy poller #1] 24072:20141217:140120.763 server #26 started [self-monitoring #1] 24055:20141217:140121.146 server #19 started [discoverer #1] ##修改php.ini参数文件 root@ogg1:/misc-->vim /etc/php.ini date.timezone = Asia/Shanghai max_execution_time = 300 max_input_time = 300 post_max_size = 32M memory_limit = 128M mbstring.func_overload = 1 ##拷贝html文件至apache网页文件夹路径下 root@ogg1:/root/zabbix-2.4.2/frontends/php-->cp -a . /var/www/html/zabbix/ ##重新启动httpd服务 root@ogg1:/var/www/html/zabbix-->service httpd restart 访问http://192.168.6.182/zabbix/setup.php 输入用户admin密码zabbix登录进去; 下面安装agent端我的两台mysql是oracle enterprise linux 5.8 x86_64的; Ip地址:192.168.6.237 http://www.zabbix.com/download.php 下载zabbix_agents_2.4.1.linux2_6.amd64.tar.gz文件 root@rac1:/root-->tar -xzvf zabbix_agents_2.4.1.linux2_6.amd64.tar.gz -C /usr/local/zabbix sbin/zabbix_agent sbin/zabbix_agentd bin/zabbix_get bin/zabbix_sender conf/zabbix_agent.conf conf/zabbix_agentd.conf conf/zabbix_agentd/userparameter_examples.conf conf/zabbix_agentd/userparameter_mysql.conf root@rac1:/root-->ls -l /usr/local/zabbix/ total 12 drwxr-xr-x 2 root root 4096 Dec 17 14:53 bin drwxr-xr-x 3 root root 4096 Dec 17 14:53 conf drwxr-xr-x 2 root root 4096 Dec 17 14:53 sbin ##修改参数值Server ServerActive HostnameInclude(包含percona配置的conf文件) root@rac1:/usr/local/zabbix/conf-->vim zabbix_agentd.conf ##从server端拷贝启动文件 root@ogg1:/root/zabbix-2.4.2/misc/init.d/fedora/core-->scp zabbix_agentd 192.168.6.237:/root/ root@rac1:/root-->mv zabbix_agentd /etc/init.d/ root@rac1:/root-->vim /etc/init.d/zabbix_agentd root@rac1:/root-->chmod +x /etc/init.d/zabbix_agentd ##注意增加如下修改 修改如下: # Zabbix-Directory BASEDIR=/usr/local/zabbix CONFILE=$BASEDIR/conf/zabbix_agentd.conf action $\ root@rac1:/root-->groupadd zabbix root@rac1:/root-->useradd -g zabbix -d /home/zabbix zabbix root@rac1:/root-->passwd zabbix root@rac1:/root-->chown -R zabbix:zabbix /usr/local/zabbix/ root@rac1:/root-->chown -R zabbix:zabbix /etc/init.d/zabbix_agentd root@rac1:/root-->service zabbix_agentd start Starting zabbix_agentd: [ OK ] ##配置监控mysql,去 http://www.percona.com/doc/percona-monitoring-plugins/1.1/ 网站下载percona开发的mysql监控脚本; root@rac1:/root-->rpm -ivh percona-zabbix-templates-1.1.4-1.noarch.rpm warning: percona-zabbix-templates-1.1.4-1.noarch.rpm: Header V4 DSA signature: NOKEY, key ID cd2efd2a Preparing... ########################################### [100%] 1:percona-zabbix-template########################################### [100%] Scripts are installed to /var/lib/zabbix/percona/scripts Templates are installed to /var/lib/zabbix/percona/templates root@rac1:/var/lib/zabbix/percona/templates-->cp userparameter_percona_mysql.conf /usr/local/zabbix/conf/zabbix_agentd/ root@rac1:/usr/local/zabbix/conf/zabbix_agentd-->service zabbix_agentd restart Shutting down zabbix_agentd: [ OK ] Starting zabbix_agentd: [ OK ] ##修改mysql用户密码 root@rac1:/var/lib/zabbix/percona/scripts-->vim ss_get_mysql_stats.php 官方文档说明: http://www.percona.com/doc/percona-monitoring-plugins/1.1/zabbix/index.html#installation-instructions root@rac1:/home/mysql/mysql-5.6.22/lib-->/usr/bin/php -q /var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php --host 192.168.6.237 --items gg PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mysql.so' - /usr/lib64/libmysqlclient.so.15: version `libmysqlclient_15' not found (required by /usr/lib64/php/modules/mysql.so) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mysqli.so' - /usr/lib64/libmysqlclient.so.15: version `libmysqlclient_15' not found (required by /usr/lib64/php/modules/mysqli.so) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/pdo_mysql.so' - /usr/lib64/libmysqlclient.so.15: version `libmysqlclient_15' not found (required by /usr/lib64/php/modules/pdo_mysql.so) in Unknown on line 0 PHP MySQLi extension is not loaded root@rac1:/home/mysql/mysql-5.6.22/lib-->wget http://files.directadmin.com/services/es_5.0_64/libmysqlclient.so.15 root@rac1:/root-->chmod 755 /usr/lib64/libmysqlclient.so.15 ##使用如下命令测试看能否取到值 root@rac1:/var/lib/zabbix/percona/scripts-->./get_mysql_stats_wrapper.sh gg 2 root@rac1:/var/lib/zabbix/percona/scripts--> 成功鸟 注意事项: 1. 修改get_mysql_stats_wrapper.sh如下红色字体部分 root@rac1:/var/lib/zabbix/percona/scripts-->vim get_mysql_stats_wrapper.sh HOST=127.0.0.1 RES=`HOME=~zabbix /home/mysql/mysql-5.6.22/mysql -uroot -p123456 -e 'SHOW SLAVE STATUS\\G' | egrep '(Slave_IO_Running|Slave_SQL_Running):' | awk -F: '{print $2}' | tr '\\n' ','` 2. 修改127.0.0.1-mysql_cacti_stats.txt属主 root@rac1:/tmp-->chown zabbix:zabbix 127.0.0.1-mysql_cacti_stats.txt For Oracle zabbix通过orabbix插件来监控Oracle数据库 可以去如下网址下载http://www.smartmarmot.com/product/orabbix/download/ Orabbix-1.2.3.zip orabbix是使用java写的工具,需要java环境的支持;安装下最新java, root@rac1:/opt/orabbix-->yum install java-1.7.0-openjdk.x86_64 在zabbix agent端执行 root@rac1:/root-->mkdir -p /opt/orabbix root@rac1:/opt/orabbix-->cp /root/orabbix-1.2.3.zip /opt/orabbix/ root@rac1:/root-->cd /opt/orabbix/ root@rac1:/root-->chmod –R a+x /opt/orabbix/ root@rac1:/opt/orabbix-->unzip orabbix-1.2.3.zip ##生成修改配置文件从sample拷贝 root@rac1:/opt/orabbix-->cp conf/config.props.sample conf/config.props root@rac1:/opt/orabbix-->vim conf/config.props root@rac1:/opt/orabbix/conf-->cat config.props #comma separed list of Zabbix servers ZabbixServerList=ZabbixServer1 ##配置zabbix主机名称 ZabbixServer1.Address=192.168.6.182 ##主机地址 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=rac1 ##被监控oracle服务器名称需要和主机新增host的hostname一致 #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 rac1.Url=jdbc:oracle:thin:@192.168.6.237:1521:racdb1 ##被监控oracle jdbc连接 rac1.User=zabbix ##被监控oracle用户 rac1.Password=zabbix ##被监控oracle密码 #Those values are optionals if not specified Orabbix is going to use the general values rac1.MaxActive=10 rac1.MaxWait=100 rac1.MaxIdle=1 rac1.QueryListFile=./conf/query.props DB2.Url=jdbc:oracle:thin:@server2.domain.example.com: DB2.Password=zabbix_password DB2.QueryListFile=./conf/query.props DB3.Url=jdbc:oracle:thin:@server3.domain.example.com: DB3.Password=zabbix_password DB3.QueryListFile=./conf/query.props ##在被监控oracle服务器上创建所需用户密码,被授予相应的权限;嫌麻烦的话直接用dba用户 oracle@rac1:/home/oracle||-->>sqlplus / as sysdba sys@RACDB>create user zabbix identified by \ User created. sys@RACDB>grant connect,resource to zabbix; Grant succeeded. 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_$sysem_event to zabbix; sys@RACDB>exit ##创建启动脚本 root@rac1:/opt/orabbix-->cp /opt/orabbix/init.d/orabbix /etc/init.d/orabbix root@rac1:/opt/orabbix-->chmod +x /etc/init.d/orabbix root@rac1:/opt/orabbix/conf-->service orabbix start ##启动服务 Starting Orabbix service: root@rac1:/opt/orabbix/conf-->ps -ef|grep orabbix ountry=US -Dlog4j.configuration=./conf/log4j.properties -cp 4.jar:lib/commons-dbcp-1.4.jar:lib/commons-lang-2.5.jar:lib/commons-logging-1.jar:lib/commons-pool-1.5.4.jar:lib/hsqldb.jar:lib/log4j-1.2.15.jar:lib/ojdjar:.:./orabbix-1.2.3.jar com.smartmarmot.orabbix.bootstrap props ##查看orabbix后台日志如下表示成功鸟 root@rac1:/opt/orabbix/logs-->tail orabbix.log 2014-12-18 16:57:06,943 [pool-1-thread-16] INFO Orabbix - Done with dbJob on database rac1 QueryList elapsed time 272 ms 2014-12-18 16:58:44,434 [pool-1-thread-17] INFO Orabbix - Done with dbJob on database rac1 QueryList elapsed time 37749 ms 2014-12-18 16:59:06,726 [pool-1-thread-18] INFO Orabbix - Done with dbJob on root 560 1 18 16:21 pts/1 00:00:01 java -Duser.language=en -Duser.c lib/commons-codec-1. 1.1. bc6. start ./conf/config. database rac1 QueryList elapsed time 25 ms 2014-12-18 17:01:10,076 [pool-1-thread-19] INFO Orabbix - Done with dbJob on database rac1 QueryList elapsed time 63341 ms 2014-12-18 17:01:10,644 [pool-1-thread-20] INFO Orabbix - Done with dbJob on database rac1 QueryList elapsed time 3898 ms 2014-12-18 17:02:40,830 [pool-1-thread-21] INFO Orabbix - Done with dbJob on database rac1 QueryList elapsed time 34034 ms 2014-12-18 17:03:06,870 [pool-1-thread-22] INFO Orabbix - Done with dbJob on database rac1 QueryList elapsed time 52 ms 2014-12-18 17:04:15,900 [pool-1-thread-23] INFO Orabbix - Done with dbJob on database rac1 QueryList elapsed time 9075 ms 2014-12-18 17:05:06,863 [pool-1-thread-24] INFO Orabbix - Done with dbJob on database rac1 QueryList elapsed time 30 ms 从日志看,大概是一分钟执行一次取数; 看下示例图:
正在阅读:
zabbix06-03
2018初中数学竞赛试卷精选题10套含答案(华师大版)11-24
实训考核练习题12-18
DSC法研究聚醚胺_酚醛胺_环氧树脂体系的固化行为_张天才05-20
云南省注册咨询工程师注册工作问题解答每日一讲2月10日02-28
上海公交线网优化导则10-05
部编人教版小学语文三年级下册:12、《一幅名扬中外的画》教学设计教案【2019-2020】09-02
各专业核心课程名单04-25
- 多层物业服务方案
- (审判实务)习惯法与少数民族地区民间纠纷解决问题(孙 潋)
- 人教版新课标六年级下册语文全册教案
- 词语打卡
- photoshop实习报告
- 钢结构设计原理综合测试2
- 2014年期末练习题
- 高中数学中的逆向思维解题方法探讨
- 名师原创 全国通用2014-2015学年高二寒假作业 政治(一)Word版
- 北航《建筑结构检测鉴定与加固》在线作业三
- XX县卫生监督所工程建设项目可行性研究报告
- 小学四年级观察作文经典评语
- 浅谈110KV变电站电气一次设计-程泉焱(1)
- 安全员考试题库
- 国家电网公司变电运维管理规定(试行)
- 义务教育课程标准稿征求意见提纲
- 教学秘书面试技巧
- 钢结构工程施工组织设计
- 水利工程概论论文
- 09届九年级数学第四次模拟试卷
- 中 科 软:定向增资结果报告书
- 教育政策与法规考试重点(1)
- 论刘宝楠《 论语正义》
- 建筑力学考试题库
- 2014年宜春国编教师招聘面试说课中应注意的几个问题
- 数字图像处理实验教程-V3.1-zsj
- 一路花香第二课时( 精备公开课)
- 谈谈你对解决问题教学与运算意义教学紧密结合的作用价值的理解
- 中国机械通用零部件工业协会
- 大学英语自主学习听力原文及答案006 test
- 实施班级自主管理
- 内审员资格考试试题
- 中学作文写作难点解决技巧论文
- 《城市建筑美学》读书笔记
- 句法结构之英语词性和句子成分
- 骨水泥
- 电工技术基础试题
- 最高人民法院关于人民法院委托评估、拍卖和变卖工作的若干规定
- 小学语文核心素养识字的实践研究 刘江
- 大学生课余生活调查报告