一、搭建zabbix服务,实现监控linux和windows的内存,cpu,磁盘,网络等基础指标
1、环境配置
主机名 | 用途 | ip | 需要搭建的服务 | 类型 | 备注 |
---|---|---|---|---|---|
node01 | zabbix-server | 192.168.85.128 | zabbix-server、zabbix-agent、httpd | centos7 | |
node02 | zabbix-agent | 192.168.85.129 | zabbix-agent | centos7 | |
node05 | zabbix-agent | 192.168.85.132 | zabbix-agent | win10 |
2、在node01上面安装并启动MariaDB数据库
# yum install -y mariadb-server
# vim /etc/my.cnf
[mysqld]
skip_name_resolve = ON
innodb_file_per_table = ON
# systemctl start mariadb.service
3、在数据库中添加zabbix数据库并添加普通用户
# mysql
MariaDB [(none)]> CREATE DATABASE zxabbix CHARSET 'utf8';
MariaDB [(none)]> GRANT ALL ON zabbix.* TO 'zbxuser'@'192.168.%.%' IDENTIFIED BY 'zabxpass';
MariaDB [(none)]> GRANT ALL ON zabbix.* TO 'zbxuser'@'127.0.0.1' IDENTIFIED BY 'zabxpass';
MariaDB [(none)]> FLUSH PRIVILEGES;
4、安装zabbix-server,导入zabbix数据,启动zabbix-server
# rpm -Uvh https://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
# cd /usr/share/doc/zabbix-server-mysql-3.0.25/
# gzip -d create.sql.gz
# mysql -uzbxuser -h127.0.0.1 -pzbxpass zabbix < create.sql
# yum install zabbix-get zabbix-server-mysql zabbix-web-mysql zabbix-agent -y
# yum install -y httpd php php-mysql php-mbstring php-gd php-bcmath php-ldap php-xml
# vim /etc/zabbix/zabbix_server.conf
DBHost=192.168.85.128 (第82行)
DBName=zabbix (第91行)
DBUser=zbxuser (第107行)
DBPassword=zbxpass (第116行)
# /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai (第二十行修改时区)
# systemctl start zabbix-server
# systemctl start httpd
5、配置并登录 (地址为http://ip/zabbix)
http://192.168.85.128/zabbix
登录前要进行配置,按照提示配置就行
默认用户:admin
默认密码:zabbix


6、在node02上面安装zabbix-agent
[root@node02 ~]# rpm -Uvh https://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
[root@node02 ~]# yum install -y zabbix-agent
[root@node02 ~]# vim /etc/zabbix/zabbix_agentd.conf
Server=192.168.85.128 (第96行)
ServerActive=192.168.85.128 (第137行)
[root@node02 ~]# systemctl start zabbix-agent
7、在zabbix上面添加node02主机
-
1、在"配置"中找见"主机",在右上角点"添加主机"
image.png
-
2、在"主机"中添加node02的ip地址
image.png
-
3、在"模板"中找到适用于linux主机的模板
[图片上传失败...(image-f0b123-1558933232152)]

- 4、点击添加,等待几分钟,待"可用性的ZBX"显示绿色的时候就说明添加成功

- 5、在"监测中"的"图形"即可查看相关参数



8、在node05上面安装zabbix-agent的时候
-
1、先将window的zabbix-agent压缩包解压到指定位置
image.png
-
2、修改conf文件
image.png
-
3、运行命令启动zabbix-agent
image.png
9、在zabbix-server,添加node05监控
-
1、在"配置"中找见"主机",在右上角点"添加主机"
image.png
-
2、在"主机"中添加node05的ip地址
image.png
-
3、在"模板"中找到适用于window主机
image.png
-
4、点击添加,等待几分钟,待"可用性的ZBX"显示绿色的时候就说明添加成功
image.png
-
5、在"监测中"的"图形"即可查看相关参数
[图片上传失败...(image-25ac3d-1558933714647)]



网友评论