2. zabbix平台部署

(1)部署LAMP环境

yum install httpd httpd-devel mariadb mariadb-server mariadb-devel php php-mysql php-devel -y


(2)配置zabbix虚拟主机

yum install zabbix40-web zabbix40-web-mysql -y
#修改配置文件
vim /etc/httpd/conf.d/zabbix.conf
开头添加
<virtualHost *:80>
servername blog.zabbix.com
documentRoot /usr/share/zabbix
修改时区
php_value date.timezone Asia/Shanghai
末尾添加
</virtualHost>


(3)配置数据库

MariaDB [(none)]> create database zabbix charset utf8;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all on zabbix.* to "zabbix"@"localhost" identified by "123456";
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)


(4)导入zabbix初始数据

[root@localhost ~]# yum install zabbix40-dbfiles-mysql -y
[root@localhost ~]# mysql -uzabbix -p123456 zabbix < /usr/share/zabbix-mysql/schema.sql
[root@localhost ~]# mysql -uzabbix -p123456 zabbix < /usr/share/zabbix-mysql/images.sql
[root@localhost ~]# mysql -uzabbix -p123456 zabbix < /usr/share/zabbix-mysql/data.sql


(5)配置zabbix-server

[root@localhost ~]# yum install zabbix40-server zabbix40-server-mysql -y
修改配置文件

[root@localhost ~]# grep "^[a-Z]" /etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbixsrv/zabbix_server.log
LogFileSize=0
PidFile=/run/zabbixsrv/zabbix_server.pid
SocketDir=/var/lib/zabbixsrv/tmp
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=123456
Timeout=4
AlertScriptsPath=/var/lib/zabbixsrv/alertscripts
ExternalScripts=/var/lib/zabbixsrv/externalscripts
LogSlowQueries=3000
TmpDir=/var/lib/zabbixsrv/tmp
SSLCertLocation=/var/lib/zabbixsrv/ssl/certs
SSLKeyLocation=/var/lib/zabbixsrv/ssl/keys


(6)启动服务

systemctl start zabbix-server systemctl start httpd systemctl start mysql


(7)安装zabbix



(8)添加监控主机

[root@localhost ~]# yum install zabbix40-agent -y
[root@localhost ~]# grep "^[a-Z]" /etc/zabbix_agentd.conf
PidFile=/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=192.168.1.12
ServerActive=127.0.0.1
Hostname=192.168.1.11
[root@localhost ~]# systemctl start zabbix-agent


利用zabbix自带的功能创建监控项

Configuration→Hosts→Items

Create item

Name:名称
Type:类型
Key:键值
Host interface:主机接口
Type of information:信息类型
Units:单位
Update interval:更新间隔
Custom intervals:自定义时间间隔

暂无评论

发送评论 编辑评论


				
上一篇