安装部署zabbix监控服务及使用

服务器安装zabbix服务
安装mariaDB

[root@localhost ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost ~]# 
[root@localhost ~]# yum -y install mariadb-server mariadb
[root@localhost ~]# systemctl start mariadb
[root@localhost ~]# systemctl enable mariadb
[root@localhost ~]# 
[root@localhost ~]# mysql
MariaDB [(none)]>
MariaDB [(none)]> quit
Bye

安装zabbix
获取zabbix软件包,解压

[root@localhost ~]#unzip zabbix.zip
[root@localhost ~]# yum –y install createrepo
[root@localhost ~]#cd zabbix/yum
[root@localhost  yum]# createrepo ./
编辑yum仓库
[root@localhost ~]#vim /etc/yum.repos.d/linux.repo
[linux]
name=linux
baseurl=file:///mnt
enabled=1
gpgcheck=0
[zabbix]
name=zabbix
baseurl=file:///root/zabbix/yum
enabled=1
gpgcheck=0
[root@localhost ~]#yum -y install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent
[root@localhost yum]# mysql
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;			//创建数据库
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by '123123';	//授权
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> quit
Bye
[root@localhost yum]# zcat /usr/share/doc/zabbix-server-mysql-3.4.1/create.sql.gz | mysql -u zabbix -p zabbix
Enter password:					//
[root@localhost yum]# cp /etc/zabbix/zabbix_server.conf /etc/zabbix/zabbix_server.conf.bak	//备份主配置文件
[root@localhost yum]# vim /etc/zabbix/zabbix_server.conf													//修改主配置文件
93 DBHost=localhost			//数据库ip
103 DBName=zabbix				//数据库名称
119 DBUser=zabbix				//数据库授权的用户名
127  DBPassword=123123		//密码
[root@localhost yum]# cp /etc/zabbix/zabbix_agentd.conf /etc/zabbix/zabbix_agentd.conf.bak	//备份代理文件 
[root@localhost yum]# vim /etc/zabbix/zabbix_agentd.conf													编辑
97 Server=127.0.0.1				//客户端被动等待指定服务器来查询数据
138 ServerActive=127.0.0.1		//客户端主动提交数据到指定服务器。两个地址须保持一致
149 Hostname=Zabbix-server01
重启系统
[root@localhost ~]# setenforce 0
[root@localhost ~]# systemctl stop firewalld 
[root@localhost ~]# systemctl start zabbix-server
[root@localhost ~]# systemctl enable zabbix-server
[root@localhost ~]# systemctl start zabbix-agent
[root@localhost ~]# systemctl enable zabbix-agent
[root@localhost ~]# systemctl start httpd
[root@localhost ~]# systemctl enable httpd
[root@localhost ~]# vim /etc/httpd/conf.d/zabbix.conf 			//修改zabbix的网页配置文件
php_value date.timezone Asia/Shanghai									//修改时区,须与系统时区一致
[root@localhost ~]# systemctl restart httpd
[root@localhost ~]# 
[root@localhost ~]# systemctl stop firewalld
使用浏览器进行简单的配置
http://zabbix-server-ip/zabbix
  Next stepnext step检查mysql数据库名,授权用户名,填写密码,next step
自动显示host和port,手动写入name检查配置信息,next stepfinsh
账号 Admin
密码 zabbix
用户名:Admin    密码:zabbix sign in
zabbix用户管理
 administratorusersAdminLanguage:chineseupdate   刷新页面即可变为中文显示
创建新用户设置用户名、密码、组添加
被监控端linux服务器
安装agent代理
[root@localhost ~]# mount /dev/cdrom /mnt/
[root@localhost ~]# yum -y install createrepo
[root@localhost ~]# unzip zabbix.zip
[root@localhost ~]# cd zabbix/yum/
[root@localhost yum]# createrepo ./
[root@localhost yum]# vim /etc/yum.repos.d/linux.repo 
[linux]
name=linux
baseurl=file:///mnt
enabled=1
gpgcheck=0
[zabbix]
name=zabbix
baseurl=file:///root/zabbix/yum
enabled=1
gpgcheck=0
[root@localhost yum]# yum -y install zabbix-agent
[root@localhost ~]# cp /etc/zabbix/zabbix_agentd.conf /etc/zabbix/zabbix_agentd.conf.bak
[root@localhost ~]# vim /etc/zabbix/zabbix_agentd.conf			//代理配置文件
97 Server=192.168.100.103										//指定zabbix服务器ip
138 ServerActive=192.168.100.103								//指定zabbix服务器ip
149 Hostname=Zabbix-server01										//主机名,必须与103的主机名保持一致
[root@localhost ~]# systemctl start zabbix-agent
[root@localhost ~]# systemctl enable zabbix-agent
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# netstat -anpt | grep "agent"
tcp        0      0 0.0.0.0:10050           0.0.0.0:*               LISTEN      1214/zabbix_agentd  
tcp6       0      0 :::10050                :::*                    LISTEN      1214/zabbix_agentd  

添加主机
浏览器:http://192.168.100.103/zabbix
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值