服务器安装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