zabbix安装
配置系统
1、调整系统时间
ntpdate ntp1.aliyun.com
2、调整系统时区
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
3、关闭selinux
不关闭seliunx会出现权限问题,建议关闭
setenforce 0
vim /etc/selinux/config
SELINUX=disabled
安装步骤
1、安装zabbix的yum源
rpm -i http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
2、安装zabbix
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
3、安装mariadb数据库,并且启动
yum install -y mariadb-server
systemctl start mariadb.service
刚刚安装的root账号没有密码,需要自行修改和管理账号
4、初始化zabbix数据库和创建访问账号
mysql -uroot -p
password
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'password';
5、将zabbix的sql文件导入到数据库中
zcat /usr/share/doc/zabbix-server-mysql-3.0.14/create.sql.gz | mysql -uzabbix -p zabbix
6、配置zabbix server连接数据库
vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
7、配置zabbix时区
vim /etc/httpd/conf.d/zabbix.conf
在<IfModule mod_php5.c>中添加
php_value date.timezone Asia/Shanghai
或者使用sed命令
sed -i.ori '18a php_value date.timezone Asia/Shanghai' /etc/httpd/conf.d/zabbix.conf
8、启动zabbix server服务
systemctl start zabbix-server
systemctl start httpd
9、写入开机启动
chmod +x /etc/rc.d/rc.local
cat >>/etc/rc.d/rc.local<<EOF
systemctl start mariadb.service
systemctl start httpd
systemctl start zabbix-server
EOF
10、输出访问
echo "浏览器访问 http://`hostname -I|awk '{print $1}'`/zabbix"
11、中文乱码解决
yum -y install wqy-microhei-fonts
\cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf
12、防火墙处理
如果系统开启了防火墙需要打开相应的端口
80端口开放:
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
13、zabbix web 安装
13.1、打开浏览器输入 http://ip/zabbix
13.2、下一步进行检测信息,看具体报错进行相应解决
13.3、下一步,配置数据库
13.4、配置zabbix server,name 自定义
13.5、信息确定
13.6、配置完成
13.7、登录,账号/密码:Admin/zabbix
客户端安装
1、安装zabbix yum源
rpm -i http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
2、安装客户端agent
yum install zabbix-agent -y
3、配置agent配置
4、启动服务
systemctl start zabbix-agent.service
5、设置为开机启动
chmod +x /etc/rc.d/rc.local
cat >>/etc/rc.d/rc.local<<EOF
systemctl start zabbix-agent.service
EOF
检测连通性工具
注意:只能在服务端进行测试
1、安装检测工具
yum install zabbix-get
2、在服务端进行测试
测试本地服务的agent连接
zabbix_get -s 127.0.0.1 -p 10050 -k "system.cpu.load[all,avg1]"