实时警报通知:微信告警通知的重要性解析
690
2023-03-16
Zabbix安装(二):安装zabbix
Zabbix是完全开源的监控系统,同时整合了Cacti和Nagios,还提供了更多额外的功能如分布式监控、可以监控WEB页面的响应、代码、内容;适合大规模环境监控,支持10W以上设备;可布置分支机构代理服务器,减轻并发压力;
一、安装Zabbix
1、安装依赖软件包
[root@zabbix1 ~]# yum -y install curl curl-devel net-snmp net-snmp-devel perl-DBI gcc
[root@zabbix1 ~]# yum -y install curl curl-devel net-snmp net-snmp-devel perl-DBI gcc
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
[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
[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
[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
[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
[root@zabbix1 zabbix-2.2.5]# vim /usr/local/zabbix/etc/zabbix_server.conf DBName=zabbix DBUser=zabbix DBPassword=zabbix
2、配置PHP
三、自动启动
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
[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
[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
[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
[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
发表评论
暂时没有评论,来抢沙发吧~