Zabbix是完全开源的监控系统,同时整合了Cacti和Nagios,还提供了更多额外的功能如分布式监控、可以监控WEB页面的响应、代码、内容;适合大规模环境监控,支持10W以上设备;可布置分支机构代理服务器,减轻并发压力;
一、安装Zabbix
1、安装依赖软件包
[root@zabbix1 ~]# yum -y install curl curl-devel net-snmp net-snmp-devel perl-DBI gcc
2、下载zabbix 官网:http://www.zabbix.com/download.php
[root@zabbix1 ~]# mkdir /home/zabbix [root@zabbix1 ~]# cd /home/zabbix/ [root@zabbix1 zabbix]# wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.2.5/zabbix-2.2.5.tar.gz
3、安装zabbix
[root@zabbix1 zabbix]# useradd zabbix -s /sbin/nologin [root@zabbix1 zabbix]# tar zvxf zabbix-2.2.5.tar.gz [root@zabbix1 zabbix]# cd zabbix-2.2.5 [root@zabbix1 zabbix-2.2.5]# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --enable-proxy --with-mysql --with-net-snmp --with-libcurl [root@zabbix1 zabbix-2.2.5]# make install
4、创建数据库
[root@zabbix1 zabbix-2.2.5]# mysql -uroot -p123456 >create database zabbix character set utf8; >grant all on zabbix.* to zabbix@localhost identified by 'zabbix'; >flush privileges; >quit
5、导入数据
[root@zabbix1 zabbix-2.2.5]# vim database/mysql/schema.sql :%s/ENGINE=InnoDB/ENGINE=InnoDB CHARACTER SET utf8/g #用于解决中文显示问号问题 [root@zabbix1 zabbix-2.2.5]# mysql -uzabbix -pzabbix -hlocalhost zabbix < database/mysql/schema.sql [root@zabbix1 zabbix-2.2.5]# mysql -uzabbix -pzabbix -hlocalhost zabbix < database/mysql/images.sql [root@zabbix1 zabbix-2.2.5]# mysql -uzabbix -pzabbix -hlocalhost zabbix < database/mysql/data.sql
6、添加服务
[root@zabbix1 zabbix-2.2.5]# cat >>/etc/services < zabbix-agent 10050/tcp Zabbix Agent > zabbix-agent 10050/udp Zabbix Agent > zabbix-trapper 10051/tcp Zabbix Trapper > zabbix-trapper 10051/udp Zabbix Trapper > EOF
二、配置文件
1、配置Zabbix
[root@zabbix1 zabbix-2.2.5]# vim /usr/local/zabbix/etc/zabbix_server.conf DBName=zabbix DBUser=zabbix DBPassword=zabbix
2、配置PHP
[root@zabbix1 zabbix-2.2.5]# vim /etc/php.ini max_input_time = 600 max_execution_time = 300 date.timezone = Asia/Shanghai post_max_size = 32M memory_limit = 128M mbstring.func_overload = 2 [root@zabbix1 zabbix-2.2.5]# service httpd restart
三、自动启动
1、修改参数
修改启动脚本中的路径/usr/local改成/usr/local/zabbix
[root@zabbix1 zabbix-2.2.5]# cp misc/init.d/fedora/core/* /etc/init.d/ [root@zabbix1 zabbix-2.2.5]# sed -i 's/BASEDIR=///usr///local/BASEDIR=///usr///local///zabbix/g' /etc/init.d/zabbix_server [root@zabbix1 zabbix-2.2.5]# sed -i 's/BASEDIR=///usr///local/BASEDIR=///usr///local///zabbix/g' /etc/init.d/zabbix_agentd
2、启动进程
[root@zabbix1 zabbix-2.2.5]# echo "/etc/init.d/zabbix_server start" >> /etc/rc.local [root@zabbix1 zabbix-2.2.5]# echo "/etc/init.d/zabbix_agentd start" >> /etc/rc.local [root@zabbix1 zabbix-2.2.5]# /etc/init.d/zabbix_server start [root@zabbix1 zabbix-2.2.5]# /etc/init.d/zabbix_agentd start
3、查看端口
[root@zabbix1 zabbix-2.2.5]# netstat -npl|grep 10050 tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 12448/zabbix_agentd [root@zabbix1 zabbix-2.2.5]# netstat -npl|grep 10051 tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 12384/zabbix_server
4、开放端口
[root@zabbix1 zabbix-2.2.5]# iptables -I INPUT -p tcp --dport 10050:10051 -j ACCEPT [root@zabbix1 zabbix-2.2.5]# iptables -I INPUT -p udp --dport 10050:10051 -j ACCEPT [root@zabbix1 zabbix-2.2.5]# service iptables save
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/57400.html